How to Detect AiTM & Evilginx Phishing in Microsoft Entra ID Sign-In Logs
Adversary-in-the-Middle phishing kits (Evilginx, Tycoon 2FA, NakedPages) sit between the victim and Microsoft login pages, capturing valid session cookies even after MFA passes. In Entra ID Sign-In logs, spot AiTM compromises via anomalous proxy/hosting ASNs, scripted user-agents (axios, python-requests), a sudden IP hop sharing the same SessionId, and immediate My Sign-Ins MFA registrations.
Why This Artifact Matters in M365 Incident Response
Traditional push-notification and SMS Multi-Factor Authentication no longer stop modern Microsoft 365 credential phishing. Today’s dominant phishing-as-a-service toolkits—such as Evilginx, Tycoon 2FA, and Dadsec—act as live reverse proxies that relay the employee’s password and MFA prompt directly to login.microsoftonline.com in real time.
The moment the employee approves the Authenticator push or enters their 6-digit TOTP code, Microsoft issues valid `ESTSAUTH` and `ESTSAUTHPERSISTENT` session cookies back through the phishing server. The attacker saves those cookies and replays them directly into Outlook on the Web or My Sign-Ins without ever needing another MFA prompt.
Because the victim genuinely approved MFA during the reverse-proxy login, `conditionalAccessStatus` frequently reports `success` and `status.errorCode` reports `0`. That fools analysts who only hunt failed logins. Instead, detecting AiTM requires inspecting the surrounding behavioral telemetry across Entra Sign-Ins and Entra Directory Audits.
Look for three high-confidence indicators together: first, an unfamiliar hosting or residential proxy IP (`ipAddress` / `autonomousSystemNumber`) running an unmanaged browser or scripted `userAgent` (`python-requests`, `axios`, `HeadlessChrome`); second, an immediate hit to `My Sign-Ins` (`19db3b61-4251-459f-a8c5-222813d625a7` or `appDisplayName = My Sign-Ins`) followed by `User registered security info`; and third, identical `sessionId` GUIDs spanning two completely different locations or client browsers.
Real-World Incident Walkthrough
At 14:02 UTC, an HR Lead signs in normally from Austin, TX (`203.0.113.77`) using Edge on a compliant corporate Windows device. Seven minutes later, the HR Lead clicks a fake DocuSign link hosted behind Cloudflare Workers and completes MFA on an Evilginx proxy in Frankfurt (`194.26.135.210`).
At 14:09 UTC, Entra logs an initial MFA challenge (`errorCode 50074`, `riskLevelDuringSignIn = high`) from `python-requests/2.32.3` in Frankfurt, followed at 14:11 UTC by a successful `errorCode 0` sign-in to `My Sign-Ins`, at 14:12 UTC by `User registered security info` (Authenticator App - Pixel 8), and at 14:15 UTC by an illicit OAuth app consent. Loading the Entra JSON into AuditVane lights up rules `AV-003`, `AV-004`, `AV-005`, `AV-006`, and `AV-009` simultaneously.
Forensic Telemetry Fields & High-Signal Indicators
| Telemetry Field / Pattern | Meaning in M365 / Entra | High-Signal Threat Indicator |
|---|---|---|
ipAddress / ASN | VPS hosting or residential proxy exit node | Mismatches victim’s corporate egress or home ISP |
userAgent | python-requests, axios, HeadlessChrome, Edge/18 | AiTM cookie-replay automation fingerprint (AV-003) |
appDisplayName = My Sign-Ins | Account security-info portal opened | Immediately precedes rogue MFA registration (AV-004) |
riskLevelDuringSignIn = high | Identity Protection anomaly score | Often triggers anonymizedIPAddress / unfamiliarFeatures |
deviceDetail.isCompliant = false | Unmanaged Linux/Windows browser context | Shows gap where compliant device was not required |
sessionId across 2+ countries | Same Entra sessionId reused on foreign IP | Smoking-gun proof of cookie/token replay |
Standard MFA Phish Failure vs. Successful AiTM Reverse-Proxy Takeover
| Telemetry Field | Traditional Credential Phishing (Stopped by MFA) | Successful AiTM Reverse Proxy (Evilginx / Tycoon) |
|---|---|---|
| status.errorCode | 50074 / 50076 (stalled at MFA) | 0 (Success) after victim completes MFA on proxy |
| conditionalAccessStatus | failure (if MFA unsatisfied) | success (unless FIDO2 or compliant device enforced) |
| Post-Login Target | None (blocked) | My Sign-Ins + OAuth consent + Exchange OWA |
| UserAgent / Device | Attacker script hits MFA wall | Unmanaged browser or python-requests/axios replay |
AiTM Replay Sign-In Record in Entra ID JSON
{
"id": "signin-9003",
"createdDateTime": "2026-12-02T14:11:18Z",
"userPrincipalName": "hr.lead@contoso-demo.invalid",
"appDisplayName": "My Sign-Ins",
"resourceDisplayName": "Microsoft Graph",
"ipAddress": "194.26.135.210",
"clientAppUsed": "Browser",
"userAgent": "python-requests/2.32.3",
"conditionalAccessStatus": "success",
"riskLevelDuringSignIn": "high",
"location": { "city": "Frankfurt", "countryOrRegion": "DE" },
"status": { "errorCode": 0 }
}
Notice the deceptive trap here: conditionalAccessStatus is "success" and errorCode is 0—yet userAgent ("python-requests/2.32.3"), appDisplayName ("My Sign-Ins"), and riskLevelDuringSignIn ("high") from Frankfurt expose a clear AiTM session replay.
Export Entra Sign-In JSON for AuditVane & KQL AiTM Hunt
# Export Entra Sign-In JSON locally for AuditVane:
Connect-MgGraph -Scopes "AuditLog.Read.All"
$signins = Get-MgAuditLogSignIn -Filter "userPrincipalName eq 'hr.lead@domain.com'" -Top 500
@{ value = $signins } | ConvertTo-Json -Depth 10 | Out-File .\Entra_SignIns.json -Encoding utf8
// Sentinel KQL AiTM Hunt:
SigninLogs | where TimeGenerated > ago(7d) and (RiskLevelDuringSignIn == "high" or AppDisplayName == "My Sign-Ins")
| join kind=inner (AuditLogs | where OperationName has "security info") on CorrelationId
Sample KQL AiTM Detection Hit
TimeGenerated UserPrincipalName IPAddress AppDisplayName RiskLevelDuringSignIn
------------- ----------------- --------- -------------- ---------------------
2026-12-02T14:11:18Z hr.lead@contoso-demo.invalid 194.26.135.210 My Sign-Ins high
Step-by-Step Triage, Containment & Verification
- Export both Interactive and Non-Interactive Entra Sign-In JSON + Entra Directory Audit JSON + Purview UAL CSV immediately.
- Drop all files into AuditVane to surface AV-003 (scripted user-agents), AV-004 (MFA changes), AV-006 (risky sign-ins), and AV-009 (geo-velocity).
- Reset credentials and execute Revoke-MgUserSignInSession immediately to kill the stolen AiTM refresh token.
- Inspect Get-MgUserAuthenticationMethod and delete any newly enrolled Authenticator app, phone number, or passkey.
- Inspect Purview UAL for downstream Exchange inbox rules (AV-001), MailItemsAccessed (AV-007), and OAuth consents (AV-005).
- Protect executives and admins permanently by enforcing Phishing-Resistant MFA (FIDO2 passkeys or Windows Hello for Business) via Conditional Access Authentication Strengths.
How to Verify Containment Completed Cleanly
- Stolen AiTM sessions terminated via Revoke-MgUserSignInSession.
- All newly added MFA methods and OAuth consents verified and removed.
- FIDO2 / Compliant Device Conditional Access enforced to stop future AiTM cookie capture.
Analyst Blind Spots, Licensing Quirks & False Positives
Never assume `conditionalAccessStatus == "success"` means the sign-in was legitimate! Conditional Access only measures whether your configured policies were satisfied—not whether the authentication happened through an attacker’s reverse proxy.
Also watch out for delayed Identity Protection risk verdicts: `riskLevelDuringSignIn` can read `none` in real time while `riskLevelAggregated` updates to `high` minutes later once token replay signals correlate.
Frequently Asked Questions
Why does MFA show Satisfied during an Evilginx AiTM attack?
Because the victim completed a real MFA prompt on their phone while their browser session was transparently proxied through the attacker’s AiTM server.
Does Entra Conditional Access block AiTM phishing automatically?
Standard push/TOTP MFA does NOT stop AiTM. Only Phishing-Resistant MFA (FIDO2 / Passkeys / Windows Hello for Business) or compliant-device / Token Protection policies cryptographically bind the login to the real Microsoft origin.
How does AuditVane detect AiTM compromises?
AuditVane correlates scripted user-agents (AV-003), rogue security-info changes (AV-004), CA/risk flags (AV-006), and multi-country IP hops (AV-009) across merged Entra and Purview files.
Can attackers replay AiTM cookies days later?
Yes, persistent ESTSAUTHPERSISTENT cookies and refresh tokens survive until expiration or explicit revocation via Revoke-MgUserSignInSession.