# CVE-2025-66221: Werkzeug safe_join() allows Windows special device names

> Attackers can cause indefinite hangs in applications using Werkzeug on Windows by requesting paths with special device names, leading to denial of service.

- **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:** 29 Nov 2025
- **Updated:** 1 Dec 2025
- **Also known as:** ALPINE-CVE-2025-66221, CLEANSTART-2026-EI28722, CLEANSTART-2026-FI32293, CLSA-2026-1772583182, CLSA-2026-1789365574, ECHO-7d05-d296-ca8f, GHSA-hgf8-39gv-g3f2, MINI-ccw2-c5hx-4v4h, MINI-p3rh-jr33-5r68, PYSEC-2026-2046, ROOT-APP-PYPI-CVE-2025-66221, openSUSE-SU-2025:15848-1

## What is CVE-2025-66221?

CVE-2025-66221 is a medium-severity denial of service vulnerability in pallets werkzeug, published on 29 Nov 2025. 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.4, Werkzeug's safe_join function allows path segments with Windows device names. On Windows, there are special device names such as CON, AUX, etc that are implicitly present and readable in every directory. 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 patched in version 3.1.4.

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

## Which versions are affected by CVE-2025-66221?

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.4 |
| `werkzeug` | PyPI | All versions | 3.1.4 |
| `werkzeug` | PyPI | All versions | 3.1.4 |
| `python-openapi-core` | openSUSE:Tumbleweed | All versions | 0.22.0-1.1 |

Products: Palletsprojects Werkzeug.

## How do I fix CVE-2025-66221?

Upgrade werkzeug to 3.1.4 or later.

## Is CVE-2025-66221 being exploited?

There is no known exploitation of CVE-2025-66221 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-2025-66221 and fix it if it is affected.

What it is: CVE-2025-66221 is a medium-severity denial of service vulnerability in pallets werkzeug, published on 29 Nov 2025. 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-2025-66221 in the wild and no public exploit code.

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

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

## Sources

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

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