Werkzeug Safe Join Function Vulnerability Allowing Windows Device Name Paths

Vulnerability

A vulnerability exists in Werkzeug's safe_join function in versions prior to 3.1.4, allowing the use of Windows special device names as path segments. On Windows, device names like CON and AUX are always present and readable in any directory. The send_from_directory function, which relies on safe_join to serve files from user-specified paths, can be exploited by requesting a path that ends with a device name. While the file will be opened, the read operation will hang indefinitely. This issue has been addressed in Werkzeug version 3.1.4.

Impact

Exploitation of this vulnerability leads to a denial-of-service condition, where file reading operations hang indefinitely.

Reproduction

To reproduce this vulnerability, use Werkzeug versions prior to 3.1.4 on a Windows system. Request a file from a directory using the send_from_directory function, ensuring that the path ends with a special device name like CON or AUX. The file will be opened, but the reading process will become unresponsive.

Remediation

Users can upgrade to Werkzeug version 3.1.4 or later, where this vulnerability has been fixed.

Added: Nov 29, 2025, 3:19 AM
Updated: Nov 29, 2025, 3:19 AM

Vulnerability Rating

Custom Algorithm
spread
8.1
impact
0.6
exploitability
6.9
remediation
7.7
relevance
1.2
threat
4.8
urgency
2.9
incentive
1.7

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.