Adversary-in-the-Middle (AiTM) phishing kits (EvilginX2, Modlishka, Muraena) act as a reverse proxy between the victim and the real Microsoft sign-in page. The user completes MFA normally — the kit intercepts the post-authentication session cookie in real time. The attacker replays that cookie from a different IP. No password stolen. No MFA code stolen. Just a valid session token.
Microsoft Entra ID fires tokenIssuerAnomaly, unfamiliarFeatures, and impossibleTravel risk events when it detects session replay signatures. Because MFA genuinely completed, standard Conditional Access policies do not block the replay. Containment requires session revocation — not just password reset.
◈ Table of Contents
Background
CONTEXT| Phase | MITRE | Attacker Goal | Key Indicator |
|---|---|---|---|
| Phishing kit delivery | T1566.002 | Lure victim to AiTM proxy URL | Spear-phishing link to adversary subdomain mimicking login.microsoftonline.com |
| Credential relay + MFA bypass | T1539, T1557 | Capture session cookie after real MFA completes | User finishes MFA — kit forwards credentials live and steals the resulting cookie |
| Session cookie replay | T1550.004 | Access tenant as authenticated user from attacker IP | Sign-in from different country/ASN within minutes of MFA success — Entra fires tokenIssuerAnomaly |
| Follow-on: BEC / inbox rules | T1114.003 | Suppress detection, commit fraud | New inbox rule to delete/forward security alerts; fraudulent payment emails sent |
| Follow-on: OAuth persistence | T1528 | Maintain access after password reset | App consent to Mail.Read or offline_access — survives credential change |
| Source | Sentinel Table | Key Fields | Required Setting |
|---|---|---|---|
| Entra ID Sign-in Logs | SigninLogs | RiskEventTypes_V2, ResultType, IPAddress, LocationDetails, NetworkLocationDetails | Entra ID P1/P2; diagnostic settings → Log Analytics workspace |
| Entra ID Protection | AADUserRiskEvents | RiskEventType, RiskLevel, IPAddress, AdditionalInfo | Entra ID P2 (Identity Protection) |
| M365 Unified Audit | OfficeActivity | Operation, ClientIP, UserId — inbox rules, consent grants, email activity | Unified Audit Log enabled in Microsoft Purview |
| Defender for Office 365 | EmailEvents, EmailUrlInfo | RecipientEmailAddress, Url, UrlClickCount, NetworkMessageId | Microsoft Defender for Office 365 Plan 1+ |
Identification
DETECT & INVESTIGATEAiTM kits steal the session cookie after real MFA completes. The attacker replays it from a different IP/ASN, which triggers tokenIssuerAnomaly in Entra. A ResultType=0 (success) combined with this risk event is near-certain confirmation of session hijack — NOT a false positive despite MFA succeeding.
- 1Navigate to Entra ID → Protection → Identity Protection → Risk detections. Filter by User = [UPN from alert], date range = last 7 days.
- 2Look in the Risk event type column for
tokenIssuerAnomaly,unfamiliarFeatures, orimpossibleTravel. Any of these on a successful sign-in = investigate immediately. - 3Open the risk detection event. Note the IP address and Location fields. Then navigate to Entra ID → Users → [UPN] → Sign-in logs and find the MFA-success event 2–10 minutes earlier. Compare IP and country — if they differ, this is cookie replay.
- 4Open the second sign-in (different IP). Click the Authentication Details tab. If it shows "Previously satisfied" or no MFA step while the first showed MFA completed — confirms session token replay.
- 5Check the User risk level in the user's profile (Entra ID → Users → [UPN] → overview). If High and risk state is atRisk, Entra has already flagged this user for remediation.
| Code / Field Value | Meaning | Analyst Action |
|---|---|---|
| tokenIssuerAnomaly | Session token issued by entity different from the authenticating IdP — the AiTM kit's classic signature | Treat as confirmed AiTM. Check IP delta vs MFA completion. Proceed to C1 immediately. |
| unfamiliarFeatures | Sign-in properties (IP, device, ASN) atypical for this user's sign-in history | Correlate with phishing click in EmailUrlInfo. Click + unfamiliarFeatures within 30 min = high-confidence AiTM. |
| impossibleTravel | Two successful sign-ins from geographically separated locations within physically impossible travel time | Compare timestamps and country fields. Gap <60 min across continents = session stolen, not the user travelling. |
| ResultType = 0 | Sign-in SUCCEEDED — MFA was completed by the real user, cookie was intercepted by the AiTM kit | Critical when paired with any risk event for same user. Do NOT dismiss as clean because MFA succeeded — that is the attack. |
| RiskLevelDuringSignIn = high | Entra ID classified this sign-in as high risk in real-time via ML evaluation | Block sign-in and revoke sessions immediately. Do not wait for more evidence. |
ResultType=0 with tokenIssuerAnomaly is near-certain AiTM. The user completed real MFA — the attacker replays the resulting token from a different IP. Do NOT dismiss as a false positive because MFA succeeded. The success IS the attack signal.
Linking an email URL click to the subsequent risky sign-in proves the full kill chain — phishing delivery → AiTM intercept → session replay. This distinguishes AiTM from legitimate impossible travel, confirms the initial access vector, and identifies the full scope of affected users who clicked the same URL.
- 1Navigate to Microsoft Defender Portal → Email & Collaboration → Explorer → All email. Filter Recipient = [UPN], date range = last 7 days.
- 2Find emails received within 1 hour before the risky sign-in. Check the URL column for lookalike Microsoft domains — AiTM kits use visually similar domains (e.g. login-microsoftonIine.com, microsoft-365-login.net).
- 3Click into the suspicious email → URL clicks tab. Verify the user clicked the link. Note the exact click timestamp — it should be <5 minutes before the first Entra sign-in event.
- 4Take the AiTM proxy domain and search EmailUrlInfo for all other recipients — this identifies whether this is a targeted single-user attack or an org-wide campaign requiring broader containment.
- 5Check the domain against Sentinel → ThreatIntelligenceIndicator table — existing IOC matches confirm known AiTM infrastructure and may link to a tracked threat actor campaign.
AiTM domains frequently use lookalike characters (uppercase I vs lowercase l, zero vs O) or Unicode homoglyphs. Check the domain registration date — AiTM infrastructure is typically registered within 24–48h of the campaign launch.
Containment
STOP IT- 1Revoke all sessions (kills stolen cookie): Entra ID → Users → [UPN] → Revoke sessions. The attacker's browser session dies within seconds. This is the single most important containment action.
- 2Block sign-in: Entra ID → Users → [UPN] → Account enabled → toggle OFF. Prevents re-authentication until remediation is complete.
- 3Revoke all OAuth grants: Entra ID → Enterprise applications → filter by user → Permissions → Revoke. AiTM operators commonly consent a rogue app immediately for persistence that survives password reset.
- 4Remove malicious inbox rules: Exchange admin center → Mailboxes → [user] → Mailbox → Manage mailbox policies → Inbox rules. Delete any rules created during the compromise window. If BEC emails were sent, cross-reference SOP-10.
- 5Block AiTM domain org-wide: Microsoft Defender Portal → Email & Collaboration → Policies & rules → Threat policies → Tenant Allow/Block Lists → URLs → Add block. Enter the AiTM proxy domain.
Password reset alone does NOT revoke existing session tokens. An attacker holding a stolen cookie remains logged in even after the victim changes their password. Always revoke sessions via Entra ID FIRST.
Eradication
CLEAN UP- 1Issue a Temporary Access Pass (TAP) for MFA re-registration: Entra ID → Users → [UPN] → Authentication methods → Add method → Temporary Access Pass. Set validity to 1 hour. User must register a new authenticator app using this TAP.
- 2Delete all existing MFA methods before issuing TAP: Entra ID → Users → [UPN] → Authentication methods → delete all existing entries. AiTM kits can harvest TOTP seeds during the attack window — do not trust existing registrations.
- 3Confirm no persistent OAuth apps remain: Entra ID → Users → [UPN] → Applications → review all entries. Remove any third-party app consented during the compromise window.
- 4Review 7-day activity log: Pull OfficeActivity for the compromised UPN from click time through containment. Document every resource accessed (SharePoint files, Teams, Exchange, Azure portal) for breach scope assessment.
- 5Enable Continuous Access Evaluation (CAE): Entra ID → Protection → Continuous access evaluation. CAE reduces the token replay window from hours to seconds by enforcing near-real-time revocation signalling to supported apps.
- All sessions revoked; sign-in re-enabled only after TAP MFA re-registration confirmed
- All OAuth grants audited; non-approved grants removed
- AiTM phishing domain blocked in Defender for Office 365 Tenant Allow/Block list
- No further risky sign-in events for user in last 1 hour
- 7-day session activity reviewed and all accessed resources documented
- CAE enabled for user and supported apps
Escalation
TIERS| Tier | Trigger Condition | Who to Notify | Action |
|---|---|---|---|
| L1 → L2 | Single user AiTM confirmed, sessions revoked, no follow-on activity (no inbox rules, no OAuth grants, no sensitive data accessed) | L2 SOC Analyst | Hand off: affected UPN, phishing domain, risk event timestamps, OAuth apps found, session revocation timestamp |
| L2 → IR + CISO | Multiple victims of same campaign OR BEC fraud email sent from account OR sensitive/PII/financial data accessed during compromise window | IR Team + CISO | Treat as potential data breach. Legal notification assessment required (GDPR 72h, PCI 24h). Engage CISO immediately. |
| L2 → Security Engineering | CA policy did not block the session replay — CAE not enforced, token binding not in place, Entra ID Protection not licensed correctly | Security Architecture | Prioritise CAE rollout and phishing-resistant MFA (FIDO2/passkeys) via CA policy for all users |
Authorized security research & penetration testing only. Unauthorized use is illegal. Built by Rudra Verma | Senior Cyber Security Architect & Researcher | CyberHawk Threat Intel
◈ Stay Connected
Follow CyberHawk Threat Intel for threat intelligence, SOC playbooks, and hands-on detection engineering content.
"They can't exploit you if you are the Exploit."