CVE-2023-40021
Timing Attack Reveals CSRF Tokens in oppia
Mitigation
- Upgrade oppia to 3.3.2-hotfix-2 or later.
Who should check
- Anyone running oppia >= 1.1.0, < 3.3.2-hotfix-2
Vulnerability facts
- Affected
- oppia >= 1.1.0, < 3.3.2-hotfix-2
- Fixed in
- oppia 3.3.2-hotfix-2
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Remote, no login needed
- CVSS
- 5.3 (v3.1, CNA)CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:N/I:H/A:NOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Network
- Attack complexity: High
- Privileges required: None
- User interaction: Required
- Scope: Unchanged
- Confidentiality impact: None
- Integrity impact: High
- Availability impact: None
- EPSS
- 0.77% chance of exploitation in 30 days (percentile 52, 2026-11-26)
- CWE
- CWE-203, CWE-208
- Modified
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.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| oppia | >= 1.1.0, < 3.3.2-hotfix-2 | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2023-40021. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2023-40021.md Affected: oppia >= 1.1.0, < 3.3.2-hotfix-2 Fixed in: oppia 3.3.2-hotfix-2 Steps: 1. Search this machine and project for oppia: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Patches
FAQ
Is CVE-2023-40021 being exploited?
There is no confirmed exploitation: CVE-2023-40021 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.77% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2023-40021?
Medium: CVSS 5.3 (v3.1, scored by CNA). Remote, no login needed. A user has to take an action, such as opening a link, for the attack to work. The attack needs conditions outside the attacker's control, which makes it harder.
Which versions are affected by CVE-2023-40021?
oppia >= 1.1.0, < 3.3.2-hotfix-2.
Is there a fix for CVE-2023-40021?
Yes. Fixed in oppia 3.3.2-hotfix-2. Upgrade oppia to 3.3.2-hotfix-2 or later.
How do I check if I'm affected by CVE-2023-40021?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.