CVE-2026-27199: CWE-67: Improper Handling of Windows Device Names in pallets werkzeug
CVE-2026-27199 is a medium severity vulnerability in Werkzeug versions prior to 3. 1. 6, involving improper handling of Windows device names in the safe_join function. The safe_join function is intended to securely join user-supplied paths to a base directory, preventing directory traversal. However, it fails to properly filter Windows special device names (e. g. , NUL) when these are part of a multi-segment path like example/NUL. When used on Windows, the send_from_directory function calls safe_join and may open such device names as files. Attempting to read these files causes the application to hang indefinitely. This can lead to denial of service conditions in web applications using Werkzeug on Windows.
AI Analysis
Technical Summary
Werkzeug is a widely used WSGI utility library for Python web applications, providing functions such as safe_join to securely concatenate user-supplied paths with a base directory, mitigating directory traversal attacks. In versions 3.1.5 and earlier, safe_join attempts to block Windows special device names (like CON, NUL, PRN) to prevent misuse. However, the filtering logic was incomplete and did not account for device names appearing as the final segment in multi-segment paths (e.g., example/NUL). This oversight allows such paths to bypass the filter. When send_from_directory uses safe_join to serve files from user-specified paths on Windows, it may open these special device names as if they were files. Reading from these device files causes the application to hang indefinitely, effectively causing a denial of service (DoS). The vulnerability is tracked as CWE-67 (Improper Neutralization of Windows Device Names). Exploitation requires no authentication or user interaction and can be triggered remotely via crafted HTTP requests. The issue was addressed in Werkzeug 3.1.6 by improving the filtering logic to correctly handle device names in all path segments.
Potential Impact
This vulnerability primarily enables denial of service attacks against web applications running Werkzeug on Windows platforms. An attacker can craft requests that cause the application to hang indefinitely when attempting to read special device names treated as files. This can degrade service availability, potentially leading to resource exhaustion or application downtime. Since Werkzeug is a foundational library used by many Python web frameworks, the impact can cascade to numerous applications and services relying on it. Although the vulnerability does not allow code execution or data disclosure, the resulting DoS can disrupt business operations, degrade user experience, and increase operational costs. Organizations with Windows-based Python web servers are particularly at risk. The lack of known exploits in the wild suggests limited current exploitation, but the ease of triggering the issue remotely without authentication increases the risk of opportunistic attacks.
Mitigation Recommendations
The primary mitigation is to upgrade Werkzeug to version 3.1.6 or later, where the vulnerability is fixed. For organizations unable to upgrade immediately, a temporary workaround is to implement input validation on user-supplied paths to reject or sanitize any segments matching Windows special device names (CON, NUL, PRN, AUX, COM1-COM9, LPT1-LPT9) regardless of their position in the path. Additionally, monitoring application logs for repeated requests containing suspicious device names can help detect exploitation attempts. Deploying web application firewalls (WAFs) with custom rules to block requests targeting these device names can provide further protection. Finally, consider isolating Windows-based web servers or limiting exposure to untrusted networks to reduce attack surface until patches are applied.
Affected Countries
United States, Germany, United Kingdom, France, Japan, Canada, Australia, Netherlands, South Korea, Brazil
CVE-2026-27199: CWE-67: Improper Handling of Windows Device Names in pallets werkzeug
Description
CVE-2026-27199 is a medium severity vulnerability in Werkzeug versions prior to 3. 1. 6, involving improper handling of Windows device names in the safe_join function. The safe_join function is intended to securely join user-supplied paths to a base directory, preventing directory traversal. However, it fails to properly filter Windows special device names (e. g. , NUL) when these are part of a multi-segment path like example/NUL. When used on Windows, the send_from_directory function calls safe_join and may open such device names as files. Attempting to read these files causes the application to hang indefinitely. This can lead to denial of service conditions in web applications using Werkzeug on Windows.
AI-Powered Analysis
Technical Analysis
Werkzeug is a widely used WSGI utility library for Python web applications, providing functions such as safe_join to securely concatenate user-supplied paths with a base directory, mitigating directory traversal attacks. In versions 3.1.5 and earlier, safe_join attempts to block Windows special device names (like CON, NUL, PRN) to prevent misuse. However, the filtering logic was incomplete and did not account for device names appearing as the final segment in multi-segment paths (e.g., example/NUL). This oversight allows such paths to bypass the filter. When send_from_directory uses safe_join to serve files from user-specified paths on Windows, it may open these special device names as if they were files. Reading from these device files causes the application to hang indefinitely, effectively causing a denial of service (DoS). The vulnerability is tracked as CWE-67 (Improper Neutralization of Windows Device Names). Exploitation requires no authentication or user interaction and can be triggered remotely via crafted HTTP requests. The issue was addressed in Werkzeug 3.1.6 by improving the filtering logic to correctly handle device names in all path segments.
Potential Impact
This vulnerability primarily enables denial of service attacks against web applications running Werkzeug on Windows platforms. An attacker can craft requests that cause the application to hang indefinitely when attempting to read special device names treated as files. This can degrade service availability, potentially leading to resource exhaustion or application downtime. Since Werkzeug is a foundational library used by many Python web frameworks, the impact can cascade to numerous applications and services relying on it. Although the vulnerability does not allow code execution or data disclosure, the resulting DoS can disrupt business operations, degrade user experience, and increase operational costs. Organizations with Windows-based Python web servers are particularly at risk. The lack of known exploits in the wild suggests limited current exploitation, but the ease of triggering the issue remotely without authentication increases the risk of opportunistic attacks.
Mitigation Recommendations
The primary mitigation is to upgrade Werkzeug to version 3.1.6 or later, where the vulnerability is fixed. For organizations unable to upgrade immediately, a temporary workaround is to implement input validation on user-supplied paths to reject or sanitize any segments matching Windows special device names (CON, NUL, PRN, AUX, COM1-COM9, LPT1-LPT9) regardless of their position in the path. Additionally, monitoring application logs for repeated requests containing suspicious device names can help detect exploitation attempts. Deploying web application firewalls (WAFs) with custom rules to block requests targeting these device names can provide further protection. Finally, consider isolating Windows-based web servers or limiting exposure to untrusted networks to reduce attack surface until patches are applied.
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: 2/21/2026, 8:49:58 PM
Last updated: 2/22/2026, 6:12:27 AM
Views: 10
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.
Related Threats
CVE-2026-2929: Stack-based Buffer Overflow in D-Link DWR-M960
HighCVE-2026-2928: Stack-based Buffer Overflow in D-Link DWR-M960
HighCVE-2026-2927: Stack-based Buffer Overflow in D-Link DWR-M960
HighCVE-2026-2926: Stack-based Buffer Overflow in D-Link DWR-M960
HighCVE-2026-2925: Stack-based Buffer Overflow in D-Link DWR-M960
HighActions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.