Adversary-in-the-middle kits proxy the real sign-in page, relay the user’s password and MFA response, and capture the resulting session cookie. The attacker then replays that cookie from their own infrastructure and inherits an already authenticated session. The sign-in succeeded legitimately, so detection depends on spotting where the session is used afterwards.
Signals at a Glance
| Signal | Where | ATT&CK |
|---|---|---|
| Same session ID used from two IPs or ASNs in a short window | SigninLogs, NonInteractive logs | T1539 |
| Entra ID Protection anomalousToken, tokenIssuerAnomaly or attackerinTheMiddle risk events | SigninLogs, RiskyUsers | T1557 |
| Sign-in marked MFA satisfied by token claim from an unfamiliar device or user agent | SigninLogs | T1550.004 |
| New inbox rule or forwarding set minutes after a suspicious sign-in | OfficeActivity, CloudAppEvents | T1114.003 |
| Lure domain sign-in page proxying login.microsoftonline.com | Proxy, DNS, URL telemetry | T1566.002 |
Session Reuse Across Networks
A replayed cookie carries the original session identifier, so the same SessionId appears from the victim’s network and then from attacker infrastructure. Compare network origin per session across interactive and non-interactive sign-ins:
// Microsoft Sentinel (KQL) - one session ID seen from multiple ASNs and countries
union SigninLogs, AADNonInteractiveUserSignInLogs
| where TimeGenerated > ago(1d)
| where ResultType == 0
| extend Country = tostring(LocationDetails.countryOrRegion)
| summarize ASNs = dcount(AutonomousSystemNumber),
Countries = dcount(Country),
IPs = make_set(IPAddress, 10),
Agents = dcount(UserAgent),
First = min(TimeGenerated), Last = max(TimeGenerated)
by UserPrincipalName, SessionId
| where ASNs >= 2 and Countries >= 2
| order by Last desc
// tune/validate: mobile carriers and VPN egress produce legitimate ASN changes; require Countries >= 2 or a risk event
- Join to
RiskEventTypes_V2on the same session;anomalousTokenandtokenIssuerAnomalyare the Entra ID Protection detections designed for this case. - Hunt for the lure: a sign-in page hosted on an unrelated domain that loads login.microsoftonline.com assets, visible in proxy or URL click telemetry.
- Token protection and compliant-device Conditional Access make replayed cookies fail outright; use detections to find the gaps, not as the only control.
What the Attacker Does Next
Post-compromise behaviour is more reliable than the replay itself. AiTM intrusions commonly create inbox rules to hide replies, then pivot to business email compromise. Alert when a rule is created close to a sign-in from a new network:
// KQL - inbox rule created within 30 minutes of a sign-in from an unfamiliar IP
let sus = SigninLogs
| where TimeGenerated > ago(1d) and ResultType == 0
| where RiskEventTypes_V2 has_any ("anomalousToken","tokenIssuerAnomaly","unfamiliarFeatures")
| project SignTime = TimeGenerated, UserPrincipalName, IPAddress;
OfficeActivity
| where TimeGenerated > ago(1d)
| where Operation in ("New-InboxRule", "Set-InboxRule", "UpdateInboxRules")
| extend UserPrincipalName = tolower(UserId)
| join kind=inner (sus | extend UserPrincipalName = tolower(UserPrincipalName)) on UserPrincipalName
| where TimeGenerated between (SignTime .. SignTime + 30m)
| project TimeGenerated, UserPrincipalName, Operation, IPAddress, Parameters
// tune/validate: drop the risk filter to widen coverage, then rank by rule parameters (DeleteMessage, MoveToFolder RSS/Archive)
- Contain by revoking all refresh tokens and sessions for the user, not only resetting the password.
- Review OAuth app grants and registered MFA methods for the account, since attackers often add their own authenticator.
Use Microsoft’s guidance on AiTM phishing and BEC investigations, Entra ID Protection risk detection definitions, Microsoft Sentinel AiTM analytics and the Elastic and SigmaHQ rules for suspicious inbox rule creation. Baseline your own environment, because roaming users and VPN egress shift ASN and country legitimately.
Build Detections That Fire
Mjolnir Security helps blue teams turn threat intelligence into high-fidelity detections across endpoint, network, identity and cloud telemetry.
- Detection Engineering We build and tune detections mapped to ATT&CK from your own telemetry.
- Threat Hunting as a Service Hypothesis-driven hunts for the behaviours on this page.
- 24/7 Incident Response Containment when a detection fires. Call +1 833 403 5875.
Stay ahead of emerging threats. Get notified when we publish new intelligence reports and advisories.
Subscribe to Alerts