AiTM
SESSION COOKIE
TOKEN REPLAY
SIGNINLOGS
DetectionBlue TeamSOCOctober 12, 2026•9 min read

Detecting Token Theft and Adversary-in-the-Middle Hijack

MFA did not fail in an AiTM attack. It worked, and the attacker stole the result. The session cookie is the artifact to watch.

Scroll

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

SignalWhereATT&CK
Same session ID used from two IPs or ASNs in a short windowSigninLogs, NonInteractive logsT1539
Entra ID Protection anomalousToken, tokenIssuerAnomaly or attackerinTheMiddle risk eventsSigninLogs, RiskyUsersT1557
Sign-in marked MFA satisfied by token claim from an unfamiliar device or user agentSigninLogsT1550.004
New inbox rule or forwarding set minutes after a suspicious sign-inOfficeActivity, CloudAppEventsT1114.003
Lure domain sign-in page proxying login.microsoftonline.comProxy, DNS, URL telemetryT1566.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

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)
Vetted sources

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 EngineeringManaged Detection & ResponseThreat HuntingIncident ResponsePurple Teaming
  • 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.
Written by: Mjolnir Threat Research (MTAC)  |  Published: October 12, 2026  |  Last reviewed: October 12, 2026