---
id: CVE-2025-66221
aliases:
  - GHSA-hgf8-39gv-g3f2
  - PYSEC-2026-2046
title: Werkzeug safe_join() allows Windows special device names
summary: Werkzeug safe_join() allows Windows special device names
severity: medium
vendor: werkzeug
product: werkzeug
ecosystem: pip
affected:
  - werkzeug < 3.1.4
patched:
  - werkzeug 3.1.4
published: '2025-12-02'
updated: '2026-09-10'
sourceUpdated: '2026-09-10T03:50:31.900494607Z'
source: OSV
sourceUrl: 'https://osv.dev/vulnerability/GHSA-hgf8-39gv-g3f2'
references:
  - url: >-
      https://github.com/pallets/werkzeug/security/advisories/GHSA-hgf8-39gv-g3f2
  - url: 'https://nvd.nist.gov/vuln/detail/CVE-2025-66221'
  - url: >-
      https://github.com/pallets/werkzeug/commit/4b833376a45c323a189cd11d2362bcffdb1c0c13
  - url: 'https://github.com/pallets/werkzeug'
  - url: 'https://github.com/pallets/werkzeug/releases/tag/3.1.4'
tags:
  - osv
  - pip
epss: 0.00511
epssPercentile: 0.41065
ingestedAt: '2026-07-08T18:25:50.210Z'
---

## Overview

Werkzeug's `safe_join` function allows path segments with Windows device names. On Windows, there are special device names such as `CON`, `AUX`, etc that are implicitly present and readable in every directory. `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.

## Affected packages

- `werkzeug < 3.1.4`

## Remediation

Upgrade to a patched release:

- `werkzeug 3.1.4`
