Werkzeug DoS: High resource usage when parsing multipart/form-data containing a large part with CR/LF character at the beginning
Published 25 Oct 2023 · Updated 10 Sept 2026
Is your project on an affected werkzeug?
Look after several Python apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected packages
- Affected
- >=3.0.0 <3.0.1
- Fixed in
- 3.0.1
pip install 'werkzeug>=3.0.1'- Affected
- >=2.0.0rc1 <2.3.8
- Fixed in
- 2.3.8
pip install 'werkzeug>=2.3.8'Details
Werkzeug multipart data parser needs to find a boundary that may be between consecutive chunks. That's why parsing is based on looking for newline characters. Unfortunately, code looking for partial boundary in the buffer is written inefficiently, so if we upload a file that starts with CR or LF and then is followed by megabytes of data without these characters: all of these bytes are appended chunk by chunk into internal bytearray and lookup for boundary is performed on growing buffer.
This allows an attacker to cause a denial of service by sending crafted multipart data to an endpoint that will parse it. The amount of CPU time required can block worker processes from handling legitimate requests. The amount of RAM required can trigger an out of memory kill of the process. If many concurrent requests are sent continuously, this can exhaust or kill all available workers.
Is GHSA-hrfv-mqp8-q5rw in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected werkzeug, and gives you the command that fixes it.
More advisories for werkzeug
- MediumCVE-2026-102598Werkzeug safe_join() allows Windows special device names · 5 Oct 2026
- MediumCVE-2026-27199 Werkzeug safe_join() allows Windows special device names · 19 Feb 2026
- MediumCVE-2026-21860 Werkzeug safe_join() allows Windows special device names with compound extensions · 8 Jan 2026
- MediumCVE-2025-66221Werkzeug safe_join() allows Windows special device names · 2 Dec 2025
- MediumCVE-2024-49767Werkzeug possible resource exhaustion when parsing file data in forms · 25 Oct 2024
- MediumCVE-2024-49766Werkzeug safe_join not safe on Windows · 25 Oct 2024
References
- Linkgithub.com/pallets/werkzeug/security/advisories/GHSA-hrfv-mqp8-q5rw
- Advisorynvd.nist.gov/vuln/detail/CVE-2023-46136
- Linkgithub.com/pallets/werkzeug/commit/b1916c0c083e0be1c9d887ee2f3d696922bfc5c1
- Linkgithub.com/pallets/werkzeug/commit/cbb446fdcada7685fce936ded01b76c08dbd6eb5
- Linkgithub.com/pallets/werkzeug/commit/f2300208d5e2a5076cbbb4c2aad71096fd040ef9
- Linkgithub.com/pallets/werkzeug/commit/f3c803b3ade485a45f12b6d6617595350c0f03e2
- Packagegithub.com/pallets/werkzeug
- Linkgithub.com/pypa/advisory-database/tree/main/vulns/werkzeug/PYSEC-2023-221.yaml
- Linksecurity.netapp.com/advisory/ntap-20231124-0008
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.