13.1 Understanding AiTM Attacks

2–3 hours · Module 13

What Makes AiTM Different

Adversary-in-the-middle (AiTM) phishing is not traditional credential phishing. In a traditional attack, the attacker creates a fake login page, captures the username and password, and MFA stops them — they have credentials but cannot complete the second factor. AiTM defeats MFA entirely.

The attacker deploys a reverse proxy between the victim and the real Microsoft login page. The victim sees the genuine Microsoft interface. They enter their credentials. They complete MFA. Every step passes through the attacker’s proxy, which captures the complete session token — including the MFA claim. When the attacker replays that token, Azure AD sees a valid, MFA-authenticated session. No new MFA challenge is issued.

AiTM REVERSE PROXY — FULL TOKEN CAPTURE FLOWVictimopens linkAiTM Proxyphishing-domain.commirrors real login pageMicrosoftreal login1. credentials2. relays to real server3. MFA challenge4. MFA prompt shown5. User completes MFA6. MFA response7. session token returned8. Proxy captures tokenToken contains MFA claimuser sees success page

Figure 13.1: The complete AiTM flow. The victim completes a normal login through the proxy. The proxy captures the session token at step 8.

Session tokens vs refresh tokens

Understanding what the attacker captures is critical for containment:

Session token (access token): Short-lived (typically 60-90 minutes). Grants access to a specific resource (Exchange Online, SharePoint). Expires quickly — the attacker has a narrow window.

Refresh token: Longer-lived (up to 90 days). Used to request new access tokens without re-authentication. If the attacker captures the refresh token, they can maintain access for days or weeks — generating new access tokens silently.

The refresh token is the prize

Modern AiTM kits capture the refresh token, not just the session token. This means revoking the session token alone is not sufficient — you must revoke all refresh tokens. In Entra ID, "Revoke sessions" invalidates both. But if you only sign the user out of active sessions without revoking refresh tokens, the attacker can silently re-authenticate.

AiTM phishing kits in the wild

KitModelKey characteristicsPrevalence
EvilGinx2Open-sourceHighly customisable, community “phishlets” for M365/Google/Okta, self-hostedHigh — foundation for many custom deployments
Tycoon 2FAPhishing-as-a-ServiceCloudflare turnstile CAPTCHA (blocks scanners), rotating domains, Telegram exfilVery high — dominant kit in 2025-2026
GreatnessServiceM365-focused, built-in MFA relay, Telegram bot for stolen sessionsModerate
Mamba 2FAServiceSocket.io relay (newer technique), handles multiple MFA methodsGrowing
NakedPagesOpen-sourceGo-based, lightweight, Docker deploymentModerate

The commercial kits (Tycoon, Greatness) lower the barrier to entry significantly. An attacker does not need to understand reverse proxying — they subscribe to the service, configure the target domain, and receive stolen tokens via Telegram.

Tycoon 2FA's anti-analysis features

Tycoon 2FA places a Cloudflare turnstile CAPTCHA before the proxy page. This prevents automated URL scanners (including Microsoft's Safe Links detonation) from reaching the phishing page. The URL appears clean to automated analysis — only a human who completes the CAPTCHA reaches the proxy. This is why Wave 1's URL was clean at delivery and only flagged 23 minutes later.

Why MFA alone fails — and what works

MFA methodStops traditional phishing?Stops AiTM?Why?
SMS OTPYesNoOTP passes through the proxy
Authenticator pushYesNoUser approves thinking it’s the real site
Authenticator OTPYesNoOTP passes through the proxy
Phone callYesNoApproval passes through the proxy
FIDO2 security keyYesYesCryptographically bound to the real domain — proxy cannot complete the handshake
Certificate-based authYesYesCertificate verifies the server’s domain — proxy fails verification
Windows Hello for BusinessYesYesTPM-bound, device-specific — cannot be proxied

Check your understanding

1. An attacker captures a refresh token via AiTM. You revoke the user's active sessions but do not revoke refresh tokens. What happens?

The attacker loses access permanently
The attacker loses access until the session token expires (60-90 min)
The attacker uses the refresh token to silently obtain new access tokens without re-authentication — maintaining access for up to 90 days

2. Why did the phishing URL appear clean to Safe Links at delivery time?

The phishing kit used a Cloudflare turnstile CAPTCHA that blocked automated scanners — only human visitors who completed the CAPTCHA reached the proxy page. Safe Links' automated detonation saw a CAPTCHA page, not a phishing page.
The URL was not yet active
Safe Links was disabled for this mailbox

3. FIDO2 stops AiTM but authenticator app push does not. What is the fundamental difference?

FIDO2 is hardware-based; authenticator is software
FIDO2 requires biometric verification
FIDO2 cryptographically verifies the server domain — it checks that the login page is actually login.microsoftonline.com, not phishing-domain.com. The authenticator app just shows a push notification with no domain verification.