CVE-2026-27199: CWE-67: Improper Handling of Windows Device Names in pallets werkzeug
Werkzeug is a comprehensive WSGI web application library. Versions 3.1.5 and below, the safe_join function allows Windows device names as filenames if preceded by other path segments. This was previously reported as GHSA-hgf8-39gv-g3f2, but the added filtering failed to account for the fact that safe_join accepts paths with multiple segments, such as example/NUL. The function 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. This issue has been fixed in version 3.1.6.
AI Analysis
Technical Summary
Werkzeug is a widely used WSGI web application library that provides utilities for safely serving files through its safe_join and send_from_directory functions. In versions 3.1.5 and earlier, the safe_join function attempts to prevent directory traversal and unsafe file access by sanitizing user-supplied paths. However, it fails to properly handle Windows device names (e.g., NUL, CON, PRN) when these device names appear as the final segment of a multi-segment path, such as example/NUL. The filtering logic was insufficient because it did not consider that safe_join accepts paths with multiple segments, allowing these special device names to bypass checks. When send_from_directory uses safe_join to serve files, it can open these device files on Windows systems. Attempting to read from such device files causes the application to hang indefinitely, leading to a denial-of-service condition. This vulnerability is identified as CWE-67 (Improper Neutralization of Input During Pathname Resolution) and has a CVSS 4.0 score of 6.3, indicating medium severity. Exploitation requires no privileges or user interaction and can be triggered remotely by sending crafted requests that specify paths ending with Windows device names. The issue was fixed in Werkzeug version 3.1.6 by improving path validation to correctly handle multi-segment paths containing device names.
Potential Impact
This vulnerability can cause denial-of-service (DoS) conditions in web applications using vulnerable Werkzeug versions on Windows platforms. Attackers can remotely trigger the application to hang indefinitely by requesting paths that end with special Windows device names, potentially disrupting service availability. This can impact web services, APIs, and any applications relying on Werkzeug's file-serving utilities, leading to downtime and degraded user experience. While it does not directly expose sensitive data or allow code execution, the DoS impact can be leveraged in targeted attacks against critical web infrastructure. Organizations with high availability requirements or those serving Windows-based environments are particularly at risk. The vulnerability does not require authentication or user interaction, increasing the attack surface. No known exploits are reported in the wild yet, but the ease of triggering the hang condition makes it a credible threat.
Mitigation Recommendations
The primary mitigation is to upgrade Werkzeug to version 3.1.6 or later, where the vulnerability is fixed. If immediate upgrading is not feasible, organizations should implement strict input validation on user-supplied paths to block requests containing Windows device names such as NUL, CON, PRN, AUX, COM1-COM9, and LPT1-LPT9, especially when these appear as the last path segment. Additionally, consider deploying web application firewalls (WAFs) with custom rules to detect and block suspicious path requests targeting device names. Monitoring application logs for repeated requests with device name patterns can help identify attempted exploitation. Running Werkzeug-based applications on non-Windows platforms can also reduce risk, as the issue specifically affects Windows device name handling. Finally, ensure that application timeout settings are configured to prevent indefinite hangs in case of unexpected file reads.
Affected Countries
United States, Germany, United Kingdom, France, Japan, Canada, Australia, Netherlands, South Korea, India
CVE-2026-27199: CWE-67: Improper Handling of Windows Device Names in pallets werkzeug
Description
Werkzeug is a comprehensive WSGI web application library. Versions 3.1.5 and below, the safe_join function allows Windows device names as filenames if preceded by other path segments. This was previously reported as GHSA-hgf8-39gv-g3f2, but the added filtering failed to account for the fact that safe_join accepts paths with multiple segments, such as example/NUL. The function 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. This issue has been fixed in version 3.1.6.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
Werkzeug is a widely used WSGI web application library that provides utilities for safely serving files through its safe_join and send_from_directory functions. In versions 3.1.5 and earlier, the safe_join function attempts to prevent directory traversal and unsafe file access by sanitizing user-supplied paths. However, it fails to properly handle Windows device names (e.g., NUL, CON, PRN) when these device names appear as the final segment of a multi-segment path, such as example/NUL. The filtering logic was insufficient because it did not consider that safe_join accepts paths with multiple segments, allowing these special device names to bypass checks. When send_from_directory uses safe_join to serve files, it can open these device files on Windows systems. Attempting to read from such device files causes the application to hang indefinitely, leading to a denial-of-service condition. This vulnerability is identified as CWE-67 (Improper Neutralization of Input During Pathname Resolution) and has a CVSS 4.0 score of 6.3, indicating medium severity. Exploitation requires no privileges or user interaction and can be triggered remotely by sending crafted requests that specify paths ending with Windows device names. The issue was fixed in Werkzeug version 3.1.6 by improving path validation to correctly handle multi-segment paths containing device names.
Potential Impact
This vulnerability can cause denial-of-service (DoS) conditions in web applications using vulnerable Werkzeug versions on Windows platforms. Attackers can remotely trigger the application to hang indefinitely by requesting paths that end with special Windows device names, potentially disrupting service availability. This can impact web services, APIs, and any applications relying on Werkzeug's file-serving utilities, leading to downtime and degraded user experience. While it does not directly expose sensitive data or allow code execution, the DoS impact can be leveraged in targeted attacks against critical web infrastructure. Organizations with high availability requirements or those serving Windows-based environments are particularly at risk. The vulnerability does not require authentication or user interaction, increasing the attack surface. No known exploits are reported in the wild yet, but the ease of triggering the hang condition makes it a credible threat.
Mitigation Recommendations
The primary mitigation is to upgrade Werkzeug to version 3.1.6 or later, where the vulnerability is fixed. If immediate upgrading is not feasible, organizations should implement strict input validation on user-supplied paths to block requests containing Windows device names such as NUL, CON, PRN, AUX, COM1-COM9, and LPT1-LPT9, especially when these appear as the last path segment. Additionally, consider deploying web application firewalls (WAFs) with custom rules to detect and block suspicious path requests targeting device names. Monitoring application logs for repeated requests with device name patterns can help identify attempted exploitation. Running Werkzeug-based applications on non-Windows platforms can also reduce risk, as the issue specifically affects Windows device name handling. Finally, ensure that application timeout settings are configured to prevent indefinite hangs in case of unexpected file reads.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-02-18T19:47:02.155Z
- Cvss Version
- 4.0
- State
- PUBLISHED
Threat ID: 699a1a4cbe58cf853b44ca10
Added to database: 2/21/2026, 8:49:16 PM
Last enriched: 3/1/2026, 5:58:04 AM
Last updated: 4/8/2026, 7:15:26 AM
Views: 173
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.