Medium

Werkzeug safe_join() allows Windows special device names with compound extensions

  • Disclosed: 08.01.2026
  • Updated: 11.10.2026 15:17

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.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Python (PyPI) werkzeug < 3.1.5 3.1.5

References

CVSS score 5.3/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L
Weakness (CWE)
CWE-67
Platform
Python (PyPI)
Package
werkzeug
Disclosed
08.01.2026
Updated
11.10.2026 15:17

Sources and licenses

OSV / GitHub Advisory Database - PYSEC-2026-2044 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-87hc-h4r5-73f7 - CC BY 4.0

Vulnerability history: werkzeug

All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (15) in the archive
Total entries
15
First → latest
10.2017 10.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • High 4
  • Medium 9
  • Low 1
  • Unrated 1

Disclosures per year

  1. 2017: 1
  2. 2018: 0
  3. 2019: 1
  4. 2020: 1
  5. 2021: 0
  6. 2022: 2
  7. 2023: 3
  8. 2024: 3
  9. 2025: 1
  10. 2026: 3
Severity:
  1. Werkzeug safe_join() allows Windows special device names with compound extensions this entry
    Medium · 5.3 CVE-2026-21860 < 3.1.5 3.1.5
  2. High · 7.5 CVE-2019-14322 < 0.15.5 0.15.5
  3. High · 7.5 CVE-2019-14806 < 0.15.3 0.15.3

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.