chore(deps): update dependency python-multipart to v0.0.7 [security] #200
No reviewers
Labels
No labels
automerge
backend
bug
ci/tooling
dependencies
documentation
duplicate
enhancement
feature
frontend
good first issue
help wanted
invalid
question
research
test-dependencies
wontfix
No milestone
No project
No assignees
1 participant
Due date
No due date set.
Dependencies
No dependencies set.
Reference: marc/rotini#200
Loading…
Reference in a new issue
No description provided.
Delete branch "renovate/pypi-python-multipart-vulnerability"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR contains the following updates:
==0.0.6
->==0.0.7
GitHub Vulnerability Alerts
CVE-2024-24762
Summary
When using form data,
python-multipart
uses a Regular Expression to parse the HTTPContent-Type
header, including options.An attacker could send a custom-made
Content-Type
option that is very difficult for the RegEx to process, consuming CPU resources and stalling indefinitely (minutes or more) while holding the main event loop. This means that process can't handle any more requests.This can create a ReDoS (Regular expression Denial of Service): https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS
This only applies when the app uses form data, parsed with
python-multipart
.Details
A regular HTTP
Content-Type
header could look like:python-multipart
parses the option with this RegEx:d3d16dae4b/multipart/multipart.py (L72-L74)
A custom option could be made and sent to the server to break it with:
PoC
Create a simple WSGI application, that just parses the
Content-Type
, and run it withpython main.py
:Then send the attacking request with:
Impact
It's a ReDoS, (Regular expression Denial of Service), it only applies to those reading form data. This way it also affects other libraries using Starlette, like FastAPI.
Original Report
This was originally reported to FastAPI as an email to security@tiangolo.com, sent via https://huntr.com/, the original reporter is Marcello, https://github.com/byt3bl33d3r
Original report to FastAPI
Hey Tiangolo!
My name's Marcello and I work on the ProtectAI/Huntr Threat Research team, a few months ago we got a report (from @nicecatch2000) of a ReDoS affecting another very popular Python web framework. After some internal research, I found that FastAPI is vulnerable to the same ReDoS under certain conditions (only when it parses Form data not JSON).
Here are the details: I'm using the latest version of FastAPI (0.109.0) and the following code:
I'm running the above with uvicorn with the following command:
Then run the following cUrl command:
You'll see the server locks up, is unable to serve anymore requests and one CPU core is pegged to 100%
You can even start uvicorn with multiple workers with the --workers 4 argument and as long as you send (workers + 1) requests you'll completely DoS the FastApi server.
If you try submitting Json to the /submit_json endpoint with the malicious Content-Type header you'll see it isn't vulnerable. So this only affects FastAPI when it parses Form data.
Cheers
Impact
An attacker is able to cause a DoS on a FastApi server via a malicious Content-Type header if it parses Form data.
Occurrences
params.py L586
Release Notes
andrew-d/python-multipart (python-multipart)
v0.0.7
Compare Source
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate. View repository job log here.