CVE-2023-46136: Werkzeug DoS Remote Code Execution Vulnerability

MODERATE
Advisory Identifier: GHSA-hrfv-mqp8-q5rw
CVSS 5.7
CWE-400 CWE-787
Published
Advisory Summary

CVE-2023-46136 is a MODERATE (CVSS 5.7) remote code execution vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting Werkzeug DoS libraries in the PyPI ecosystem. The issue involves high resource usage when parsing multipart/form-data containing a large part with cr/lf character at the beginning. Remediation is available by upgrading affected packages to version 3.0.1, 2.3.8.

CVE-2023-46136 at a Glance

CVE Identifier CVE-2023-46136
GHSA Identifier GHSA-hrfv-mqp8-q5rw
Severity MODERATE
CVSS v3.1 Base Score 5.7
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product Werkzeug DoS
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Adjacent (AV:A)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2023-46136

To remediate this vulnerability, upgrade all affected Werkzeug DoS dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

Werkzeug fixed: 3.0.1
pip install Werkzeug>=3.0.1
Werkzeug fixed: 2.3.8
pip install Werkzeug>=2.3.8
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show Werkzeug

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2023-46136, inspect your installed packages using pip:

pip show Werkzeug

Analyze the terminal output to locate any version of Werkzeug DoS in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.0.1), your application is affected.

Note: The pip show Werkzeug command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In Werkzeug DoS, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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.

CVE-2023-46136 Affected Werkzeug DoS Versions

2 component(s)
Fixed Versions:
3.0.12.3.8
Product / Package Ecosystem Affected Versions Fixed Version
Werkzeug
PyPI
≥ 3.0.0
< 3.0.1
3.0.1
Werkzeug
PyPI
≥ 2.0.0rc1
< 2.3.8
2.3.8

References

Frequently Asked Questions

What is CVE-2023-46136?
CVE-2023-46136 is a security vulnerability in Werkzeug DoS involving High resource usage when parsing multipart/form-data containing a large part with CR/LF character at the beginning under CWE-400: Uncontrolled Resource Consumption.
Which Werkzeug DoS versions are affected?
Affected versions include releases prior to 3.0.1, 2.3.8 across affected packages: Werkzeug.
What version fixes CVE-2023-46136?
Upgrading to 3.0.1, 2.3.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Werkzeug affected?
Yes, Werkzeug is affected in releases prior to 3.0.1, 2.3.8. Upgrade your dependency to 3.0.1, 2.3.8 or later.
What is the CVSS score of CVE-2023-46136?
CVE-2023-46136 has a CVSS v3.1 base score of 5.7 (MODERATE) with vector string CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2023-46136?
CVE-2023-46136 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check PyPI dependencies for CVE-2023-46136?
Run the dependency tree command: 'pip show Werkzeug'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-hrfv-mqp8-q5rw",
  "modified" : "2026-05-20T22:21:18Z",
  "published" : "2023-10-25T14:22:59Z",
  "aliases" : [ "CVE-2023-46136" ],
  "summary" : "Werkzeug DoS: High resource usage when parsing multipart/form-data containing a large part with CR/LF character at the beginning",
  "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.\n\nThis 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Werkzeug"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.0.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Werkzeug"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0rc1"
      }, {
        "fixed" : "2.3.8"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/pallets/werkzeug/security/advisories/GHSA-hrfv-mqp8-q5rw"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-46136"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pallets/werkzeug/commit/b1916c0c083e0be1c9d887ee2f3d696922bfc5c1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pallets/werkzeug/commit/cbb446fdcada7685fce936ded01b76c08dbd6eb5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pallets/werkzeug/commit/f2300208d5e2a5076cbbb4c2aad71096fd040ef9"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pallets/werkzeug/commit/f3c803b3ade485a45f12b6d6617595350c0f03e2"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pallets/werkzeug"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/werkzeug/PYSEC-2023-221.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://security.netapp.com/advisory/ntap-20231124-0008"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-787" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-10-25T14:22:59Z",
    "nvd_published_at" : "2023-10-25T18:17:36Z"
  }
}