GHSA-hrfv-mqp8-q5rw

Suggest an improvement
Source
https://github.com/advisories/GHSA-hrfv-mqp8-q5rw
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2023/10/GHSA-hrfv-mqp8-q5rw/GHSA-hrfv-mqp8-q5rw.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-hrfv-mqp8-q5rw
Aliases
Related
Published
2023-10-25T14:22:59Z
Modified
2024-02-22T05:33:55.234928Z
Severity
  • 5.7 (Medium) CVSS_V3 - CVSS:3.1/AV:A/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H CVSS Calculator
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.

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.

References

Affected packages

PyPI / werkzeug

Package

Affected ranges

Type
ECOSYSTEM
Events
Introduced
3.0.0
Fixed
3.0.1

Affected versions

3.*

3.0.0

Ecosystem specific

{
    "affected_functions": [
        "werkzeug.sansio.multipart.MultipartDecoder._parse_data"
    ]
}

PyPI / werkzeug

Package

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
2.3.8

Affected versions

0.*

0.1
0.2
0.3
0.3.1
0.4
0.4.1
0.5
0.5.1
0.6
0.6.1
0.6.2
0.7
0.7.1
0.7.2
0.8
0.8.1
0.8.2
0.8.3
0.9
0.9.1
0.9.2
0.9.3
0.9.4
0.9.5
0.9.6
0.10
0.10.1
0.10.2
0.10.3
0.10.4
0.11
0.11.1
0.11.2
0.11.3
0.11.4
0.11.5
0.11.6
0.11.7
0.11.8
0.11.9
0.11.10
0.11.11
0.11.12
0.11.13
0.11.14
0.11.15
0.12
0.12.1
0.12.2
0.13
0.14
0.14.1
0.15.0
0.15.1
0.15.2
0.15.3
0.15.4
0.15.5
0.15.6
0.16.0
0.16.1

1.*

1.0.0rc1
1.0.0
1.0.1

2.*

2.0.0rc1
2.0.0rc2
2.0.0rc3
2.0.0rc4
2.0.0rc5
2.0.0
2.0.1
2.0.2
2.0.3
2.1.0
2.1.1
2.1.2
2.2.0a1
2.2.0
2.2.1
2.2.2
2.2.3
2.3.0
2.3.1
2.3.2
2.3.3
2.3.4
2.3.5
2.3.6
2.3.7

Ecosystem specific

{
    "affected_functions": [
        "werkzeug.sansio.multipart.MultipartDecoder._parse_data"
    ]
}