# CVE-2026-93712: Dancer2 versions from 2.1.0 before 2.2.0 for Perl serve files from outside public_dir via relative path segments in the File route handler

The Markdown version of <https://upatch.dev/cve/CVE-2026-93712>. Last updated 25 Nov 2026.

## At a glance

CVE-2026-93712 is rated High 7.5 (CVSS 3.1, CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N). It affects Dancer2 and was published on 22 Sept 2026. It is not in CISA's Known Exploited Vulnerabilities catalog. Its EPSS score is 0.5%: the estimated chance it is exploited in the next 30 days, as of 25 Nov 2026. The upatch `cve-2026-93712-dancer2-block` mitigates it, and is vetted (merged into the registry).

A upatch is a signed BPF program that shirudo loads into a running Linux kernel to block the code path this CVE's exploit takes. It holds the line until the fix ships; it does not replace patching.

## The vulnerability

CVE-2026-93712, published on 22 September 2026, is a path traversal vulnerability in `Dancer2::Handler::File` (`lib/Dancer2/Handler/File.pm`) in Dancer2 versions from 2.1.0 before 2.2.0 for Perl. The handler joins `public_dir` with the request's `path_info` using `Path::Tiny::path` without collapsing relative `..` segments or checking that the resolved path stays within `public_dir`. Because its 403 guard tested `Path::Tiny::stringify` for `undef`, which is never returned, the handler checked only `-f` and `-r` and then served the file with `slurp_raw`. When an application enables the `File` route handler in `route_handlers` and disables the default static middleware with `static_handler: 0` (which otherwise wraps the app in `Plack::App::File` and rejects `..` segments), an unauthenticated GET or HEAD request such as `/../secret.txt` or percent-encoded `/%2e%2e/secret.txt` can read any regular file on the filesystem that the worker process can read.

### Official description

Dancer2 versions from 2.1.0 before 2.2.0 for Perl serve files from outside public_dir via relative path segments in the File route handler.

The handler joins the request path onto public_dir without collapsing relative segments, and checks only that the result is a readable regular file. A request for \`/../outside.txt\` escapes public_dir, and percent-encoding the dots reaches the same file.

The handler is off by default. An application is affected once it names File in route_handlers and sets static_handler to 0, which otherwise refuses a dot segment before the route runs.

Any file the worker process can read is served to an unauthenticated request, including the application's config.yml above public_dir.

## What the upatch does

Two BPF LSM programs return `-EPERM` when a Perl worker process (`perl`, `plackup`, or `starman` by command name or `perl*` executable) performs a filesystem lookup whose active `task->nameidata` pathname enters `public/` (at the start of a relative path or after `/`) and subsequently contains a `/..` segment:

| Hook                | Refused                                                               |
| ------------------- | --------------------------------------------------------------------- |
| `lsm/inode_getattr` | `stat` (`-f` check) on a pathname with a `..` segment after `public/` |
| `lsm/file_open`     | Opening a file along a pathname with a `..` segment after `public/`   |

Refusing `lsm/inode_getattr` and `lsm/file_open` stops `Dancer2::Handler::File` from reading files reached via `..` segments out of `public/` (`slurp_raw` fails with `EPERM`, returning HTTP 500) without disclosing the target file's contents.

The `refused` per-CPU array counts refusals at key 0 for `inode_getattr` and key 1 for `file_open`.

The policy: [`cve-2026-93712-dancer2-block.bpf.c`](https://github.com/copper-helm/upatch-registry/tree/main/upatches/cve-2026-93712), 163 lines of BPF C attached at `lsm/inode_getattr` and `lsm/file_open`, licensed GPL-2.0 OR BSD-2-Clause.

## Side effects

- Any `stat` or `open` by a Perl process using an uncollapsed pathname that contains `public/` followed by a `..` path component fails with `EPERM`.
- Requests to a vulnerable `Dancer2::Handler::File` route that traverse `..` out of `public/` fail with HTTP 404 or HTTP 500 (whereas Dancer2 2.2.0 answers HTTP 403 after resolving `realpath`).
- Serving files inside `public/` without `..` segments, and application routes that access files outside `public/` directly without walking through `public/..`, continue to work normally.
- Not covered: an application whose `public_dir` directory is named something other than `public`, or a path where `public/` lies deeper than the first 246 bytes of the lookup pathname.

## Preemption model and cost

The programs are written for preemptible RCU (`PREEMPT_LAZY`, `PREEMPT_DYNAMIC`, and `PREEMPT_RT`). They keep no shared state beyond the `refused` per-CPU counter map, which is updated with an atomic fetch-and-add. On every `inode_getattr` and `file_open` call, non-Perl tasks and calls outside a `nameidata` lookup return immediately after checking `task->nameidata`, the 16-byte `task->comm`, and the executable dentry name. Only Perl path lookups read up to 256 bytes of the kernel filename buffer.

## Affected versions

Application versions:

| Package        | Affected              | Fixed in |
| -------------- | --------------------- | -------- |
| Dancer2 (CPAN) | 2.1.0 to before 2.2.0 | 2.2.0    |

Kernels: any Linux kernel supported by shirudo with BPF LSM and BTF enabled where `task_struct->nameidata` points to the active `struct nameidata` during path walks.

## How it was tested

On a vulnerable Dancer2 2.1.0 application with the File route handler enabled and static_handler set to 0, the loaded upatch refused ../outside.txt traversal out of public/ (HTTP 500) while normal static requests for /hello.txt under public/ kept returning HTTP 200.

- **Tested:** 25 Nov 2026
- **Target:** Dancer2 2.1.0 on Perl with route_handlers File and static_handler=0, listening on 127.0.0.1:5000
- **Kernel:** 7.4-shirudo-ci-20261123
- **Architecture:** x86_64
- **Distribution:** Ubuntu 26.04

### Results

| State           | Traversal outside public_dir blocked | Normal public file /hello.txt served |
| --------------- | ------------------------------------ | ------------------------------------ |
| Before loading  | no (HTTP 200)                        | yes (HTTP 200)                       |
| Upatch loaded   | yes (HTTP 500)                       | yes (HTTP 200)                       |
| After unloading | no (HTTP 200)                        | yes (HTTP 200)                       |

## How to apply

Build the upatch from source, sign it with your own shirudo key, and publish it to your own OCI registry. Machines that follow your upatch tree load it within about a minute.

Build and sign:

```sh
git clone https://github.com/copper-helm/upatch-registry
cd upatch-registry
tools/build <shirudo-checkout> <keys-dir> 1.0.0 upatches/cve-2026-93712
```

Publish and roll out:

```sh
shirudo bpm push build/packages/cve-2026-93712-1.0.0.bee oci://<registry>/<namespace>/cve-2026-93712 --keys-dir <keys-dir>
shirudo bpm tree append build/packages/cve-2026-93712-1.0.0.bee oci://<registry>/<namespace>/<tree> --tree-id <tree-id> --keys-dir <keys-dir>
```

## Review

- Contributors: romanlab.
- Reviewers: none recorded yet.

## Sources and links

- [GHSA-6xw8-v24c-m783 advisory](https://github.com/PerlDancer/Dancer2/security/advisories/GHSA-6xw8-v24c-m783)
- [Fix commit 2446a09ffb83fef71cc75c327bd6e4b1f007b885](https://github.com/PerlDancer/Dancer2/commit/2446a09ffb83fef71cc75c327bd6e4b1f007b885.patch)
- [Dancer2 2.2.0 changes on MetaCPAN](https://metacpan.org/release/CROMEDOME/Dancer2-2.2.0/changes)
- [oss-security CVE-2026-93712 announcement](http://www.openwall.com/lists/oss-security/2026/09/22/4)

### Links

- [CVE-2026-93712 on upatch.dev](https://upatch.dev/cve/CVE-2026-93712) (this page, as HTML)
- [NVD](https://nvd.nist.gov/vuln/detail/CVE-2026-93712)
- [CVE.org](https://www.cve.org/CVERecord?id=CVE-2026-93712)
- [CWE-22](https://cwe.mitre.org/data/definitions/22.html)
- Upatch source: [upatches/cve-2026-93712](https://github.com/copper-helm/upatch-registry/tree/main/upatches/cve-2026-93712)

### More references from NVD (4)

- [github.com](https://github.com/PerlDancer/Dancer2/commit/2446a09ffb83fef71cc75c327bd6e4b1f007b885.patch)
- [github.com](https://github.com/PerlDancer/Dancer2/security/advisories/GHSA-6xw8-v24c-m783)
- [metacpan.org](https://metacpan.org/release/CROMEDOME/Dancer2-2.2.0/changes)
- [openwall.com](http://www.openwall.com/lists/oss-security/2026/09/22/4)
