{"api_version":"1","generated_at":"2026-07-23T15:18:34+00:00","cve":"CVE-2023-40021","urls":{"html":"https://cve.report/CVE-2023-40021","api":"https://cve.report/api/cve/CVE-2023-40021.json","docs":"https://cve.report/api","cve_org":"https://www.cve.org/CVERecord?id=CVE-2023-40021","nvd":"https://nvd.nist.gov/vuln/detail/CVE-2023-40021"},"summary":{"title":"CVE-2023-40021","description":"Oppia is an online learning platform. When comparing a received CSRF token against the expected token, Oppia uses the string equality operator (`==`), which is not safe against timing attacks. By repeatedly submitting invalid tokens, an attacker can brute-force the expected CSRF token character by character. Once they have recovered the token, they can then submit a forged request on behalf of a logged-in user and execute privileged actions on that user's behalf. In particular the function to validate received CSRF tokens is at `oppia.core.controllers.base.CsrfTokenManager.is_csrf_token_valid`. An attacker who can lure a logged-in Oppia user to a malicious website can perform any change on Oppia that the user is authorized to do, including changing profile information; creating, deleting, and changing explorations; etc. Note that the attacker cannot change a user's login credentials. An attack would need to complete within 1 second because every second, the time used in computing the token changes. This issue has been addressed in commit `b89bf80837` which has been included in release `3.3.2-hotfix-2`. Users are advised to upgrade. There are no known workarounds for this vulnerability.","state":"PUBLIC","assigner":"security-advisories@github.com","published_at":"2023-08-16 21:15:00","updated_at":"2023-08-25 20:08:00"},"problem_types":["CWE-203"],"metrics":[],"references":[{"url":"https://github.com/oppia/oppia/commit/b89bf808378c1236874b5797a7bda32c77b4af23","name":"https://github.com/oppia/oppia/commit/b89bf808378c1236874b5797a7bda32c77b4af23","refsource":"MISC","tags":[],"title":"Fix GHSA-49jp-pjc3-2532: Strengthen CSRF Protections (#18769) · oppia/oppia@b89bf80 · GitHub","mime":"text/html","httpstatus":"200","archivestatus":"404"},{"url":"https://github.com/oppia/oppia/pull/18769","name":"https://github.com/oppia/oppia/pull/18769","refsource":"MISC","tags":[],"title":"Fix GHSA-49jp-pjc3-2532: Strengthen CSRF Protections by U8NWXD · Pull Request #18769 · oppia/oppia · GitHub","mime":"text/html","httpstatus":"200","archivestatus":"404"},{"url":"https://github.com/oppia/oppia/blob/3a05c3558a292f3db9e658e60e708c266c003fd0/core/controllers/base.py#L964-L990","name":"https://github.com/oppia/oppia/blob/3a05c3558a292f3db9e658e60e708c266c003fd0/core/controllers/base.py#L964-L990","refsource":"MISC","tags":[],"title":"","mime":"text/plain","httpstatus":"200","archivestatus":"404"},{"url":"https://github.com/oppia/oppia/security/advisories/GHSA-49jp-pjc3-2532","name":"https://github.com/oppia/oppia/security/advisories/GHSA-49jp-pjc3-2532","refsource":"MISC","tags":[],"title":"CVE-2023-40021: Timing Attack Reveals CSRF Tokens · Advisory · oppia/oppia · GitHub","mime":"text/html","httpstatus":"200","archivestatus":"404"},{"url":"https://www.cve.org/CVERecord?id=CVE-2023-40021","name":"CVE Program record","refsource":"CVE.ORG","tags":["canonical"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2023-40021","name":"NVD vulnerability detail","refsource":"NVD","tags":["canonical","analysis"]}],"affected":[],"timeline":[],"solutions":[],"workarounds":[],"exploits":[],"credits":[],"nvd_cpes":[{"cve_year":"2023","cve_id":"40021","vulnerable":"1","versionEndIncluding":"","cpe1":"cpe","cpe2":"2.3","cpe3":"a","cpe4":"oppia","cpe5":"oppia","cpe6":"*","cpe7":"*","cpe8":"*","cpe9":"*","cpe10":"*","cpe11":"*","cpe12":"*","cpe13":"*"},{"cve_year":"2023","cve_id":"40021","vulnerable":"1","versionEndIncluding":"","cpe1":"cpe","cpe2":"2.3","cpe3":"a","cpe4":"oppia","cpe5":"oppia","cpe6":"3.3.2","cpe7":"-","cpe8":"*","cpe9":"*","cpe10":"*","cpe11":"*","cpe12":"*","cpe13":"*"}],"vendor_comments":[],"enrichments":{"kev":null,"epss":null,"legacy_qids":[]},"source_records":{"cve_program":{"data_version":"4.0","data_type":"CVE","data_format":"MITRE","CVE_data_meta":{"ID":"CVE-2023-40021","ASSIGNER":"security-advisories@github.com","STATE":"PUBLIC"},"description":{"description_data":[{"lang":"eng","value":"Oppia is an online learning platform. When comparing a received CSRF token against the expected token, Oppia uses the string equality operator (`==`), which is not safe against timing attacks. By repeatedly submitting invalid tokens, an attacker can brute-force the expected CSRF token character by character. Once they have recovered the token, they can then submit a forged request on behalf of a logged-in user and execute privileged actions on that user's behalf. In particular the function to validate received CSRF tokens is at `oppia.core.controllers.base.CsrfTokenManager.is_csrf_token_valid`. An attacker who can lure a logged-in Oppia user to a malicious website can perform any change on Oppia that the user is authorized to do, including changing profile information; creating, deleting, and changing explorations; etc. Note that the attacker cannot change a user's login credentials. An attack would need to complete within 1 second because every second, the time used in computing the token changes. This issue has been addressed in commit `b89bf80837` which has been included in release `3.3.2-hotfix-2`. Users are advised to upgrade. There are no known workarounds for this vulnerability."}]},"problemtype":{"problemtype_data":[{"description":[{"lang":"eng","value":"CWE-203: Observable Discrepancy","cweId":"CWE-203"}]},{"description":[{"lang":"eng","value":"CWE-208: Observable Timing Discrepancy","cweId":"CWE-208"}]}]},"affects":{"vendor":{"vendor_data":[{"vendor_name":"oppia","product":{"product_data":[{"product_name":"oppia","version":{"version_data":[{"version_affected":"=","version_value":">= 1.1.0, < 3.3.2-hotfix-2"}]}}]}}]}},"references":{"reference_data":[{"url":"https://github.com/oppia/oppia/security/advisories/GHSA-49jp-pjc3-2532","refsource":"MISC","name":"https://github.com/oppia/oppia/security/advisories/GHSA-49jp-pjc3-2532"},{"url":"https://github.com/oppia/oppia/pull/18769","refsource":"MISC","name":"https://github.com/oppia/oppia/pull/18769"},{"url":"https://github.com/oppia/oppia/commit/b89bf808378c1236874b5797a7bda32c77b4af23","refsource":"MISC","name":"https://github.com/oppia/oppia/commit/b89bf808378c1236874b5797a7bda32c77b4af23"},{"url":"https://github.com/oppia/oppia/blob/3a05c3558a292f3db9e658e60e708c266c003fd0/core/controllers/base.py#L964-L990","refsource":"MISC","name":"https://github.com/oppia/oppia/blob/3a05c3558a292f3db9e658e60e708c266c003fd0/core/controllers/base.py#L964-L990"}]},"source":{"advisory":"GHSA-49jp-pjc3-2532","discovery":"UNKNOWN"},"impact":{"cvss":[{"attackComplexity":"HIGH","attackVector":"NETWORK","availabilityImpact":"NONE","baseScore":5.3,"baseSeverity":"MEDIUM","confidentialityImpact":"NONE","integrityImpact":"HIGH","privilegesRequired":"NONE","scope":"UNCHANGED","userInteraction":"REQUIRED","vectorString":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N","version":"3.1"}]}},"nvd":{"publishedDate":"2023-08-16 21:15:00","lastModifiedDate":"2023-08-25 20:08:00","problem_types":["CWE-203"],"metrics":{"baseMetricV3":{"cvssV3":{"version":"3.1","vectorString":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N","attackVector":"NETWORK","attackComplexity":"HIGH","privilegesRequired":"NONE","userInteraction":"REQUIRED","scope":"UNCHANGED","confidentialityImpact":"NONE","integrityImpact":"HIGH","availabilityImpact":"NONE","baseScore":5.3,"baseSeverity":"MEDIUM"},"exploitabilityScore":1.6,"impactScore":3.6}},"configurations":{"CVE_data_version":"4.0","nodes":[{"operator":"OR","children":[],"cpe_match":[{"vulnerable":true,"cpe23Uri":"cpe:2.3:a:oppia:oppia:3.3.2:-:*:*:*:*:*:*","cpe_name":[]},{"vulnerable":true,"cpe23Uri":"cpe:2.3:a:oppia:oppia:*:*:*:*:*:*:*:*","versionStartIncluding":"1.1.0","versionEndExcluding":"3.3.2","cpe_name":[]}]}]}},"legacy_mitre":{"record":null,"notes":[]}}}