> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/cheat-sheets/authentication-sessions/mfa-bypass.md). Agents can also search and read this documentation through its [MCP server](https://hacking-notes.jord4n.pro/~gitbook/mcp).

# MFA Bypass Cheat Sheet: OTP, Recovery and Enrollment Testing

MFA testing examples for response tampering, OTP limits, race conditions, recovery codes, remembered devices and enrollment weaknesses.

## MFA Bypass — Cheat Sheet

{% hint style="info" %}
**What is MFA Bypass?**

MFA bypass occurs when an application grants privileges that require a second factor without a valid second-factor decision. The relevant boundary is server-side authentication state, not whether the browser displays or hides the challenge screen.
{% endhint %}

<details open>

<summary>Response &#x26; Status-Code Manipulation</summary>

{% code title="client-side trust — the #1 broken-MFA pattern" overflow="wrap" %}

```
Intercept the MFA-verify response and change {"success":false} to {"success":true}
```

{% endcode %}

{% code title="status-code-driven flows" overflow="wrap" %}

```
Change HTTP 401/403 on the verify endpoint to 200 OK (and drop the error body)
```

{% endcode %}

{% code title="fail-open on missing field" overflow="wrap" %}

```
Strip the "mfa_required":true / "otp":"pending" field from the login response
```

{% endcode %}

{% code title="use jwt-decoder to inspect the partial token's claims/scopes" overflow="wrap" %}

```
Replay the pre-MFA session/JWT against protected endpoints directly
```

{% endcode %}

{% code title="missing server-side step enforcement" overflow="wrap" %}

```
Force-browse past /verify-otp to /dashboard (or the post-login callback)
```

{% endcode %}

{% code title="type-juggling / null-comparison" overflow="wrap" %}

```
Submit the OTP endpoint with the field blank, null, [], or 000000
```

{% endcode %}

</details>

<details open>

<summary>OTP Brute-Force &#x26; Rate-Limit Gaps</summary>

{% code title="the core OTP weakness — keyspace is tiny" overflow="wrap" %}

```
Brute 000000–999999 against /verify with no lockout (1,000,000 keyspace)
```

{% endcode %}

{% code title="counter-reset bypass of rate limiting" overflow="wrap" %}

```
Resend OTP to reset the attempt counter, then keep guessing
```

{% endcode %}

{% code title="IP-keyed limits — see password-spraying for the same flaw" overflow="wrap" %}

```
Rotate IPs / spoof X-Forwarded-For: 127.0.0.1 to defeat IP-based throttling
```

{% endcode %}

{% code title="validity-window math" overflow="wrap" %}

```
Check code lifetime: a TOTP valid for 30–90s with no attempt cap = brute window
```

{% endcode %}

{% code title="tooling for the brute" overflow="wrap" %}

```
Burp Intruder: numbers payload 000000-999999, Null grep on success body
```

{% endcode %}

{% code title="TOTP skew tolerance" overflow="wrap" %}

```
Try the same code across the +/- 1 time-step window (clock skew)
```

{% endcode %}

</details>

<details open>

<summary>Race Conditions &#x26; Concurrency</summary>

{% code title="classic OTP race — see the race-condition cheat sheet" overflow="wrap" %}

```
Send 20–50 parallel /verify-otp requests with different codes in one batch
```

{% endcode %}

{% code title="precise race window via HTTP/2 multiplexing" overflow="wrap" %}

```http
HTTP/2 single-packet attack: duplicate the verify request to 20 tabs → 'Send group in parallel'
```

{% endcode %}

{% code title="race to plant a trust token" overflow="wrap" %}

```
Race the 'remember this device' toggle with the verify call
```

{% endcode %}

{% code title="Turbo Intruder script pattern" overflow="wrap" %}

```
Turbo Intruder gate: queue 30 verify requests, openGate('race') to release simultaneously
```

{% endcode %}

{% code title="TOCTOU during setup" overflow="wrap" %}

```
Race enrollment: two concurrent 'enable MFA' calls binding different secrets
```

{% endcode %}

</details>

<details open>

<summary>Backup Codes &#x26; Recovery-Factor Abuse</summary>

{% code title="the soft underbelly of MFA" overflow="wrap" %}

```
Brute-force or enumerate backup/recovery codes (often short, fixed-format)
```

{% endcode %}

{% code title="single-use enforcement test" overflow="wrap" %}

```
Check if backup codes are single-use and invalidated after consumption
```

{% endcode %}

{% code title="factor downgrade attack" overflow="wrap" %}

```
Trigger 'use another method' / 'lost your device?' to downgrade to a weaker factor
```

{% endcode %}

{% code title="recovery inherits email's weakness — see oauth-oidc" overflow="wrap" %}

```
Recovery via email OTP — chain with email account takeover or OAuth flaws
```

{% endcode %}

{% code title="client-side disclosure" overflow="wrap" %}

```
Inspect backup codes returned/cached in client storage or API responses
```

{% endcode %}

{% code title="reset-flow MFA stripping" overflow="wrap" %}

```
Reset-token reuse: does a password reset also clear or skip MFA?
```

{% endcode %}

</details>

<details open>

<summary>Remember-Device &#x26; Trust Abuse</summary>

{% code title="use jwt-decoder / inspect with session-compare" overflow="wrap" %}

```
Decode the 'remember device' / trusted-device cookie (base64/JWT)
```

{% endcode %}

{% code title="token not bound to device context" overflow="wrap" %}

```
Replay a captured remember-device cookie from another browser/IP
```

{% endcode %}

{% code title="broken revocation = durable bypass" overflow="wrap" %}

```
Test remember-device expiry and revocation (does logout/password change kill it?)
```

{% endcode %}

{% code title="client-controlled trust parameter" overflow="wrap" %}

```
Set the trust flag yourself: add remember_device=true / trust=1 to the verify request
```

{% endcode %}

{% code title="fingerprint spoofing" overflow="wrap" %}

```
Forge a device fingerprint to match a target's known trusted device
```

{% endcode %}

</details>

<details open>

<summary>Enrollment &#x26; Setup Flaws</summary>

{% code title="pre-emptive MFA binding via IDOR" overflow="wrap" %}

```
Enroll a TOTP secret on the victim's account via IDOR on the setup endpoint
```

{% endcode %}

{% code title="unverified enrollment" overflow="wrap" %}

```
Skip the 'confirm setup' step — is MFA enabled before the first code is verified?
```

{% endcode %}

{% code title="shared-secret disclosure" overflow="wrap" %}

```
Reuse the TOTP shared secret leaked in the enrollment QR/API response
```

{% endcode %}

{% code title="missing step-up on disable" overflow="wrap" %}

```
Check if a fresh session can disable MFA without re-authentication / step-up
```

{% endcode %}

{% code title="attacker-controlled delivery channel" overflow="wrap" %}

```
Bind a phone number / email you control during a partially-authenticated flow
```

{% endcode %}

</details>

<details open>

<summary>Detection, Indicators &#x26; Hardening</summary>

{% code title="the root cause of most bypasses" overflow="wrap" %}

```
Indicator: verify decision lives in the response body/status, not server state
```

{% endcode %}

{% code title="OTP brute hardening" overflow="wrap" %}

```
Indicator: wrong OTPs never lock, never expire the challenge, never throttle
```

{% endcode %}

{% code title="race hardening" overflow="wrap" %}

```
Indicator: parallel verify requests yield >1 success
```

{% endcode %}

{% code title="trust-token hardening" overflow="wrap" %}

```
Indicator: remember-device token survives logout, password change, or MFA reset
```

{% endcode %}

{% code title="design-level fix" overflow="wrap" %}

```
Prefer phishing-resistant factors: WebAuthn/FIDO2 over SMS/TOTP
```

{% endcode %}

{% code title="coverage checklist" overflow="wrap" %}

```
Test the full matrix: login, recovery, reset, enrollment, disable, and trust paths
```

{% endcode %}

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/cheat-sheets/authentication-sessions/mfa-bypass.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
