Cve 2026 123002 How I Found A 2fa Bypass In Gitea And Wrote The Patch
Gitea's two-factor authentication endpoints did not rate-limit or lock out failed passcode attempts, so an attacker who already knew a password could brute-force the six-digit TOTP code in about 11 minutes. This allowed full account compromise, including reading private repositories and disabling 2FA.
Published on infosecwriteups.com
Missing rate limiting let anyone with a stolen password brute-force the six-digit TOTP code in about 11 minutes. Here is the bug, the maths, and the patch I contributed.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The 2FA verification endpoints lacked any rate limiting, account lockout, or failure counting, so an attacker could replay the same authenticated session with unlimited passcode guesses.
Impact
An attacker with a stolen password could brute-force the 2FA code and gain full account access, including reading private repositories and disabling 2FA; the attack was not limited by CAPTCHA, fail2ban, or TOTP replay protection.
What the attacker needed
Attacker knows the victim's password; victim has 2FA enabled; network access to the Gitea instance
The fix
The vulnerability was fixed in Gitea 28.4.0 by adding a per-account failure counter that blocks further attempts for 15 minutes after five failed passcodes.
How it was found
- Obtain the victim's password through phishing, credential stuffing, or social engineering.
- Log in with the password to reach the 2FA prompt.
- Send many POST requests to the 2FA endpoint, each with a different six-digit guess.
- One guess matches and Gitea issues a fully authenticated session.
- Use the session to access private repositories, modify code, and disable 2FA.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Two-factor authentication (2FA) adds a second step after your password, usually a six-digit code from an app. This report found that Gitea let someone try unlimited wrong codes without slowing down or locking the account, so a criminal with your password could guess the code in minutes. The fix adds a counter that blocks further tries after five failures.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.