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

CVE-2026-27199 · Severity: medium · CVSS 4 · Published 2026-02-21

Werkzeug is a widely-used Python web framework utility library that includes a safe_join() function for securely serving files to users. The function fails to properly block Windows special device names (like NUL, COM1, etc.) when they appear at the end of a multi-segment file path. On Windows systems, an attacker can craft a request to a path like "example/NUL" that will cause the application to hang indefinitely when attempting to read the file, creating a denial-of-service condition.

Technologies: werkzeug (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2026-27199 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-27199 being exploited in the wild.
How severe is CVE-2026-27199?
Medium severity, with a CVSS score of 4, published 21 February 2026.
Which products and versions are affected?
werkzeug (PyPI) ECOSYSTEM:introduced=0,fixed=3.1.6.
Is there a fix for CVE-2026-27199?
Yes. werkzeug (PyPI): upgrade to 3.1.6 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-27199 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-27199?
Check whether you run werkzeug (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • werkzeug (PyPI): upgrade to 3.1.6 or later
    pip install "werkzeug>=3.1.6"

Technical details

The vulnerability is a path traversal/special file bypass (CWE-67) in Werkzeug's safe_join() function. The function is designed to prevent access to files outside a intended directory and block Windows reserved device names, but its filtering logic failed to account for multi-segment paths where a device name appears only at the final segment (e.g., "example/NUL"). The send_from_directory() function relies on safe_join() to safely serve user-requested files. On Windows, when a path resolves to a special device name, the file opens successfully but subsequent read operations hang indefinitely, causing the worker thread to become unavailable. An attacker can trigger this via a network request to an affected web application without authentication. The vulnerability affects all versions prior to 3.1.6, which includes a proper fix.

Affected products

  • Pallets Werkzeug < 3.1.6

Identifiers

  • CVE-2026-27199
  • GHSA-29vq-49wr-vm6x
  • PYSEC-2026-2320

Timeline

  • 2026-02-19: disclosed: Advisory GHSA-29vq-49wr-vm6x published
  • 2026-02-19: patched: Version 3.1.6 released with fix

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.