{"schemaVersion":3,"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":null,"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.53196,"severity":"low","asOf":"2026-10-20T00:00:00.000Z","change":{"pp":-0.05700000000000002,"baselineDate":"2026-09-20T00:00:00.000Z","baselineScore":0.00779},"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":0.53196}],"last30":[{"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":0.53196}]},"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 (CSRF)","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}],"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}],"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}],"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},{"text":"< 0.65.2","noFixRecorded":false,"fixedIn":null}],"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}],"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}],"risk":{"score":33,"level":"medium","profile":"Default","thresholds":{"critical":75,"high":50,"medium":25,"low":10}},"meta":{"dataAsOf":"2026-10-20T17:24:05.658Z","stale":false,"partial":false}}