CVE-2026-102598: Werkzeug safe_join() allows Windows special device names
Werkzeug is a comprehensive WSGI web application library. Prior to 3.1.9, the safejoin function used by sendfromdirectory can allow a NUL: special-device path because safejoin checks the Windows device name without first removing an empty NTFS ADS marker. The trigger is that an application runs on Windows with NTFS and serves a user-specified path ending in a special device name such as NUL:. The attack mechanism is that a requested path ends in a Windows special device name with an empty ADS marker. The impact is that the special device opens successfully and the file read hangs indefinitely. This issue is fixed in version 3.1.9.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Werkzeugto a version that resolves this vulnerability.Fixed in 3.1.9
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
Applications using Werkzeug versions before 3.1.9 are exposed when they run on Windows with NTFS and use safe_join through send_from_directory to serve a user-specified path. Deployments outside that Windows and NTFS scenario are not described as affected.
What input is required to trigger the problem?
An attacker must be able to request a user-controlled path that ends in a Windows special device name with an empty NTFS alternate data stream marker, such as NUL:. This causes the special device to open and the file read to hang indefinitely.
How can this be remediated?
Upgrade Werkzeug to version 3.1.9, which fixes the handling of these device-name paths.