PyPI: werkzeug
CVE-2026-21860
Safety vulnerability ID: SFTY-20260108-75748
Safety legacy ID: pyup.io-84324
Affected versions of the Werkzeug package are vulnerable to Improper Handling of Windows Device Names due to incomplete validation of Windows reserved device names in user-controlled path segments. In werkzeug.security.safe_join, path components ending with special device names (for example CON or AUX) are not reliably rejected when they include compound extensions (for example CON.txt.html) or trailing spaces, and werkzeug.utils.send_from_directory relies on safe_join when resolving a requested filename.
Overview
Werkzeug safe_join() allows Windows special device names with compound extensions
Advisory
Affected versions of the Werkzeug package are vulnerable to Improper Handling of Windows Device Names due to incomplete validation of Windows reserved device names in user-controlled path segments. In werkzeug.security.safe_join, path components ending with special device names (for example CON or AUX) are not reliably rejected when they include compound extensions (for example CON.txt.html) or trailing spaces, and werkzeug.utils.send_from_directory relies on safe_join when resolving a requested filename.
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20260108-75748/CVE-2026-21860
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-21860
- https://github.com/advisories/GHSA-87hc-h4r5-73f7
- https://github.com/pallets/werkzeug/security/advisories/GHSA-87hc-h4r5-73f7
- https://github.com/pallets/werkzeug/commit/7ae1d254e04a0c33e241ac1cca4783ce6c875ca3
- https://nvd.nist.gov/vuln/detail/CVE-2026-21860
- https://github.com/advisories/GHSA-87hc-h4r5-73f7
Verified by Safety
Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.
Learn more
