CVE-2023-46136: Pallets Werkzeug denial of service in multipart parser

CVE-2023-46136 · Severity: medium · CVSS 5.7 · Published 2023-10-25

Werkzeug is a widely used library for building web applications in Python. A flaw in how it handles file uploads allows an attacker to send a specially crafted request that consumes excessive CPU and memory. This can slow down or completely crash the web server, preventing legitimate users from accessing the service.

Technologies: werkzeug (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2023-46136 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2023-46136 being exploited in the wild.
How severe is CVE-2023-46136?
Medium severity, with a CVSS score of 5.7, published 25 October 2023.
Which products and versions are affected?
werkzeug (PyPI) ECOSYSTEM:introduced=3.0.0,fixed=3.0.1, GIT:introduced=0,fixed=f3c803b3ade485a45f12b6d6617595350c0f03e2,fixed=f2300208d5e2a5076cbbb4c2aad71096fd040ef9|ECOSYSTEM:introduced=0,fixed=2.3.8,introduced=3.0.0,fixed=3.0.1.
Is there a fix for CVE-2023-46136?
Yes. werkzeug (PyPI): upgrade to 3.0.1 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2023-46136 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2023-46136?
Check whether you run werkzeug (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • werkzeug (PyPI): upgrade to 3.0.1 or later
    pip install "werkzeug>=3.0.1"

Technical details

A denial of service vulnerability exists in the Werkzeug multipart/form-data parser due to inefficient buffer management. When a multipart part begins with a carriage return (CR) or line feed (LF) character followed by a large amount of data without those characters, the parser inefficiently appends chunks to an internal bytearray. This results in quadratic-time complexity for boundary lookups on a growing buffer. An attacker can exploit this by sending crafted multipart data to any endpoint that parses such input, leading to high CPU usage and potential Out-of-Memory (OOM) kills. The issue is fixed in versions 3.0.1 and 2.3.8.

Affected products

  • Pallets Werkzeug >= 3.0.0, < 3.0.1; >= 2.0.0rc1, < 2.3.8

Identifiers

  • CVE-2023-46136
  • GHSA-hrfv-mqp8-q5rw
  • PYSEC-2023-221

Timeline

  • 2023-10-24: patched: Fixes released in versions 3.0.1 and 2.3.8
  • 2023-10-25: disclosed: GitHub Advisory published

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.