Skip to content
Account takeover Write-up Intermediate

2FA Made My Night: How I Bypassed Two-Factor Authentication and Learned a Valuable Lesson

The 2FA recovery code verification endpoint lacked rate limiting, allowing an attacker to brute force a 20-digit alphanumeric code. After many attempts, a valid code was accepted, which effectively disabled 2FA on the victim's account, enabling account takeover.

Lokesh Soni Follow

Published on medium.com

.Disclaimer: This research was conducted on legitimate bug bounty programs with proper authorization. All findings were reported responsibly and in accordance with ethical hacking guidelines.

Lokesh Soni, on medium.com

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

Likely the absence of rate limiting on the recovery code verification endpoint, allowing unlimited brute force attempts.

Impact

Complete bypass of 2FA protection, leading to account takeover.

What the attacker needed

A free account; victim has 2FA enabled; attacker can make many requests

The fix

Implement proper rate limiting on sensitive authentication endpoints.

How it was found

  1. Create a victim account and obtain the 2FA recovery code.
  2. Log out and attempt to log back in.
  3. At the 2FA page, select the recovery code option.
  4. Brute force the recovery code using a generated list of possible codes.

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 to logging in, like a code from your phone. The recovery code is a backup way to get in if you lose your phone. Here, the system let someone try unlimited recovery codes until one worked, and using that code turned off 2FA, so the attacker could get into the account.

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.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.