Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. starlette
  4. ›
  5. GMS-2024-92

GMS-2024-92: Starlette Content-Type Header ReDoS

February 5, 2024

Summary

When using form data, python-multipart uses a Regular Expression to parse the HTTP Content-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. 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.

References

  • github.com/advisories/GHSA-93gm-qmq6-w238
  • github.com/andrew-d/python-multipart/blob/d3d16dae4b061c34fe9d3c9081d9800c49fc1f7a/multipart/multipart.py
  • github.com/encode/starlette/commit/13e5c26a27f4903924624736abd6131b2da80cc5
  • github.com/encode/starlette/security/advisories/GHSA-93gm-qmq6-w238

Code Behaviors & Features

Detect and mitigate GMS-2024-92 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions up to 0.36.1

Fixed versions

  • 0.36.2

Solution

Upgrade to version 0.36.2 or above.

Source file

pypi/starlette/GMS-2024-92.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 14 May 2025 12:16:16 +0000.