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

Medium 6.3 Published Updated

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.

PackageAffectedFixed in
werkzeug PyPIAll versions3.1.4
werkzeug PyPIAll versions3.1.4
werkzeug PyPIAll versions3.1.4
Linux distribution packages (1)
python-openapi-core openSUSE:TumbleweedAll versions0.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.

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.

Is CVE-2025-66221 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free