Werkzeug safe_join() allows Windows special device names with compound extensions
Published 8 Jan 2026 · Updated 10 Sept 2026
Is your project on an affected werkzeug?
Look after several Python apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected package
- Affected
- <3.1.5
- Fixed in
- 3.1.5
pip install 'werkzeug>=3.1.5'Details
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.
Is GHSA-87hc-h4r5-73f7 in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected werkzeug, and gives you the command that fixes it.
More advisories for werkzeug
- MediumCVE-2026-102598Werkzeug safe_join() allows Windows special device names · 5 Oct 2026
- MediumCVE-2026-27199 Werkzeug safe_join() allows Windows special device names · 19 Feb 2026
- MediumCVE-2025-66221Werkzeug safe_join() allows Windows special device names · 2 Dec 2025
- MediumCVE-2024-49767Werkzeug possible resource exhaustion when parsing file data in forms · 25 Oct 2024
- MediumCVE-2024-49766Werkzeug safe_join not safe on Windows · 25 Oct 2024
- HighCVE-2024-34069Werkzeug debugger vulnerable to remote execution when interacting with attacker controlled domain · 6 May 2024
References
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.