{"id":"CVE-2023-40021","state":"PUBLISHED","title":"Timing Attack Reveals CSRF Tokens in oppia","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.","publishedAt":"2023-08-16T20:25:22.726Z","updatedAt":"2024-10-03T13:37:09.373Z","severity":{"score":5.3,"label":"Medium","version":"3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:N","source":"GitHub_M"},"assigner":"GitHub_M","products":["oppia oppia"],"affected":[{"vendor":"oppia","product":"oppia","versions":[{"version":">= 1.1.0, < 3.3.2-hotfix-2","status":"affected"}]}],"references":["https://github.com/oppia/oppia/security/advisories/GHSA-49jp-pjc3-2532","https://github.com/oppia/oppia/pull/18769","https://github.com/oppia/oppia/commit/b89bf808378c1236874b5797a7bda32c77b4af23","https://github.com/oppia/oppia/blob/3a05c3558a292f3db9e658e60e708c266c003fd0/core/controllers/base.py#L964-L990"],"weaknesses":["CWE-203","CWE-208"],"ingestedAt":"2026-10-29T20:06:17.512Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2023/40xxx/CVE-2023-40021.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.1","cveMetadata":{"cveId":"CVE-2023-40021","state":"PUBLISHED","datePublished":"2023-08-16T20:25:22.726Z","dateUpdated":"2024-10-03T13:37:09.373Z","assignerShortName":"GitHub_M","assignerOrgId":"a0819718-46f1-4df5-94e2-005712e83aaa","dateReserved":"2023-08-08T13:46:25.243Z"},"containers":{"cna":{"title":"Timing Attack Reveals CSRF Tokens in oppia","descriptions":[{"lang":"en","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."}],"affected":[{"vendor":"oppia","product":"oppia","versions":[{"version":">= 1.1.0, < 3.3.2-hotfix-2","status":"affected"}]}],"references":[{"url":"https://github.com/oppia/oppia/security/advisories/GHSA-49jp-pjc3-2532","name":"https://github.com/oppia/oppia/security/advisories/GHSA-49jp-pjc3-2532","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/oppia/oppia/pull/18769","name":"https://github.com/oppia/oppia/pull/18769","tags":["x_refsource_MISC"]},{"url":"https://github.com/oppia/oppia/commit/b89bf808378c1236874b5797a7bda32c77b4af23","name":"https://github.com/oppia/oppia/commit/b89bf808378c1236874b5797a7bda32c77b4af23","tags":["x_refsource_MISC"]},{"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","tags":["x_refsource_MISC"]}],"metrics":[{"cvssV3_1":{"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"}}],"problemTypes":[{"descriptions":[{"cweId":"CWE-203","lang":"en","description":"CWE-203: Observable Discrepancy","type":"CWE"}]},{"descriptions":[{"cweId":"CWE-208","lang":"en","description":"CWE-208: Observable Timing Discrepancy","type":"CWE"}]}],"providerMetadata":{"shortName":"GitHub_M","orgId":"a0819718-46f1-4df5-94e2-005712e83aaa","dateUpdated":"2023-08-16T20:25:22.726Z"},"source":{"advisory":"GHSA-49jp-pjc3-2532","discovery":"UNKNOWN"}},"adp":[{"title":"CVE Program Container","references":[{"url":"https://github.com/oppia/oppia/security/advisories/GHSA-49jp-pjc3-2532","name":"https://github.com/oppia/oppia/security/advisories/GHSA-49jp-pjc3-2532","tags":["x_refsource_CONFIRM","x_transferred"]},{"url":"https://github.com/oppia/oppia/pull/18769","name":"https://github.com/oppia/oppia/pull/18769","tags":["x_refsource_MISC","x_transferred"]},{"url":"https://github.com/oppia/oppia/commit/b89bf808378c1236874b5797a7bda32c77b4af23","name":"https://github.com/oppia/oppia/commit/b89bf808378c1236874b5797a7bda32c77b4af23","tags":["x_refsource_MISC","x_transferred"]},{"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","tags":["x_refsource_MISC","x_transferred"]}],"providerMetadata":{"shortName":"CVE","orgId":"af854a3a-2127-422b-91ae-364da2661108","dateUpdated":"2024-08-02T18:24:54.658Z"}},{"title":"CISA ADP Vulnrichment","affected":[{"vendor":"oppia","product":"oppia","defaultStatus":"unknown","versions":[{"version":"1.1.0","status":"affected","lessThan":"3.3.2","versionType":"custom"}],"cpes":["cpe:2.3:a:oppia:oppia:*:*:*:*:*:*:*:*"]}],"metrics":[{"other":{"type":"ssvc","content":{"timestamp":"2024-10-03T13:33:01.578679Z","id":"CVE-2023-40021","options":[{"Exploitation":"poc"},{"Automatable":"no"},{"Technical Impact":"partial"}],"role":"CISA Coordinator","version":"2.0.3"}}}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2024-10-03T13:37:09.373Z"}}]}}}