# CVE-2026-27199: Werkzeug safe_join() allows Windows special device names

> Attackers can cause indefinite hangs in Windows-based applications using Werkzeug by requesting paths ending in special device names.

- **Severity:** Medium 6.3 (`CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 21 Feb 2026
- **Updated:** 24 Feb 2026
- **Also known as:** ALPINE-CVE-2026-27199, CLEANSTART-2026-DZ40075, CLEANSTART-2026-XY59001, ECHO-1285-c76d-e885, GHSA-29vq-49wr-vm6x, MINI-g328-rhhc-47v3, MINI-vpm4-97qp-6f7g, PYSEC-2026-2320, ROOT-APP-PYPI-CVE-2026-27199

## What is CVE-2026-27199?

CVE-2026-27199 is a medium-severity denial of service vulnerability in pallets werkzeug, published on 21 Feb 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Werkzeug is a comprehensive WSGI web application library. Versions 3.1.5 and below, the safe_join function allows Windows device names as filenames if preceded by other path segments. This was previously reported as GHSA-hgf8-39gv-g3f2, but the added filtering failed to account for the fact that safe_join accepts paths with multiple segments, such as example/NUL. The function send_from_directory uses safe_join to safely serve files at user-specified paths under a directory. If the application is running on Windows, and the requested path ends with a special device name, the file will be opened successfully, but reading will hang indefinitely. This issue has been fixed in version 3.1.6.

Weakness: CWE-67 (Improper Handling of Windows Device Names)

## Which versions are affected by CVE-2026-27199?

3 open source packages ship an affected version, including werkzeug. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `werkzeug` | PyPI | All versions | 3.1.6 |
| `werkzeug` | PyPI | All versions | 3.1.6 |
| `werkzeug` | PyPI | All versions | 3.1.6 |

Products: Palletsprojects Werkzeug.

## How do I fix CVE-2026-27199?

Upgrade werkzeug to 3.1.6 or later.

## Is CVE-2026-27199 being exploited?

There is no known exploitation of CVE-2026-27199 in the wild and no public exploit code.

Public exploit code:

- https://github.com/alimezar/CVE-2026-27199-werkzeug-safe-join-bypass-PoC (github_poc): https://github.com/alimezar/CVE-2026-27199-werkzeug-safe-join-bypass-PoC

## Other vulnerabilities in pallets werkzeug

- [CVE-2022-29361](https://insights.sbomify.com/CVE-2022-29361/): Other in n/a (critical 9.8)
- [CVE-2023-46136](https://insights.sbomify.com/CVE-2023-46136/): Werkzeug DoS: High resource usage when parsing multipart/form-data containing a large part with CR/LF character at the beginning (high 8.0)
- [CVE-2023-25577](https://insights.sbomify.com/CVE-2023-25577/): Werkzeug may allow high resource usage when parsing multipart form data with many fields (high 7.5)
- [CVE-2019-14322](https://insights.sbomify.com/CVE-2019-14322/): Pallets Werkzeug vulnerable to Path Traversal (high 7.5)
- [CVE-2026-21860](https://insights.sbomify.com/CVE-2026-21860/): Werkzeug safe_join() allows Windows special device names with compound extensions (medium 6.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-27199 and fix it if it is affected.

What it is: CVE-2026-27199 is a medium-severity denial of service vulnerability in pallets werkzeug, published on 21 Feb 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-27199 in the wild and no public exploit code.

Affected packages and fixed versions:
- werkzeug (PyPI): affected all versions; fixed in 3.1.6
- werkzeug (PyPI): affected all versions; fixed in 3.1.6
- werkzeug (PyPI): affected all versions; fixed in 3.1.6

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-27199/ (Markdown: https://insights.sbomify.com/CVE-2026-27199/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-27199
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-27199
- OSV: https://osv.dev/vulnerability/CVE-2026-27199

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-27199/
Summaries are generated and may contain mistakes; the official description above is the record.
