Skip to content
Triageby WETNav

Adversary-in-the-middle phishing: detect and respond

By Published Updated

Adversary-in-the-middle (AiTM) phishing puts a reverse proxy between the user and the real sign-in page. The user enters a genuine password and completes a genuine MFA prompt, and the proxy keeps the session cookie the identity provider issues, so the attacker signs in elsewhere without needing either. Phishing-resistant MFA stops it.

The user sees the real sign-in page, completes MFA and lands in their mailbox. Meanwhile the proxy in the middle keeps the session cookie and uses it from somewhere else.

Steals:
Password and session cookie
Defeats:
Push, SMS and code-based MFA
Stopped by:
Phishing-resistant MFA, token binding
ATT&CK:
T1557T1539T1550.004T1566.002

Paste the rewritten or redirected link to see where it really lands, with kit hosting and the recipient's address flagged, without clicking.

Unwrap the link chain
On this page

How an AiTM kit steals a session

  1. UserThe user follows the lure to a sign-in page on the attacker's domain.
  2. ProxyThe kit relays each request to the real Microsoft or Google sign-in and each response back.
  3. Real sign-inThe user enters the password and approves MFA. The identity provider logs a valid sign-in from the proxy's IP.
  4. Cookie capturedThe identity provider issues a session cookie, and the proxy keeps a copy.
  5. ReplayThe attacker loads the cookie in their own browser and is signed in from a different IP, with no MFA prompt.
  6. Inbox rulesRules to hide replies, a new MFA method and mailbox searches for invoices follow, often leading to BEC.
The password and the MFA approval are genuine. The session is what gets stolen, so revoke sessions before you reset the password.

How does AiTM phishing bypass MFA?

A reverse proxy sits between the user and the real identity provider. It relays the password and the MFA prompt in both directions, so the user sees genuine pages and completes a genuine MFA challenge. The identity provider then issues a session cookie to the proxy, which keeps a copy. The attacker loads that cookie into their own browser and is signed in, no password or MFA needed.

Phishing-as-a-service kits sell this ready-made. What follows is predictable: inbox rules to hide replies, a new MFA method for persistence, mailbox searches for invoices, and BEC from the real account.

Signs in the email

  • Link chains through redirectors and a CAPTCHA or bot-check page before the sign-in. Unwrap the chain without clicking in the URL decoder.
  • The recipient's address in the URL, so the fake page greets them by name.
  • A page that looks exactly like Microsoft or Google sign-in on a domain unrelated to either, often registered days earlier.
  • QR codes and attached PDFs used to carry the link past URL scanning.

Proving it in the logs

The user's sign-in comes from the proxy's IP address, not theirs, usually a hosting provider. Minutes later the same session shows up from the attacker's address. Look for a successful sign-in after a click from an IP the user has never used, the same session ID from two networks, and Microsoft Entra ID Protection detections for an anomalous token or attacker-in-the-middle activity.

This article covers the attack, the lure and the response order. For the step-by-step log investigation, follow the AiTM session token theft playbook, which walks through the sign-in, token and mailbox logs in order.

Respond in the right order

  1. 01Revoke the user's sessions and refresh tokens. A password reset alone leaves the stolen session alive.
  2. 02Reset the password and remove MFA methods the user did not register.
  3. 03Remove inbox rules, forwarding and OAuth consents created after the click.
  4. 04Block the phishing domain and purge the campaign.
  5. 05Scope what the attacker read with mailbox audit logs and look for internal phishing sent from the account.

Prevention is phishing-resistant MFA (FIDO2 security keys, passkeys, Windows Hello for Business, certificates), which will not authenticate to the wrong site, plus conditional access that requires a compliant device or token protection.

How each role works it

SOC analyst
Spots the kit infrastructure in the link chain and checks every recipient for a click followed by a sign-in. The click is the trigger to escalate, not the verdict.
Incident responder
Revokes sessions first, then resets the password and removes attacker MFA methods, rules and consents. Order matters: reset alone does not evict.
DFIR
Links the proxied sign-in and the replay through the session ID and uses mailbox audit (MailItemsAccessed) to scope what was read and when.
Malware analyst
Profiles the kit: its JavaScript, bot checks and the panel it reports to, which gives detections and blocks for the next wave.

What the workbench checks

Drop the reported email into the free workbench and these are checked in your browser before you read a line. Nothing is uploaded.

  • Link chains, redirectors and bot-check gates
  • Recipient address embedded in URLs
  • Brand sign-in pages on unrelated, newly registered domains
  • Domain age by RDAP, and opt-in reputation lookups
  • Writes the click-to-sign-in, session and MFA registration hunts

Hunting queries

KQL to scope the campaign and look for impact. The workbench writes these with the real sender, subject, domains and hashes filled in.

Successful sign-in within an hour of a clickUnified portal
let clicks = UrlClickEvents
| where Timestamp > ago(7d)
| where ActionType == "ClickAllowed" or IsClickedThrough == true
| project ClickTime = Timestamp, AccountUpn, Url;
SigninLogs
| where TimeGenerated > ago(7d) and ResultType == "0"
| project SigninTime = TimeGenerated, UserPrincipalName, IPAddress, AppDisplayName, UserAgent,
          Country = tostring(LocationDetails.countryOrRegion)
| join kind=inner (clicks) on $left.UserPrincipalName == $right.AccountUpn
| where SigninTime between (ClickTime .. (ClickTime + 1h))
| project ClickTime, SigninTime, UserPrincipalName, Url, IPAddress, Country, AppDisplayName, UserAgent

Defender XDR advanced hunting with Microsoft Sentinel connected (unified portal). In Sentinel alone, use TimeGenerated for Timestamp.

One session, several networksMicrosoft Sentinel
SigninLogs
| where TimeGenerated > ago(7d) and ResultType == "0" and isnotempty(SessionId)
| summarize IPs = make_set(IPAddress, 10),
            Countries = make_set(tostring(LocationDetails.countryOrRegion), 10),
            First = min(TimeGenerated), Last = max(TimeGenerated)
    by UserPrincipalName, SessionId
| where array_length(IPs) > 1
| sort by First desc

Mobile users change IPs legitimately. Prioritize sessions that span countries or hosting providers.

Recent MFA method registrationsMicrosoft Sentinel
AuditLogs
| where TimeGenerated > ago(7d)
| where OperationName has "security info"
| project TimeGenerated, OperationName, Result,
          User = tostring(InitiatedBy.user.userPrincipalName),
          IP = tostring(InitiatedBy.user.ipAddress)
| sort by TimeGenerated desc

This lists every registration, not only those after a click. Compare each time with the user's click and sign-in times from the queries above: a new method minutes after the click, from the proxy or attacker IP, is the persistence step.

Questions

Does MFA stop AiTM phishing?

Push notifications, SMS and one-time codes do not, because the user completes them through the proxy. Phishing-resistant methods such as FIDO2 keys, passkeys and Windows Hello for Business do, because they are bound to the real site's origin.

Is resetting the password enough?

No. The stolen session cookie stays valid after a password reset until sessions are revoked. Revoke first, then reset, then remove anything the attacker added.

How do I know whether the user entered their password?

Look for a successful sign-in shortly after the click from an IP the user has never used, typically a hosting provider. The click logs show they visited; the sign-in logs show they completed it.

References

Related on WETNav

More phishing analysis

More free triage tools