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

Source: https://junglewise.ai/threats/cve-2026-27199-werkzeug-safe-join-allows-windows-special-device-names  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-02-21. Updated: 2026-09-26  
License: CC BY 4.0 with a link back

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)](https://junglewise.ai/threats/technologies/werkzeug). Vendors: [PyPI](https://junglewise.ai/threats/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

  ```sh
  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

- [https://github.com/pallets/werkzeug/security/advisories/GHSA-29vq-49wr-vm6x](https://github.com/pallets/werkzeug/security/advisories/GHSA-29vq-49wr-vm6x)

## Related threats

- [Werkzeug path traversal via NUL device with NTFS ADS marker](https://junglewise.ai/threats/cve-2026-102598-werkzeug-is-a-comprehensive-wsgi-web-application-library-prior)
- [PYSEC-2026-2044 - Werkzeug safe_join() allows Windows special device names with compound extensions](https://junglewise.ai/threats/cve-2026-21860-werkzeug-safe-join-allows-windows-special-device-names-with)
- [PYSEC-2026-2045 - Werkzeug safe_join not safe on Windows](https://junglewise.ai/threats/cve-2024-49766-werkzeug-safe-join-not-safe-on-windows)
- [PYSEC-2026-2043 - Werkzeug debugger vulnerable to remote execution when interacting with attacker controlled domain](https://junglewise.ai/threats/cve-2024-34069-werkzeug-debugger-remote-code-execution-via-attacker-controlled)
- [PYSEC-2026-1065 - Pallets Werkzeug vulnerable to Path Traversal](https://junglewise.ai/threats/cve-2019-14322-pallets-werkzeug-vulnerable-to-path-traversal)
