Sitemap
alsh3ath

alsh3ath

.... . .-.. .-.. --- / .-- --- .-. .-.. -..

Attacking Two-Factor Authentication

3 min readMay 17, 2026

--

Two-factor authentication is considered one of the strongest security measures available, and everyone wants to use it to stay 100% secure. But nobody really thinks about what comes after 2FA, that it can still be bypassed.

Most Common 2FA Attacks

1. Phishing

Trick a user into entering their login credentials on a fake website. Simple, but still very effective.

2. MFA Fatigue Attack

Let me explain this with an example:

  1. Moha uses Google Authenticator for MFA.
  2. Ali knows him username and password and tries to log in.
  3. He keeps sending login attempts, and Moha gets flooded with constant approval requests.
  4. At some point, he gets tired of it and approves one,and Ali gets in.

3. SIM Swap Attack (Phone Number Hijacking)

Again, with an example:

  1. Rami has a phone with STS(company that provides SIM cards). His number is 3XXXXXXX.
  2. An attacker socially engineers STS into issuing a new SIM card tied to Rami’s number.
  3. Now the attacker’s phone receives all of Rami’s SMS messages, including OTPs.
  4. The attacker uses those OTPs to reset Rami’s bank or email account and takes full control.
Press enter or click to view image in full size
showing how each 2FA method performs against the most common attack types.

Attacking TOTP (Time-Based One-Time Password)

First, let’s clarify the difference:

  • OTP — A password valid for only one login session or transaction. Example: SMS codes.
  • TOTP — A specific type of OTP that changes based on time.
    Example: Google Authenticator.

The Attack — Brute Forcing a Weak TOTP

If you spot a TOTP field that only uses 4 digits (you can confirm this in Burp Suite), the entire keyspace is just 10,000 combinations, which you can use on it brute-force attack. Below steps running on linux terminal.

Get alsh3ath’s stories in your inbox

Join Medium for free to get updates from this writer.

Step 1 — Generate the wordlist:

seq -w 0 9999 > num.txt

Step 2 — Fuzz it with ffuf:

ffuf -w ./num.txt \
-u http://hala/security.php \
-X POST \
-H "Content-Type: application/x-www********" \
-b "PHPSESSID=*************" \
-d "totp=FUZZ" \
-fr "Invalid Code"

What each flag does:

  • -w — wordlist
  • -u — target URL
  • -X — HTTP method
  • -H — request header (content type)
  • -b — session cookie from Burp
  • -d — the parameter you want to fuzz
  • -fr — filter out responses containing the error message

When the fuzzer hits the correct TOTP, the server creates a valid session so every request after it will also return success since the session is already authenticated.

This is a simplified lab example, not a real-world scenario.

Going Deeper — Real World 2FA Attacks

In a real scenario, you already have the target’s username/password and you’re sitting at the OTP prompt. The biggest obstacle at this stage is rate limiting.

Most implementations will block you after 3–5 failed attempts, stop accepting requests from your IP, or send the user a new OTP .

CVE-2020–35590 — Rate Limit Bypass via HTTP Header

A researcher found that a specific HTTP header was being trusted by the server and could be used to bypass rate limiting entirely. This is a real CVE, and it proves that missing rate limits aren’t just a theoretical issue.

You can read the full details here: CVE-2020–35590

CVE-2026–0723 — GitLab 2FA Bypass (January 2026)

This is a recent one. Affected versions: GitLab 18.6.4, 18.7.2, and 18.8.2.

Bug in GitLab that lets an attacker skip the 2FA step completely. Normally after entering the correct username and password, GitLab asks for your OTP. But due to a logic flaw, the attacker can manipulate the request. for example by removing or modifying a parameter, and GitLab just lets them in without ever checking the OTP. So having the password is enough, 2FA becomes useless.

It’s directly relevant to what we’ve been discussing, so it’s worth reading through: CVE-2026–0723

Every method covered here has a real attack behind it. The strongest protection right now is hardware-based authentication like FIDO2 — everything else has a workaround if the attacker is patient enough.

--

--