CVE-2021-45331 Reuse of one time passwords allowed in Gitea
Attackers can bypass two-factor authentication by reusing captured TOTP codes, allowing unauthorized access to user accounts.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2021-45331?
CVE-2021-45331 is a critical authentication bypass vulnerability in Gitea Gitea, published on 9 Feb 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
An Authentication Bypass vulnerability exists in Gitea before 1.5.0, which could let a malicious user gain privileges. If captured, the TOTP code for the 2FA can be submitted correctly more than once.
Weakness: CWE-287
Which versions are affected by CVE-2021-45331?
4 open source packages ship an affected version, including code.gitea.io/gitea and gitea. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
code.gitea.io/gitea Go | All versions | 1.5.0 |
code.gitea.io/gitea Go | All versions | 1.5.0 |
code.gitea.io/gitea Go | All versions | 1.5.0 |
gitea Bitnami | All versions | 1.5.0 |
Products include Gitea Gitea.
How do I fix CVE-2021-45331?
Upgrade code.gitea.io/gitea to 1.5.0 or later.
Upgrade, and rotate credentials and sessions that may have been exposed. More about Authentication bypass.
Is CVE-2021-45331 being exploited?
There is no known exploitation of CVE-2021-45331 in the wild and no public exploit code.
Other vulnerabilities in Gitea Gitea
Sources
Also known as BIT-gitea-2021-45331, CLEANSTART-2025-HO72707, GHSA-hfmf-q69j-6m5p, GO-2022-0315.