# CVE-2026-21860: Werkzeug safe_join() allows Windows special device names with compound extensions

> Werkzeug's safe_join function fails to block Windows special device names with extensions, allowing attackers to read sensitive system files on Windows servers.

- **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:** 8 Jan 2026
- **Updated:** 8 Jan 2026
- **Also known as:** ALPINE-CVE-2026-21860, CLEANSTART-2026-FD77375, CLEANSTART-2026-TQ31393, ECHO-f6ae-4560-1e3c, GHSA-87hc-h4r5-73f7, MINI-g7f9-qvxm-mrqc, MINI-v45h-whv3-h7pj, PYSEC-2026-2044, ROOT-APP-PYPI-CVE-2026-21860

## What is CVE-2026-21860?

CVE-2026-21860 is a medium-severity path traversal vulnerability in pallets werkzeug, published on 8 Jan 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. Prior to version 3.1.5, Werkzeug's safe_join function allows path segments with Windows device names that have file extensions or trailing spaces. On Windows, there are special device names such as CON, AUX, etc that are implicitly present and readable in every directory. Windows still accepts them with any file extension, such as CON.txt, or trailing spaces such as CON. This issue has been patched in version 3.1.5.

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

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

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


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

Products: Palletsprojects Werkzeug.

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

Upgrade werkzeug to 3.1.5 or later.

## Is CVE-2026-21860 being exploited?

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

## 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-27199](https://insights.sbomify.com/CVE-2026-27199/): Werkzeug safe_join() allows Windows special device names (medium 6.3)

## Fix prompt for AI coding agents

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

What it is: CVE-2026-21860 is a medium-severity path traversal vulnerability in pallets werkzeug, published on 8 Jan 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-21860 in the wild and no public exploit code.

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

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-21860/ (Markdown: https://insights.sbomify.com/CVE-2026-21860/index.md)
```

## Sources

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

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