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.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
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
Which versions are affected by CVE-2025-66221?
3 open source packages ship an affected version, including werkzeug. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
werkzeug PyPI | All versions | 3.1.4 |
werkzeug PyPI | All versions | 3.1.4 |
werkzeug PyPI | All versions | 3.1.4 |
Linux distribution packages (1)
python-openapi-core openSUSE:Tumbleweed | All versions | 0.22.0-1.1 |
Products include Palletsprojects Werkzeug.
How do I fix CVE-2025-66221?
Upgrade werkzeug to 3.1.4 or later.
Upgrade, then put limits on request size, rate and nesting depth so one client cannot exhaust the service. More about Denial of service.
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 Other in n/a
- CVE-2023-46136 Werkzeug DoS: High resource usage when parsing multipart/form-data containing a large part with CR/LF character at the beginning
- CVE-2023-25577 Werkzeug may allow high resource usage when parsing multipart form data with many fields
- CVE-2019-14322 Pallets Werkzeug vulnerable to Path Traversal
- CVE-2026-27199 Werkzeug safe_join() allows Windows special device names
Sources
Also known as ALPINE-CVE-2025-66221, CLEANSTART-2026-EI28722, CLEANSTART-2026-FI32293, CLSA-2026-1772583182, CLSA-2026-1789365574, ECHO-7d05-d296-ca8f and 6 more.