Skip to main content
VulnerabilityPublished

CVE-2026-21860: pallets werkzeug · Improper Handling of Windows Device Names

Affects pallets werkzeugSource CVE Database V5

0

Not known to be exploited · CVSS 6.3 Medium : upgrade to 3.1.5 when convenient.

Data as of 26 Oct 2026, 14:05 UTC

CVSS 4.0 base score
6.3Medium
How severe the flaw is on the 0–10 CVSS scale.
EPSS
0.4% chance of exploitation in 30 days – higher than 40% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
Patch
Available – fixed in 3.1.5
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

Exploitation evidence

  1. Disclosed: evidence found.

    CVE published 8 Jan 2026

  2. Detectable: no evidence on record.

    No public nuclei template indexed

  3. Weaponised: no evidence on record.

    No public exploit code indexed in Metasploit or Exploit-DB

  4. Exploited in the wild: no evidence on record.

    Not in CISA KEV and no source reports exploitation

  5. Observed by OffSeq Mirage: no evidence on record.

    No attack traffic recorded by OffSeq Mirage sensors

A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 26 Oct 2026.

What to do

Upgrade pallets werkzeug to 3.1.5.

Affected software

ProductAffectedFixed in
palletswerkzeugAffected
  • <3.1.5
Fixed in
  • 3.1.5
PyPIwerkzeugpkg:pypi/werkzeugOther threatsAffected
  • <3.1.5
Fixed in
  • 3.1.5

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

  1. Upgrade Werkzeug to version 3.1.5 or later immediately to apply the official patch that correctly handles Windows device names in path segments.
  2. Audit all Python web applications running on Windows servers to identify usage of Werkzeug and verify versions.
  3. Implement additional input validation and sanitization on file path parameters at the application level to detect and reject suspicious device name patterns (e.g., CON, AUX, PRN) with extensions or trailing spaces.
  4. Employ runtime application self-protection (RASP) or web application firewalls (WAFs) configured to detect and block requests containing Windows device names in path inputs.
  5. Monitor application logs for unusual file access attempts involving reserved device names.
  6. Educate development teams about Windows-specific path handling quirks and the importance of secure path joining functions.
  7. Consider isolating Windows-hosted web applications in hardened environments with strict access controls to limit impact if exploitation occurs.

Description

Werkzeug's `safe_join` function allows path segments with Windows device names that have file extensions or trailing spaces. On Windows, there are special device names such as `CON`, `AUX`, etc that are implicitly present and readable in every directory. Windows still accepts them with any file extension, such as `CON.txt`, or trailing spaces such as `CON `. This was previously reported as https://github.com/pallets/werkzeug/security/advisories/GHSA-hgf8-39gv-g3f2, but the fix failed to account for compound extensions such as `CON.txt.html` or trailing spaces. It also missed some additional special names. `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.

References

Community reviews

Loading reviews…