AiTM phishing doesn't break MFA. The user completes MFA for real, through a reverse proxy, and the attacker walks off with the session cookie that comes back afterwards. If your main signal for this is an impossible travel alert, you're finding out after the inbox rules are already in place.
This post is the detection set I'd want in any Sentinel workspace that has Entra ID and Exchange Online logs flowing. Every query is written against standard tables (SigninLogs, AADNonInteractiveUserSignInLogs, AADUserRiskEvents, OfficeActivity, AuditLogs), and I've marked which ones are alert-grade and which ones are hunts that will drown you if you schedule them as rules.
Why this is still the problem in 2026
Tycoon 2FA was the volume leader for most of 2025, and Microsoft, Europol, Cloudflare and partners took down a big chunk of its infrastructure in March 2026 (around 330 domains seized). It didn't end anything. Activity came back, other kits like EvilProxy, Sneaky 2FA, Mamba 2FA and Salty 2FA kept operating, and Evilginx is still free for anyone who wants to write a phishlet. Two shifts matter for detection:
- Device code phishing got bolted onto AiTM tradecraft. Some Tycoon-style campaigns now push victims through the OAuth device code flow instead of (or alongside) a proxied login page. Different logs, different detection.
- Kits are getting better at looking like a real browser. Some newer kits drive a real headless Chrome instead of rewriting traffic, which makes user agent and TLS fingerprint tricks less reliable. Don't build your whole strategy on "weird user agent".
The constant across all of them: the attacker ends up holding a valid session, and Entra ID logs where that session was born and where it's being used. That's what we key on.
What Entra ID actually sees during an AiTM sign-in
This is the part people get wrong. In a reverse-proxy attack, the victim's browser never talks to login.microsoftonline.com. The proxy does. So the interactive sign-in, with MFA, is logged from the proxy's IP, not the user's home or office IP. Then the stolen cookie gets replayed, sometimes from the same proxy infrastructure, sometimes from a separate operator box or residential proxy.
| Stage | Where it shows up | What looks off |
|---|---|---|
| Victim authenticates through proxy | SigninLogs | Successful MFA from an ASN the user has never used, usually hosting/VPS or a CDN edge |
| Stolen session replayed | SigninLogs, AADNonInteractiveUserSignInLogs | Same SessionId used from a different ASN/country; MFA satisfied "by claim in the token" |
| Identity Protection fires | AADUserRiskEvents | attackerinTheMiddle, anomalousToken risk detections (P2) |
| Mailbox staged for BEC | OfficeActivity | Inbox rule that hides mail: move to RSS/Archive, delete, mark read, one-character name |
| Persistence | AuditLogs | New MFA method registered shortly after the suspicious sign-in |
Five stages, five chances. You don't need all of them to fire. You need at least one that's high-fidelity enough to page someone, and the rest to make the investigation fast.
Detection 1: MFA completed from an ASN the user has never used
This is my favourite AiTM signal because it targets the moment the proxy does the real authentication. A user's set of ASNs over 30 days is surprisingly small: home ISP, mobile carrier, corporate egress, maybe a VPN. A fresh MFA completion from somewhere outside that set is worth looking at. Save this one as a workspace function called AiTM_NewASNMfaSignins, because detections 4 and 5 reuse it.
// Save as workspace function: AiTM_NewASNMfaSignins let baselineStart = ago(30d); let detectionStart = ago(1d); let UserASNBaseline = SigninLogs | where TimeGenerated between (baselineStart .. detectionStart) | where ResultType == "0" | summarize KnownASNs = make_set(AutonomousSystemNumber, 500) by UserPrincipalName; SigninLogs | where TimeGenerated >= detectionStart | where ResultType == "0" | where AuthenticationRequirement == "multiFactorAuthentication" // keep only sign-ins where MFA was actually performed, not satisfied by an existing token claim | mv-apply AuthStep = todynamic(AuthenticationDetails) on ( where tostring(AuthStep.authenticationStepResultDetail) == "MFA successfully completed" | summarize MfaMethods = make_set(tostring(AuthStep.authenticationMethod)) ) | where array_length(MfaMethods) > 0 | join kind=leftouter UserASNBaseline on UserPrincipalName | where isnull(KnownASNs) or not(set_has_element(KnownASNs, AutonomousSystemNumber)) | extend Country = tostring(LocationDetails.countryOrRegion), City = tostring(LocationDetails.city) | project TimeGenerated, UserPrincipalName, IPAddress, AutonomousSystemNumber, Country, City, AppDisplayName, ClientAppUsed, UserAgent, MfaMethods, SessionId, CorrelationId, RiskLevelDuringSignIn | order by TimeGenerated desc
On its own this is a hunt, not an alert. Travel, new home internet, and a user tethering to a hotel Wi-Fi all hit it. To turn it into an alert, add one of these conditions:
- The ASN is a hosting provider. Keep a watchlist of hosting/VPS ASNs (DigitalOcean, OVH, Hetzner, Vultr, Linode/Akamai, M247, the usual suspects) and filter on it. Legit users almost never complete MFA from a datacenter ASN unless they're on a commercial VPN, and you should know which VPNs your company allows.
- The same SessionId shows up somewhere else within hours (detection 2).
- A mailbox or auth-method change follows (detections 4 and 5).
let HostingASNs = _GetWatchlist('HostingASNs') | project ASN = toint(SearchKey); AiTM_NewASNMfaSignins | where AutonomousSystemNumber in (HostingASNs)
new joiners have no baseline, so isnull(KnownASNs) makes every first sign-in show up. That's intentional for the hunt. For the alert version, either exclude accounts created in the last 14 days or accept the noise during onboarding weeks.
Detection 2: one session, multiple networks (token replay)
Entra stamps a SessionId on sign-ins, and it carries across the interactive and non-interactive tables. A real user's session lives on one device. When the same session ID is used from two different countries, or from a residential ISP and then a hosting ASN, a cookie has moved. This is the closest thing to a direct token-replay signal you get from logs alone.
let window = 1d; union isfuzzy=true (SigninLogs | where TimeGenerated > ago(window) | where ResultType == "0" | project TimeGenerated, UserPrincipalName, SessionId, IPAddress, AutonomousSystemNumber, Location, AppDisplayName, UserAgent, Type), (AADNonInteractiveUserSignInLogs | where TimeGenerated > ago(window) | where ResultType == "0" | project TimeGenerated, UserPrincipalName, SessionId, IPAddress, AutonomousSystemNumber, Location, AppDisplayName, UserAgent, Type) | where isnotempty(SessionId) | summarize FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated), IPs = make_set(IPAddress, 20), ASNs = make_set(AutonomousSystemNumber, 20), Countries = make_set(Location, 10), UserAgents = make_set(UserAgent, 10), Apps = make_set(AppDisplayName, 20), SignIns = count() by UserPrincipalName, SessionId | where array_length(ASNs) > 1 | extend CountryCount = array_length(Countries) | extend Severity = iff(CountryCount > 1, "High", "Medium") | order by CountryCount desc, SignIns desc
Mobile users flip between Wi-Fi and carrier networks all day, so ASNs > 1 within one country is a hunt. CountryCount > 1 inside a single session is what I'd page on. If you combine this with the hosting ASN watchlist (any ASN in the session's set is hosting), the false positive rate drops to the point where most hits are real or are an unapproved VPN, and you want to know about both.
Detection 3: use the AiTM detections you're already paying for
If you have Entra ID P2, Identity Protection already generates attackerinTheMiddle and anomalousToken risk detections. Plenty of SOCs ingest AADUserRiskEvents and never write a rule against it because they assume the Entra alerts flow somewhere. Check that assumption. Then make these a high-severity rule on their own.
AADUserRiskEvents | where TimeGenerated > ago(1d) | where RiskEventType in~ ("attackerinTheMiddle", "anomalousToken", "tokenIssuerAnomaly", "suspiciousBrowser") | project TimeGenerated, UserPrincipalName, RiskEventType, RiskLevel, RiskState, DetectionTimingType, IpAddress, Location, RequestId, CorrelationId | order by TimeGenerated desc
Some of these are offline detections, so they can land hours after the sign-in. That's fine for an alert, but it's a reason not to rely on them alone. When one fires, pivot to the sign-in with SigninLogs | where Id == "<RequestId>" and then run detection 2 for that user's sessions.
Detection 4: the inbox rule that follows
The fastest reliable post-compromise signal in a BEC-motivated AiTM is the mailbox rule. Attackers want to hide replies from the real user, so the rules have a shape: move to RSS Subscriptions, RSS Feeds, Conversation History or Archive; delete; mark as read; and often a name like ., .. or ,. Finance keywords in the conditions are the cherry on top.
The Parameters field in OfficeActivity is an array of Name/Value pairs, which is annoying to filter directly. Flatten it into a property bag first:
let lookback = 1d; let HidingFolders = dynamic(["RSS Subscriptions", "RSS Feeds", "Conversation History", "Archive", "Junk Email"]); let FinanceTerms = dynamic(["invoice", "payment", "wire", "remittance", "bank", "ACH", "EFT", "payroll"]); OfficeActivity | where TimeGenerated > ago(lookback) | where Operation in~ ("New-InboxRule", "Set-InboxRule") | mv-apply p = todynamic(Parameters) on ( summarize RuleParams = make_bag(bag_pack(tostring(p.Name), tostring(p.Value))) ) | extend RuleName = tostring(RuleParams.Name), MoveToFolder = tostring(RuleParams.MoveToFolder), DeleteMessage = tostring(RuleParams.DeleteMessage), MarkAsRead = tostring(RuleParams.MarkAsRead), ForwardTo = strcat(tostring(RuleParams.ForwardTo), tostring(RuleParams.RedirectTo), tostring(RuleParams.ForwardAsAttachmentTo)), Keywords = strcat(tostring(RuleParams.SubjectContainsWords), " ", tostring(RuleParams.SubjectOrBodyContainsWords), " ", tostring(RuleParams.BodyContainsWords)) | extend ShortName = strlen(trim(@"\s+", RuleName)) <= 3 or RuleName matches regex @"^[^A-Za-z0-9]+$", HidesMail = MoveToFolder has_any (HidingFolders) or DeleteMessage =~ "True" or MarkAsRead =~ "True", FinanceKw = Keywords has_any (FinanceTerms), Forwards = isnotempty(ForwardTo) | extend Score = toint(ShortName) + 2 * toint(HidesMail) + 2 * toint(FinanceKw) + 2 * toint(Forwards) | where Score >= 3 // OfficeActivity ClientIP can be "1.2.3.4:port" or "[ipv6]:port" | extend SrcIP = case(ClientIP startswith "[", extract(@"^\[([^\]]+)\]", 1, ClientIP), countof(ClientIP, ":") == 1, tostring(split(ClientIP, ":")[0]), ClientIP) | project TimeGenerated, UserId, Operation, RuleName, MoveToFolder, DeleteMessage, MarkAsRead, ForwardTo, Keywords, Score, SrcIP | order by Score desc, TimeGenerated desc
A score of 3 or more is alert-worthy on its own in most tenants. To raise confidence further, correlate it with detection 1: a hiding rule created within six hours of a new-ASN MFA sign-in for the same user is about as close to a confirmed AiTM as you'll get without the phishing email in hand.
let Suspicious = AiTM_NewASNMfaSignins | project SignInTime = TimeGenerated, Upn = tolower(UserPrincipalName), SignInIP = IPAddress, AutonomousSystemNumber, Country; OfficeActivity | where TimeGenerated > ago(1d) | where Operation in~ ("New-InboxRule", "Set-InboxRule") | extend Upn = tolower(UserId) | join kind=inner Suspicious on Upn | where TimeGenerated between (SignInTime .. (SignInTime + 6h)) | project RuleTime = TimeGenerated, Upn, Operation, Parameters, ClientIP, SignInTime, SignInIP, AutonomousSystemNumber, Country
One gap to know about: rules created from the Outlook desktop client can show up as UpdateInboxRules with a different parameter structure. If you have heavy Outlook client usage, write a second version for that operation rather than forcing both into one parser.
Detection 5: new MFA method right after the suspicious sign-in
Smarter operators don't just take the session, they register their own authenticator so they can get back in after the cookie expires or gets revoked. That lands in AuditLogs.
let Suspicious = AiTM_NewASNMfaSignins | project SignInTime = TimeGenerated, Upn = tolower(UserPrincipalName), SignInIP = IPAddress, AutonomousSystemNumber; AuditLogs | where TimeGenerated > ago(1d) | where LoggedByService == "Authentication Methods" | where OperationName in ("User registered security info", "User registered all required security info", "User changed default security info") | extend Upn = tolower(tostring(InitiatedBy.user.userPrincipalName)), RegIP = tostring(InitiatedBy.user.ipAddress) | join kind=inner Suspicious on Upn | where TimeGenerated between (SignInTime .. (SignInTime + 6h)) | project RegTime = TimeGenerated, Upn, OperationName, ResultReason, RegIP, SignInTime, SignInIP, AutonomousSystemNumber | extend SameIPAsSuspiciousSignIn = RegIP == SignInIP
If SameIPAsSuspiciousSignIn is true, treat it as confirmed until proven otherwise. The response for this one is different from a plain session theft, because revoking sessions alone leaves the attacker's authenticator in place.
Detection 6: device code flow from users who never use it
With AiTM kits adding device code phishing, you want visibility on the flow itself. In most enterprise tenants, device code sign-ins are rare and come from a small, predictable set of users (people setting up Teams Rooms devices, a few admins on CLI tools). A user who has never used it suddenly completing one is worth a look.
let Baseline = SigninLogs | where TimeGenerated between (ago(30d) .. ago(1d)) | where AuthenticationProtocol =~ "deviceCode" | distinct UserPrincipalName; SigninLogs | where TimeGenerated > ago(1d) | where AuthenticationProtocol =~ "deviceCode" | where ResultType == "0" | where UserPrincipalName !in (Baseline) | project TimeGenerated, UserPrincipalName, IPAddress, AutonomousSystemNumber, Location, AppDisplayName, ResourceDisplayName, UserAgent, SessionId
Better still, block it. A Conditional Access policy using the authentication flows condition can block device code flow for everyone except an excluded group. Once that's in place, this query becomes a "someone in the exclusion group did it" monitor plus a "the block failed" check.
A cheap tripwire: the company branding CSS canary
Entra company branding lets you add custom CSS to your sign-in page. If that CSS loads a background image from a URL you control, every load of your sign-in page fetches it, and the browser sends a Referer. On the real page, the referer is Microsoft. When a reverse proxy serves your branded page from login-micros0ft-sso[.]com, the referer is the phishing domain. Thinkst Canarytokens has a ready-made token type for exactly this.
Caveats: some kits strip or rewrite branding, and browser referrer policies can trim the header. It's a tripwire, not a control. But when it fires, it fires before credentials are entered, it hands you the phishing domain to block, and it costs nothing to set up.
What to alert on vs. what to hunt
| Detection | Use as | Severity | Main FP source |
|---|---|---|---|
| 1. New-ASN MFA (raw) | Hunt | n/a | Travel, new ISP, onboarding |
| 1 + hosting ASN watchlist | Alert | Medium | Unapproved commercial VPNs |
| 2. Session across countries | Alert | High | Rare: split-tunnel VPN edge cases |
| 2. Session across ASNs, one country | Hunt | n/a | Mobile network switching |
| 3. Identity Protection AiTM/token risk | Alert | High | Low |
| 4. Inbox rule score ≥ 3 | Alert | Medium | Users who genuinely organise mail into Archive |
| 4 correlated with 1 | Alert | High | Very low |
| 5. MFA registration after 1 | Alert | High | New device setup while travelling |
| 6. First-time device code | Alert (or block) | Medium | Admins on new CLI tools |
Response: order matters
The common mistake is resetting the password first and calling it done. A password reset doesn't kill the stolen session on its own. The order I'd run:
- Revoke sessions. This invalidates refresh tokens. CAE-aware workloads (Exchange Online, SharePoint, Teams) honour it in near real time; other apps can hold a valid access token until it expires, typically around an hour.
- Remove attacker persistence. Auth methods registered by the attacker, inbox rules, mailbox forwarding, and any OAuth app consents granted during the session.
- Reset the password and require re-registration if any auth method was touched.
- Scope. Pull every
SessionIdtied to the attacker IPs and check what they accessed:OfficeActivityfor mail access and sends, SharePoint file access, and sent items for internal phishing (AiTM operators love to pivot to the victim's contacts). - Hunt the campaign. Take the proxy IP and ASN from the first sign-in and run detection 1 without the user filter. AiTM campaigns rarely hit one user.
$upn = "user@contoso.com" Connect-MgGraph -Scopes "User.RevokeSessions.All","UserAuthenticationMethod.ReadWrite.All" Revoke-MgUserSignInSession -UserId $upn # Review registered auth methods; remove anything the user doesn't recognise Get-MgUserAuthenticationMethod -UserId $upn | Format-List Connect-ExchangeOnline Get-InboxRule -Mailbox $upn | Select-Object Name, Enabled, MoveToFolder, DeleteMessage, MarkAsRead, ForwardTo, RedirectTo Get-Mailbox $upn | Select-Object ForwardingSmtpAddress, ForwardingAddress, DeliverToMailboxAndForward
The controls that actually end this
Detection buys time. These are what close the door:
- Phishing-resistant MFA via authentication strengths. FIDO2 keys, passkeys, Windows Hello for Business and certificate-based auth are bound to the real origin, so a proxy on a look-alike domain can't complete them. Start with admins and finance, then expand.
- Require a compliant or hybrid-joined device in Conditional Access for sensitive apps. The proxy can't present device compliance, so the stolen session never gets issued for those resources.
- Token protection where your platform and apps support it. Check current scope before you rely on it, because coverage for browser sessions has been limited compared to native apps.
- Block device code flow with the authentication flows condition, exclusions by group.
Until every user is on phishing-resistant auth, AiTM is going to keep working against some of your population. The goal of the detections above is to make sure that when it does, you catch it at the sign-in or the inbox rule, not when finance calls about a wire that already left.
Every issue includes a full detection rule for Sentinel, CrowdStrike or Splunk, with investigation steps, false positive guidance and MITRE mapping. Platforms rotate so you get broad coverage over time.
Join — $14.99/mo See a Sample Issue