Adversary-in-the-middle (AiTM) phishing defeats passwords, one-time codes and push approvals in a single step, because the attacker relays a real sign-in and keeps the session cookie that comes back. Kits rented as phishing-as-a-service have made this a routine attack on Microsoft 365 and Google workforce accounts, and device code phishing reaches the same outcome without a proxy. This guide explains both at technique level, the kits defenders will see in reporting, which authentication methods resist them, and the identity controls, detections and response steps that close the gap. It is for identity engineers, architects and SOC teams; for phishing in general see the Phishing Guide.
Key takeaways
- AiTM steals the session, not just the password. A reverse proxy relays the user's real sign-in, including MFA, and captures the session cookie, so the attacker never needs to authenticate again while the cookie lives.
- Only origin-bound authenticators break the relay. FIDO2 security keys, passkeys, Windows Hello for Business and certificate-based authentication do not release a usable response to a look-alike domain; OTP codes, push approvals and SMS all do.
- Device code phishing needs a separate control. The user signs in on the genuine Microsoft page, so phishing-resistant MFA does not stop it; block the device code flow with an authentication flows policy and allow it only where a device has no keyboard.
- Bind sessions to managed devices. Requiring a compliant or joined device, plus token protection where supported, means a replayed cookie or token from attacker infrastructure fails Conditional Access.
- Revoke, do not just reset. A password reset alone leaves stolen refresh tokens and attacker-registered MFA methods in place; response must revoke sessions, remove added methods and devices, and delete inbox rules.
How AiTM phishing works
In classic credential phishing the fake page collects a password and stops. In AiTM phishing the attacker runs a reverse proxy that sits between the victim and the legitimate sign-in service. Every page the victim sees is the real one, relayed through the attacker's domain, so branding, error messages and the MFA prompt are all genuine. Microsoft Threat Intelligence, describing a campaign that tried to reach more than 10,000 organisations from September 2021, put it simply: "The URL is the only visible difference." When the user completes sign-in, the identity provider issues a session cookie, the proxy keeps a copy and the attacker imports it into their own browser.
Microsoft is explicit that "this is not a vulnerability in MFA": the user really did authenticate, and the cookie can carry an MFA claim. The move to money is fast: in the same campaign, payment fraud began within about five minutes of the session being stolen. The attackers searched mailboxes for finance threads, created inbox rules to hide replies from the people they were defrauding and deleted evidence, then used the trusted mailbox for follow-on business email compromise. See the Email Identity and BEC Guide.
- Reverse-proxy relay: the proxy forwards traffic both ways and captures credentials, codes and cookies as they pass. This is what Evilginx, Modlishka and Muraena do, and what most commercial kits package.
- Synchronous relay pages: several kits show their own copy of the sign-in page and relay what the user enters to the real service in real time. The outcome, a stolen session, is the same.
- Token use after capture: the attacker reaches mail, files and Microsoft Graph, often through non-interactive sign-ins users never see.
The AiTM kit ecosystem
Sekoia's June 2025 analysis ranked the kits most prevalent from January to April 2025 and found they mainly target Microsoft 365 and, less often, Google accounts. Kits are typically rented on monthly subscriptions, generally between $100 and $1,000, which lowers the skill needed. The table is for recognition, not attribution.
| Kit or framework | Type | First seen (per Sekoia) | What defenders should know |
|---|---|---|---|
| Evilginx (Evilginx2) | Open-source reverse-proxy framework | Not stated | ATT&CK software S9003; captures credentials, tokens and cookies; ATT&CK records Star Blizzard using it. |
| Modlishka, Muraena | Open-source reverse-proxy frameworks | Not stated | Named by Microsoft in the 2021 to 2022 campaign. |
| Tycoon 2FA | Phishing-as-a-service, synchronous relay | Late 2023 | Ranked first by prevalence in early 2025; widely linked to QR code lures. |
| EvilProxy | Phishing-as-a-service, reverse proxy | August 2020 | Promoted on cybercrime forums and Telegram as a service. |
| NakedPages | Reverse-proxy kit sold on Telegram | 2022 | Still ranked third in early 2025. |
| Sneaky 2FA | Phishing-as-a-service, synchronous relay | 2024 | Detections rose sharply in the first quarter of 2025. |
| Rockstar 2FA, Dadsec OTT | Phishing-as-a-service | May 2023 (Dadsec), around December 2023 (Rockstar) | Rockstar 2FA is believed to be a rebrand of Dadsec OTT. |
| Mamba 2FA | Phishing-as-a-service, synchronous relay | At least November 2023 | Sold to dozens of affiliates; decentralised infrastructure. |
| Greatness | Kit sold on Telegram | 2022 | Lower prevalence by 2025. |
Kit names change faster than controls, so indicator blocking supports the defence but is not it. Lures increasingly arrive as QR codes, HTML attachments and SVG files, which moves the click onto phones outside managed browsers. Every kit ends in the same artefact, a stolen session, so the controls below work whichever kit is used.
Device code phishing
Device code phishing reaches the same result as AiTM without a proxy. The OAuth 2.0 device authorization grant exists for devices with no keyboard: the device shows a short code, the user enters it on a genuine sign-in page from another device, and tokens are issued to the waiting device. In device code phishing the attacker starts that flow, sends the code to the victim with a pretext, and the victim authenticates on the real Microsoft page. The tokens go to the attacker. ATT&CK v20 now describes device code phishing under Spearphishing Link (T1566.002), and the resulting token theft sits under Steal Application Access Token (T1528).
Microsoft reported that Storm-2372, active since August 2024 and assessed with moderate confidence as aligned with Russian interests, used this method against government, NGO, IT, defence, telecoms, health, education and energy organisations. The actor used the tokens to search mail through Microsoft Graph and later shifted to the Microsoft Authentication Broker client ID, which let it register an attacker-controlled device in Entra ID and obtain a Primary Refresh Token (PRT). That turns a phished session into a device identity.
- Block the flow: Microsoft Learn calls device code flow "a high-risk authentication method that can be part of a phishing attack" and recommends "blocking device code flow wherever possible" using the Conditional Access authentication flows condition.
- Allow by exception: only for input-less devices such as digital signage, scoped by platform and location.
- Know the side effects: device code sessions stay protocol tracked through later refreshes, and policies targeting all resources also cover the Device Registration Service (client ID 01cb2876-7ebd-4aa4-9cc9-d28bd4d359a9, which needs excluding if device code is used for registration). Blocked refresh tokens return AADSTS530036.
- Restrict device registration: limit which users can register or join devices, so a phished token cannot become a PRT.
ATT&CK mapping
IDs checked against ATT&CK v20. The T1557 sub-techniques (.001 to .004) are network-layer attacks such as ARP poisoning; web reverse-proxy phishing sits at the parent technique.
| Technique | How it appears in AiTM and device code phishing | ATT&CK mitigations | Detection strategy |
|---|---|---|---|
| T1566.002 Phishing: Spearphishing Link | Delivery of the proxy link, QR code or device code pretext; v20 text now covers consent and device code phishing | M1047, M1021, M1054, M1018, M1017 | DET0107 |
| T1557 Adversary-in-the-Middle | Reverse proxy relays the sign-in (Credential Access and Collection) | M1042, M1041, M1037, M1035, M1031, M1030, M1017 | DET0296 |
| T1539 Steal Web Session Cookie | Proxy captures the post-MFA cookie | M1032 (FIDO keys bound to the login domain, Conditional Access for trusted devices), M1047, M1021, M1054, M1051, M1017 | DET0509 |
| T1550.004 Use Alternate Authentication Material: Web Session Cookie | Attacker replays the cookie to reach mail and files (Lateral Movement) | M1054 | DET0074 |
| T1528 Steal Application Access Token | Device code and consent phishing yield access and refresh tokens | M1047, M1021 (block end-user consent), M1018, M1017 | DET0515 |
Which authentication methods resist AiTM
NIST SP 800-63B-4 is direct: passwords, look-up secrets, out-of-band authenticators and OTPs are "not phishing-resistant". Manual OTP entry fails because "an impostor verifier could relay an authenticator output". Phishing resistance comes from verifier name binding, where the authenticator output is cryptographically bound to the site it is used on, or channel binding. That is the property that breaks a reverse proxy: a passkey created for the real domain is simply not offered to the attacker's domain. CISA's fact sheet reaches the same conclusion, calling FIDO/WebAuthn "the only widely available phishing-resistant authentication", with PKI-based smart cards as the less widely available alternative.
| Method | Reverse-proxy relay | Replay of a stolen cookie | Device code phishing |
|---|---|---|---|
| Password only, SMS or voice code | Not resisted | Not resisted | Not resisted |
| Authenticator app OTP | Not resisted: code is relayed | Not resisted | Not resisted |
| Push with number matching | Not resisted: user approves a real prompt | Not resisted | Not resisted |
| Synced passkey | Resisted (origin bound) | Not addressed by the authenticator | Not resisted: user signs in on the genuine page |
| Device-bound passkey, FIDO2 key, Windows Hello for Business, certificate-based authentication | Resisted | Not addressed by the authenticator | Not resisted |
| Any method plus compliant device requirement and token protection | Resisted: proxy is not a managed device | Reduced: bound tokens fail on another device | Reduced: attacker device fails the device condition |
Authenticator strength protects the sign-in moment; device binding protects the session afterwards. A cookie stolen by an infostealer from a security key user is still a valid cookie. See the Passwordless and Passkeys Guide and the Hardware Security Keys Guide.
Controls that close the gap
Phishing-resistant authentication, enforced
- Enforce through policy, not enrolment: in Microsoft Entra, the Conditional Access grant Require authentication strength with the built-in phishing-resistant MFA strength stops the weaker path being chosen. Registration alone does not.
- Remove fallbacks: if SMS, voice or OTP remain allowed, the proxy simply asks for them. See the MFA Fatigue and Bypass Guide.
- Protect registration: require a phishing-resistant credential or a time-limited access pass to register new methods, otherwise a proxied session can add the attacker's authenticator.
Bind the session to a device
- Require a compliant or joined device: both Microsoft's AiTM guidance and ATT&CK mitigation M1032 recommend Conditional Access that only admits trusted devices. The attacker's browser is not enrolled, so the replayed cookie fails policy. See the Device Trust and Posture Guide.
- Token protection: this Conditional Access session control accepts only device-bound sign-in session tokens such as PRTs, so "even if a threat actor steals the token, it can't be used from another device". Native clients for Exchange Online, SharePoint Online and Teams are generally available on Windows, macOS and iOS/iPadOS (Apple devices must be MDM managed, macOS 14 or later, iOS 16 or later); browser support is in preview for selected web apps only.
- Session lifetime: NIST SP 800-63B-4 sets the AAL2 overall reauthentication timeout at no more than 24 hours (SHOULD) with an inactivity timeout of no more than one hour, and AAL3 at no more than 12 hours (SHALL) with 15 minutes inactivity. Sign-in frequency policies for sensitive apps shrink the window a stolen cookie is useful.
Evaluate continuously
- Continuous Access Evaluation (CAE): Exchange Online, SharePoint Online and Teams act on critical events in near real time (up to 15 minutes): account disabled or deleted, password changed or reset, MFA enabled, all refresh tokens revoked by an administrator, and high user risk. IP location enforcement is instant. CAE tokens can last up to 28 hours, so revocation, not expiry, is the control.
- Risk-based policies: sign-in and user risk conditions block or force reauthentication when Identity Protection flags an anomalous token or unfamiliar sign-in properties.
Reduce the click
Link detonation, QR code and SVG attachment inspection and browser reputation blocking cut volume, and blocking end-user consent to unverified OAuth apps (M1021 under T1528) stops a proxied session granting a persistent app. See the Enterprise Browser and Browser Security Guide.
Choosing controls for your organisation
- Security keys or platform passkeys: choose device-bound FIDO2 keys for administrators, finance approvers and help desk staff, where NIST AAL3 or non-exportable keys matter. Choose Windows Hello for Business or platform passkeys for the general workforce on managed devices, where there is nothing extra to issue. Synced passkeys suit customers and bring-your-own-device staff but cannot meet AAL3.
- Device compliance or token protection: device compliance works across browsers and apps today and is the broader control; token protection adds cryptographic binding but covers fewer resources. Use compliance as the baseline and add token protection for the apps it supports.
- Small organisations: enforce phishing-resistant authentication for email and the identity provider, block device code flow and legacy authentication, require managed devices for administrators and turn on built-in risk detections. That covers most of the exposure without a SOC.
- Large organisations: expect exceptions: shared workstations, contractors on unmanaged devices, input-less devices that need device code flow and guest accounts (CAE does not support guests). Make each a named, time-limited exception group with compensating controls such as a virtual desktop.
How to implement
- Baseline: export a month of sign-in logs and count users by MFA method, device state and device code use (the authentication protocol filter). This shows who breaks when you enforce.
- Protect administrators first: issue FIDO2 keys and enforce the phishing-resistant authentication strength for privileged roles. CISA recommends starting with IT administrators and help desk staff, then email, remote access and identity systems.
- Block device code flow in report-only mode: review the report for a full business cycle, build the exception group for legitimate input-less devices, then enforce.
- Require compliant devices in rings: IT, then one business unit, then everyone, excluding two monitored break-glass accounts.
- Add token protection: report-only first, reviewing interactive and non-interactive sign-ins across normal use, then enforce for known reliable users.
- Remove fallbacks: once phishing-resistant coverage passes target, disable SMS, voice and OTP for enforced groups.
- Roll back safely: rollback means switching a policy back to report-only, not deleting it. Policy changes can take up to a day to reach CAE-enabled services, so revoke sessions when a change must apply at once.
Detection and measurement
AiTM leaves its clearest traces in identity and mailbox logs. Microsoft's token theft playbook notes that some detections, such as anomalous token, have no SigninLogs row, so collect AuditLogs and OfficeActivity and stream Identity Protection risk tables to the SIEM. See the ITDR Guide.
| Signal | Where to find it | Why it matters |
|---|---|---|
| Anomalous token, unfamiliar sign-in properties, anonymous IP address | Entra ID Protection risk detections | Session replay from attacker infrastructure |
| "Stolen session cookie was used" | Microsoft Defender XDR alert | Direct evidence of replay against Exchange Online |
| Mismatched user agent and application ID within one session | Entra sign-in logs | Proxy and kit behaviour flagged by Sekoia |
| Same session ID from two IPs or ASNs; unfamiliar non-interactive sign-ins | Interactive and non-interactive sign-in logs | Cookie used from a second location |
| Click on a device login URL followed by a risky sign-in; error 50199 then success in the same session | Email click events, sign-in logs | Device code phishing pattern per Microsoft |
| New inbox rule, forwarding rule or mass mail access soon after sign-in | Unified audit log, Defender for Cloud Apps | BEC preparation, often within minutes |
| Security info registered or device registered shortly after a risky sign-in | AuditLogs, Device Registration Service events | Persistence through attacker MFA or PRT |
Metrics that show the programme is working:
- Phishing-resistant coverage: percentage of sign-ins, not users, satisfied by a phishing-resistant method, split by privileged and standard accounts.
- Managed-device share: percentage of sign-ins to email and files from compliant or joined devices.
- Device code exposure: device code sign-ins per week outside the exception group (target zero).
- Time to revoke: median minutes from a token theft alert to session revocation, measured against the five-minute fraud window Microsoft observed.
- Fallback population: number of accounts still allowed SMS, voice or OTP.
Responding to a stolen session
Microsoft's playbook states that "containment, or mitigation, is prioritized over information gathering". A password reset alone is not containment. See the Account Takeover Prevention Guide and the Incident Response Guide.
- Revoke sessions: revoke all refresh tokens (revokeSignInSessions in Microsoft Graph, Revoke-MgUserSignInSession in PowerShell, or Revoke sessions in the portal); CAE-capable services act on this within minutes.
- Reset the password and mark the user compromised in Identity Protection; for hybrid accounts the playbook advises resetting the password twice.
- Remove persistence: delete MFA methods and devices registered during the attack window, inbox and forwarding rules, and OAuth consents granted to unknown apps.
- Scope: find every user who clicked the same URL or signed in from the same IP or user agent, and review changes made by affected privileged accounts.
- Warn counterparties: if mail was read, alert suppliers and customers in those threads to expect payment instruction fraud.
Framework mapping
| Framework | Reference | Relevance |
|---|---|---|
| NIST SP 800-63B-4 | AAL2 phishing-resistant option; AAL3 non-exportable keys; reauthentication timeouts | Authenticator choice and session lifetime |
| NIST SP 800-53 Rev. 5 | IA-2(1), IA-2(8), SC-23, AC-12, SI-4 | MFA for privileged access, replay resistance, session authenticity and termination, monitoring |
| NIST CSF 2.0 | PR.AA-03 | Users, services and hardware are authenticated |
| CIS Controls v8.1 | 6.3, 6.4, 6.5, 14.2 | MFA for external apps, remote access and administrators; social engineering training |
| ISO/IEC 27001:2022 Annex A | A.5.17, A.8.5, A.8.16 | Authentication information, secure authentication, monitoring |
| MITRE ATT&CK v20 | T1566.002, T1557, T1539, T1550.004, T1528 | Detection engineering and threat modelling |
Common failure patterns
- Calling OTP "strong MFA": codes from apps or hardware tokens are relayed in real time. The Dropbox GitHub breach began with a fake CircleCI login that collected credentials and a one-time code, and the Twilio 0ktapus campaign used SMS lures to harvest employee sign-ins.
- Phishing-resistant MFA registered but not required: users enrol keys, policy still accepts push or SMS, and the proxy asks for the weaker method.
- Treating sign-in as the end of the problem: session cookies outlive the authentication that created them. The CircleCI breach shows a stolen, already-authenticated SSO session being used directly; device binding and short sessions are the answer, not a stronger authenticator.
- Leaving device code flow open to everyone: it is enabled by default for most tenants and bypasses every authenticator choice.
- Reset without revoke: the password changes, the attacker's refresh token, registered authenticator and inbox rule survive.
- Exception creep: rollout exclusions are never reviewed and become the attacker's path.
Practitioner checklist
- Enforce a phishing-resistant authentication strength for administrators, finance and help desk staff first, then everyone.
- Remove SMS, voice and OTP fallbacks for every enforced group.
- Block device code flow with an authentication flows policy and keep a reviewed exception group.
- Restrict who can register or join devices and who can register security information.
- Require compliant or joined devices for email, files and admin portals; add token protection where supported.
- Enable CAE and risk-based Conditional Access, and stream identity risk tables to the SIEM.
- Alert on inbox rules, MFA method changes and device registrations that follow a risky sign-in.
- Test a token theft runbook that revokes sessions first, quarterly.
Standards and references
- NIST: SP 800-63B-4 Authentication and Authenticator Management
- CISA: Implementing Phishing-Resistant MFA
- MITRE ATT&CK: T1539 Steal Web Session Cookie
- MITRE ATT&CK: T1557 Adversary-in-the-Middle
- Microsoft Learn: Token protection in Conditional Access
- Microsoft Learn: Authentication flows in Conditional Access
- Microsoft Threat Intelligence: From cookie theft to BEC, AiTM phishing sites as entry point to financial fraud
- Sekoia: Global analysis of Adversary-in-the-Middle phishing threats
Related NHI Mgmt Group resources: Phishing Guide · MFA Fatigue and Bypass Guide · Passwordless and Passkeys Guide · Conditional Access Guide · Token and Session Security Guide