{"schemaVersion":4,"id":"CVE-2021-32677","aliases":["GHSA-8h2j-cgx8-6xv7","PYSEC-2021-100","UBUNTU-CVE-2021-32677","DEBIAN-CVE-2021-32677"],"status":"published","duplicateOf":null,"title":"Cross-Site Request Forgery (CSRF) in FastAPI","description":"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.","dates":{"published":"2021-06-09T17:30:12.000Z","modified":"2024-08-03T23:25:31.094Z","reserved":null,"kevAdded":[],"kevDue":[]},"cvss":{"headline":{"score":8.2,"severity":"high","version":"3.1","versionLabel":"v3.1","source":"CVE.org","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N","computed":false,"selection":"backend-summary"},"metrics":[{"version":"3.1","versionLabel":"v3.1","source":"CVE.org","score":8.2,"severity":"high","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N","exploitability":null,"impact":null,"computed":false},{"version":"4.0","versionLabel":"v4.0","source":"OSV · Pypi","score":8.8,"severity":"high","vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:H/VA:N/SC:N/SI:N/SA:N","exploitability":null,"impact":null,"computed":true},{"version":"3.1","versionLabel":"v3.1","source":"OSV · Pypi","score":8.2,"severity":"high","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N","exploitability":10,"impact":7,"computed":true},{"version":"3.1","versionLabel":"v3.1","source":"OSV · Ubuntu","score":8.1,"severity":"high","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N","exploitability":7.2,"impact":8.7,"computed":true},{"version":"3.1","versionLabel":"v3.1","source":"OSV · Debian","score":8.1,"severity":"high","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N","exploitability":7.2,"impact":8.7,"computed":true},{"version":"3.1","versionLabel":"v3.1","source":"NVD","score":8.1,"severity":"high","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N","exploitability":null,"impact":null,"computed":false},{"version":"2.0","versionLabel":"v2.0","source":"NVD","score":5.8,"severity":"medium","vector":"AV:N/AC:M/Au:N/C:P/I:P/A:N","exploitability":null,"impact":null,"computed":false}]},"epss":{"probability":0.00722,"percentile":0.55356,"severity":"low","asOf":"2026-12-04T00:00:00.000Z","change":{"pp":0,"baselineDate":"2026-11-04T00:00:00.000Z","baselineScore":0.00722},"history":[{"date":"2026-09-14T00:00:00.000Z","score":0.00779,"percentile":null},{"date":"2026-09-15T00:00:00.000Z","score":0.00779,"percentile":null},{"date":"2026-09-16T00:00:00.000Z","score":0.00779,"percentile":null},{"date":"2026-09-17T00:00:00.000Z","score":0.00779,"percentile":null},{"date":"2026-09-18T00:00:00.000Z","score":0.00779,"percentile":null},{"date":"2026-09-19T00:00:00.000Z","score":0.00779,"percentile":null},{"date":"2026-09-20T00:00:00.000Z","score":0.00779,"percentile":null},{"date":"2026-09-21T00:00:00.000Z","score":0.00779,"percentile":null},{"date":"2026-09-22T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-09-23T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-09-24T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-09-25T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-09-26T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-09-27T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-09-28T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-09-29T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-09-30T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-01T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-02T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-03T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-04T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-05T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-06T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-07T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-08T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-09T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-10T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-11T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-12T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-13T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-14T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-15T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-16T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-17T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-18T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-19T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-20T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-21T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-22T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-23T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-24T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-25T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-26T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-27T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-28T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-29T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-30T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-10-31T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-01T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-02T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-03T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-04T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-05T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-06T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-07T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-08T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-09T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-10T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-11T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-12T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-13T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-14T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-15T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-16T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-17T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-18T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-19T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-20T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-21T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-22T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-23T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-24T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-25T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-26T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-27T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-28T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-29T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-30T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-12-01T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-12-02T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-12-03T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-12-04T00:00:00.000Z","score":0.00722,"percentile":0.55356}],"last30":[{"date":"2026-11-04T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-05T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-06T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-07T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-08T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-09T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-10T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-11T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-12T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-13T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-14T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-15T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-16T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-17T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-18T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-19T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-20T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-21T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-22T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-23T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-24T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-25T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-26T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-27T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-28T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-29T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-11-30T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-12-01T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-12-02T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-12-03T00:00:00.000Z","score":0.00722,"percentile":null},{"date":"2026-12-04T00:00:00.000Z","score":0.00722,"percentile":0.55356}]},"kev":{"state":"not-listed","entries":[],"listedCount":0,"totalCatalogs":3,"catalogs":[{"source":"cisa","label":"CISA","listed":false,"entry":null},{"source":"enisa","label":"ENISA","listed":false,"entry":null},{"source":"circl","label":"CIRCL","listed":false,"entry":null}]},"ransomware":{"state":"none-recorded","sources":[]},"exploits":[],"exploitCount":0,"weaknesses":[{"id":"CWE-352","name":"Cross-Site Request Forgery","description":"The web application does not, or cannot, sufficiently verify whether a request was intentionally provided by the user who sent the request, which could have originated from an unauthorized actor.","type":"weakness","status":"Stable","abstraction":"Compound","likelihoodOfExploit":"Medium","url":"https://cwe.mitre.org/data/definitions/352.html"}],"affected":[{"vendor":"debian","product":"fastapi","name":"fastapi","label":"fastapi","ecosystem":"Debian","cpePart":null,"purl":"pkg:deb/debian/fastapi","purlType":"deb","versions":[{"text":"< 0.70.0-1","noFixRecorded":false,"fixedIn":null,"bounds":{"kind":"range","start":null,"startInclusive":true,"end":"0.70.0-1","endInclusive":false}}],"versionsText":"< 0.70.0-1","eol":null,"hubHref":null},{"vendor":"ubuntu","product":"fastapi","name":"fastapi","label":"fastapi","ecosystem":"Ubuntu","cpePart":null,"purl":"pkg:deb/ubuntu/fastapi","purlType":"deb","versions":[{"text":"All versions","noFixRecorded":true,"fixedIn":null,"bounds":{"kind":"all"}}],"versionsText":"All versions (No fix recorded)","eol":null,"hubHref":null},{"vendor":"fedoraproject","product":"fedora","name":"fedora","label":"fedora","ecosystem":null,"cpePart":"o","purl":null,"purlType":null,"versions":[{"text":"34","noFixRecorded":false,"fixedIn":null,"bounds":{"kind":"exact","version":"34"}}],"versionsText":"34","eol":{"isEol":true,"eolDate":"2022-06-07T00:00:00.000Z","matchMethod":"cpe","cycle":{"name":"34","label":"34","eolFrom":"2022-06-07T00:00:00.000Z","isLts":false,"isMaintained":false,"latestVersion":null},"product":{"name":"fedora","label":"Fedora Linux","category":"os"}},"hubHref":"/vendor/fedoraproject/fedora"},{"vendor":"PyPI","product":"fastapi","name":"fastapi","label":"fastapi","ecosystem":"PyPI","cpePart":null,"purl":"pkg:pypi/fastapi","purlType":"pypi","versions":[{"text":"< fa7e3c996edf2d5482fff8f9d890ac2390dede4d","noFixRecorded":false,"fixedIn":null,"bounds":{"kind":"range","start":null,"startInclusive":true,"end":"fa7e3c996edf2d5482fff8f9d890ac2390dede4d","endInclusive":false}},{"text":"< 0.65.2","noFixRecorded":false,"fixedIn":null,"bounds":{"kind":"range","start":null,"startInclusive":true,"end":"0.65.2","endInclusive":false}}],"versionsText":"< fa7e3c996edf2d5482fff8f9d890ac2390dede4d | < 0.65.2","eol":null,"hubHref":null},{"vendor":"tiangolo","product":"fastapi","name":"fastapi","label":"fastapi","ecosystem":null,"cpePart":"a","purl":null,"purlType":null,"versions":[{"text":"< 0.65.2","noFixRecorded":false,"fixedIn":null,"bounds":{"kind":"range","start":null,"startInclusive":true,"end":"0.65.2","endInclusive":false}}],"versionsText":"< 0.65.2","eol":null,"hubHref":"/vendor/tiangolo/fastapi"}],"affectedCount":5,"eol":{"hasEol":true,"count":1},"references":[{"url":"https://github.com/tiangolo/fastapi/security/advisories/GHSA-8h2j-cgx8-6xv7","label":"github.com/tiangolo/fastapi/security/advisories/GHSA-8h2j-cgx8-6xv7","hostname":"github.com","tags":["X Refsource CONFIRM","WEB","Advisory","REPORT","Third Party Advisory"]},{"url":"https://github.com/tiangolo/fastapi/commit/fa7e3c996edf2d5482fff8f9d890ac2390dede4d","label":"github.com/tiangolo/fastapi/commit/fa7e3c996edf2d5482fff8f9d890ac2390dede4d","hostname":"github.com","tags":["X Refsource MISC","WEB","FIX","REPORT","Patch","Third Party Advisory"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/MATAWX25TYKNEKLDMKWNLYDB34UWTROA/","label":"lists.fedoraproject.org/archives/…","hostname":"lists.fedoraproject.org","tags":["Vendor Advisory","X Refsource FEDORA"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2021-32677","label":"nvd.nist.gov/vuln/detail/CVE-2021-32677","hostname":"nvd.nist.gov","tags":["Advisory"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/fastapi/PYSEC-2021-100.yaml","label":"github.com/pypa/advisory-database/tree/main/vulns/fastapi/PYSEC-2021-100.yaml","hostname":"github.com","tags":["WEB"]},{"url":"https://github.com/tiangolo/fastapi","label":"github.com/tiangolo/fastapi","hostname":"github.com","tags":["PACKAGE"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MATAWX25TYKNEKLDMKWNLYDB34UWTROA","label":"lists.fedoraproject.org/archives/…","hostname":"lists.fedoraproject.org","tags":["WEB"]},{"url":"https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/MATAWX25TYKNEKLDMKWNLYDB34UWTROA/","label":"lists.fedoraproject.org/archives/…","hostname":"lists.fedoraproject.org","tags":["WEB"]},{"url":"https://ubuntu.com/security/CVE-2021-32677","label":"ubuntu.com/security/CVE-2021-32677","hostname":"ubuntu.com","tags":["REPORT"]},{"url":"https://www.cve.org/CVERecord?id=CVE-2021-32677","label":"www.cve.org/CVERecord?id=CVE-2021-32677","hostname":"www.cve.org","tags":["REPORT"]},{"url":"https://security-tracker.debian.org/tracker/CVE-2021-32677","label":"security-tracker.debian.org/tracker/CVE-2021-32677","hostname":"security-tracker.debian.org","tags":["Advisory"]}],"lineage":{"upstream":[],"downstream":[],"duplicates":[],"related":[]},"timeline":[{"kind":"published","date":"2021-06-09T17:30:12.000Z","label":"Published","detail":"Vulnerability first disclosed.","source":null},{"kind":"modified","date":"2024-08-03T23:25:31.094Z","label":"Last modified","detail":"Vulnerability information updated.","source":null}],"priority":{"label":"prioritise","tag":"severe","reason":"Severe, CVSS 8.2 (CVE.org); no exploitation reported by the 5 checked sources; EPSS 1% (FIRST, 04-12-2026)","nextStep":"Check applicability and the vendor advisory: no fix release is recorded here","rank":[0,0,0,0,1,82],"checkedSources":["cisa","enisa","circl","shadowserver","cisa-adp"],"evidence":[{"type":"epss","source":"FIRST","date":"2026-12-04T00:00:00.000Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"value":0.00722,"stale":false,"promoted":null},{"type":"cvss","source":"cve.org","date":"2024-08-03T23:25:31.094Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"score":8.2,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N","version":"3.1","headline":true},{"type":"cvss","source":"osv_pypi","date":"2024-08-03T23:25:31.094Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"score":8.8,"vector":"CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:H/VA:N/SC:N/SI:N/SA:N","version":"4.0"},{"type":"cvss","source":"osv_pypi","date":"2024-08-03T23:25:31.094Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"score":8.2,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:N","version":"3.1"},{"type":"cvss","source":"osv_ubuntu","date":"2024-08-03T23:25:31.094Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"score":8.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N","version":"3.1"},{"type":"cvss","source":"osv_debian","date":"2024-08-03T23:25:31.094Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"score":8.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N","version":"3.1"},{"type":"cvss","source":"nvd","date":"2024-08-03T23:25:31.094Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"score":8.1,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N","version":"3.1"},{"type":"cvss","source":"nvd","date":"2024-08-03T23:25:31.094Z","status":"valid","statusDate":null,"statusSource":null,"disputes":[],"score":5.8,"vector":"AV:N/AC:M/Au:N/C:P/I:P/A:N","version":"2.0"}],"epss":{"value":0.00722,"date":"2026-12-04T00:00:00.000Z","stale":false,"promoted":null},"sources":[{"id":"cisa","lastSuccessfulSync":"2026-12-05T06:02:28.822Z","state":"fresh"},{"id":"enisa","lastSuccessfulSync":"2026-12-05T06:02:29.295Z","state":"fresh"},{"id":"circl","lastSuccessfulSync":"2026-12-05T06:02:29.506Z","state":"fresh"},{"id":"shadowserver","lastSuccessfulSync":null,"state":"unavailable"},{"id":"cisa-adp","lastSuccessfulSync":"2026-12-05T06:00:56.363Z","state":"fresh"},{"id":"epss","lastSuccessfulSync":"2026-12-05T06:02:27.202Z","state":"fresh"},{"id":"osv","lastSuccessfulSync":"2026-12-05T06:02:26.240Z","state":"fresh"}],"feedEvent":null},"meta":{"dataAsOf":"2026-12-05T06:35:59.233Z","stale":false,"partial":false}}