CVE-2026-102598: Werkzeug Vulnerability in safe_join Function Allows Access to Windows Special Device Names
Summary
CVE-2026-102598: Werkzeug safe_join() allows Windows special device names. Affects werkzeug versions < 3.1.9. Fixed in 3.1.9. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Werkzeug is a comprehensive WSGI utility library for Python that provides various tools for building web applications. It is widely used in the Flask framework and offers features like routing, request and response handling, and debugging. However, a vulnerability has been identified in its safe_join function, which can lead to security issues when handling file paths on Windows systems.
Vulnerability Detail
The vulnerability in Werkzeug's safe_join function arises from its failure to properly filter Windows special device names when they have an empty Alternate Data Stream (ADS) marker on NTFS. This oversight allows attackers to exploit the function by requesting paths that end with special device names like 'NUL:'. If an application uses send_from_directory to serve files and is running on Windows, it may hang indefinitely when attempting to read these files, leading to denial of service and potential data exposure.
How To Fix
Latest published version: 3.1.9 as of 22 Oct 2026
pip install --upgrade "werkzeug==3.1.9"
The newest release already contains this fix.
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, avoid using send_from_directory with user-specified paths that may end with special device names. Implement additional validation to sanitize user input and prevent the use of such paths.
Conclusion
The vulnerability identified as CVE-2026-102598 in Werkzeug's safe_join function poses a risk for applications running on Windows. By updating to version 3.1.9 or later, developers can mitigate this issue effectively. It is crucial to monitor for vulnerabilities using tools like Vulert to maintain application security.
See every vulnerability recorded for werkzeug →
FAQ
The CVSS score of this vulnerability is 6.3, indicating a moderate severity level.
You can use Vulert to monitor and alert in real-time for open-source vulnerabilities in your software. Visit the Vulert playground at Vulert Scanner to check if your application is affected without any signup.
Special device names in Windows are reserved names that refer to system devices, such as 'NUL:', 'CON:', and 'PRN:'. These names can be used in file paths and can lead to unexpected behavior if not handled properly.
The impact of this vulnerability includes potential denial of service, as the application may hang indefinitely when trying to read files with special device names. This can disrupt service availability and affect user experience.
Yes, you can implement input validation to ensure that user-specified paths do not include special device names. However, updating to the patched version is the recommended solution.
References
Related vulnerabilities
Recent vulnerabilities recorded for werkzeug.