Home / tiangolo / fastapi / CVE-2021-32677
CVE-2021-32677: is it exploited, and which versions of tiangolo fastapi are affected and fixed?
CVE-2021-32677 is a cross-site request forgery (CSRF) vulnerability in tiangolo fastapi. It is not known to be exploited: it is not in CISA's Known Exploited Vulnerabilities catalog (catalog 2026.11.30, read December 3, 2026, 18:09 UTC). Affected: fastapi before 0.65.2 (GitHub advisory GHSA-8h2j-cgx8-6xv7). Fixed in 0.65.2 (GitHub advisory GHSA-8h2j-cgx8-6xv7). Severity: High (8.2, CVSS 3.1, from GitHub_M).
Data checked December 3, 2026: last read CISA KEV December 3, 2026, 18:09 UTC, CVE record November 19, 2026, 07:15 UTC and NVD November 19, 2026, 07:57 UTC.
What is CVE-2021-32677?
Cross-Site Request Forgery (CSRF) in FastAPI
FastAPI is a web framework for building APIs with Python 3.6+ based on standard Python type hints. FastAPI versions lower than 0.65.2 that used cookies for authentication in path operations that received JSON payloads sent by browsers were vulnerable to a Cross-Site Request Forgery (CSRF) attack. In versions lower than 0.65.2, FastAPI would try to read the request payload as JSON even if the content-type header sent was not set to application/json or a compatible JSON media type (e.g. application/geo+json). A request with a content type of text/plain containing JSON data would be accepted and the JSON data would be extracted. Requests with content type text/plain are exempt from CORS preflights, for being considered Simple requests. The browser will execute them right away including cookies, and the text content could be a JSON string that would be parsed and accepted by the FastAPI application. This is fixed in FastAPI 0.65.2. The request data is now parsed as JSON only if the content-type header is application/json or another JSON compatible media type like application/geo+json. It's best to upgrade to the latest FastAPI, but if updating is not possible then a middleware or a dependency that checks the content-type header and aborts the request if it is not application/json or another JSON compatible content type can act as a mitigating workaround.
From the CVE record by GitHub_M, last updated August 3, 2024, 23:25 UTC.
Which versions are affected, and which fix it?
| Vendor | Product | Affected | Fixed or not affected from |
|---|---|---|---|
| tiangolo | fastapi | < 0.65.2 |
As the CVE record by GitHub_M states it, last updated August 3, 2024. Version ranges are the CNA's; a version the record calls not affected is usually the fix.
Which packages are affected, and in which version is each fixed?
| Ecosystem | Package | Affected | Fixed in | Advisory |
|---|---|---|---|---|
| PyPI | fastapi | < 0.65.2 | 0.65.2 | GHSA-8h2j-cgx8-6xv7 |
GitHub Advisory Database, reviewed advisories (CC BY 4.0); advisory updated September 20, 2024. Summary: Cross-Site Request Forgery (CSRF) in FastAPI.
Which products and versions does the NVD list as affected?
| Vendor | Product | Versions | Type |
|---|---|---|---|
| tiangolo | fastapi | before 0.65.2 | application |
| fedoraproject | fedora | 34 | operating system |
NVD analysis (status Modified), last modified June 17, 2026, 03:53 UTC.
How severe is CVE-2021-32677?
| Score | Version | Vector | Source |
|---|---|---|---|
| High 8.2 | CVSS 3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N | GitHub_M |
| High 8.1 | CVSS 3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N | NVD |
| Medium 5.8 | CVSS 2.0 | AV:N/AC:M/Au:N/C:P/I:P/A:N | NVD |
Each score is shown as its source gave it: the CNA that wrote the record, CISA's ADP (vulnrichment) and the NVD. They can differ.
What the ratings mean: in CVSS 3 and 4, scores run from 0 to 10, with Low 0.1 to 3.9, Medium 4.0 to 6.9, High 7.0 to 8.9 and Critical 9.0 to 10.0. CVSS 2 has no Critical band: its High runs from 7.0 to 10.0. The vector lists how the flaw is reached (network, local), what an attacker needs (privileges, a user's click) and what it can harm.
Is CVE-2021-32677 exploited in the wild?
- CISA KEV
- Not listed (catalog 2026.11.30)
- EPSS
- 0.72% probability of exploitation activity in the next 30 days, percentile 55.3 (FIRST EPSS, scores of December 3, 2026)
What kind of flaw is it?
- CWE-352 Cross-Site Request Forgery
Where are the vendor advisories and references?
- https://github.com/tiangolo/fastapi/security/advisories/GHSA-8h2j-cgx8-6xv7 x_refsource_CONFIRM
- https://github.com/tiangolo/fastapi/commit/fa7e3c996edf2d5482fff8f9d890ac2390dede4d x_refsource_MISC
- FEDORA-2021-917e89c036 vendor-advisory, x_refsource_FEDORA
When was it published, and where is the official record?
- Reserved
- May 12, 2021
- Published
- June 9, 2021, 17:30 UTC
- CVE record updated
- August 3, 2024, 23:25 UTC by GitHub_M
- NVD
- Modified, last modified June 17, 2026, 03:53 UTC
- Last checked
- CVE list November 19, 2026, 07:15 UTC; NVD November 19, 2026, 07:57 UTC; KEV December 3, 2026, 18:09 UTC; EPSS December 3, 2026
- Official record
- cve.org · NVD
What other CVEs affect fastapi?
- Feb 5, 2024CVE-2024-24762 Kludex python-multipart: denial of service (uncontrolled resource consumption)
Questions about CVE-2021-32677
Is CVE-2021-32677 exploited in the wild?
Not as far as CISA knows: it is not in the Known Exploited Vulnerabilities catalog, read December 3, 2026, 18:09 UTC. FIRST's EPSS gives it a 0.72% chance of exploitation activity in the next 30 days (scores of December 3, 2026).
Which versions of tiangolo fastapi are affected by CVE-2021-32677?
fastapi before 0.65.2, per the GitHub advisory GHSA-8h2j-cgx8-6xv7. The tables above give every range the sources list.
Which version fixes CVE-2021-32677?
0.65.2, per the GitHub advisory GHSA-8h2j-cgx8-6xv7. Check the vendor's advisory before you rely on it.
How severe is CVE-2021-32677?
High (8.2, CVSS 3.1, from GitHub_M). The severity table above shows each score with its source.
Where is the official record of CVE-2021-32677?
The CVE Program's record is at cve.org and the NVD's at nvd.nist.gov. For a fix, the vendor's own advisory is the one to follow.