Skip to content
Back to overview Illustration: a padlock with sign-in credentials being pulled away into a vortex
MFA Phishing Conditional Access

Token theft despite MFA: how AiTM phishing works and what actually protects Microsoft 365

By , Offensive Security 9 min read

Key takeaways

  • In adversary-in-the-middle (AiTM) phishing, the victim completes MFA themselves. The attacker then steals the session cookie and is signed in without a password or second factor.
  • What works are methods bound to the genuine Microsoft domain: passkeys (FIDO2), Windows Hello for Business and certificate-based authentication. Push approval and one-time codes are not.
  • Conditional Access requiring a managed device makes a sign-in relayed through a proxy worthless. Token Protection binds session tokens to the device, but only for certain apps and platforms.
  • Continuous Access Evaluation, risk policies and a rehearsed process for revoking sessions limit the damage if a token does get stolen.

Many organisations have rolled out MFA and consider phishing dealt with. From an attacker’s point of view, traditional MFA today is mainly a barrier against stolen passwords. It does not help against the theft of a session that is already signed in. That is exactly what phishing kits sold as a service are built for. This article explains how these attacks work, why they succeed and which Microsoft 365 settings actually stop them.

How does AiTM phishing work?

In a normal sign-in, the user enters a password and a second factor. Microsoft Entra ID then issues a session cookie so the browser does not have to ask again on every click. That cookie is what matters: whoever has it is signed in.

In adversary-in-the-middle phishing, the attacker places a reverse proxy between the victim and Microsoft. From the attacker’s side, it goes like this:

  1. The victim receives a convincing email and clicks a link to a domain the attacker controls.
  2. The proxy shows the real Microsoft sign-in page, including the company branding, because it fetches it live from Microsoft and passes it on.
  3. The victim enters the password and approves MFA, for example with a push notification in the Authenticator app. Microsoft sees a valid sign-in.
  4. Microsoft returns the session cookie to the proxy. The attacker copies it into their own browser.

To the victim, everything looked normal. To Microsoft as well, apart from details such as the IP address and browser of the later access. The second factor was not bypassed. The victim provided it on the attacker’s behalf.

What is device code phishing?

The device code flow is designed for devices without a keyboard, such as meeting room systems. The device shows a code, the user enters it on another device at a genuine Microsoft address and signs in there. The device then receives the tokens.

In a phishing attack, the attacker starts this flow and sends the victim the code, for example disguised as a meeting invitation. The victim signs in on the real Microsoft page, with real MFA. The tokens go to the attacker. Because the page is genuine, neither users checking the domain nor link filters help reliably.

Which sign-in methods actually protect you?

Phishing-resistant methods are those where the browser or operating system cryptographically includes the domain of the sign-in page in the authentication. A passkey for login.microsoftonline.com simply does not work on the attacker’s domain. Microsoft lists the following phishing-resistant methods in Entra ID:

MethodTypical useNote
Windows Hello for BusinessManaged Windows devices, personal workstationKey held in the device TPM
Passkeys in Microsoft AuthenticatorMobile staff, sign-in on the smartphoneDevice-bound, no hardware token needed
FIDO2 security keysAdministrators, shared devicesPhysical key, useful for emergency processes
Certificate-based authentication (CBA)Environments with PKI or smart cardsRequires a maintained certificate infrastructure
Platform Credential for macOSManaged MacsRequires device management

You enforce this with Conditional Access using the built-in authentication strength Phishing-resistant MFA. Start with administrators and accounts with access to payment processes, then roll out more widely. Our article on Conditional Access and passkeys describes how to make the switch without locking people out.

Against device code phishing, add a Conditional Access policy that blocks the device code flow under Conditions > Authentication flows. Microsoft recommends blocking it as completely as possible and allowing only documented exceptions, for example for certain Teams room devices.

Why does requiring a managed device help?

Conditional Access can require that the sign-in comes from a device marked as compliant or hybrid-joined to Entra. In an AiTM attack, the sign-in runs through the attacker’s server. That server cannot present the victim’s device identity, so the requirement fails and no session cookie is issued in the first place. A cookie replayed later also comes from a device Entra ID does not know.

For organisations using Intune, this is often the fastest effective step, because the devices are already managed. Personal devices need a deliberate decision: browser-only access with restrictions, or no access.

What does Token Protection do, and where does it stop?

Token Protection is a session control in Conditional Access. It only accepts sign-in session tokens that are cryptographically bound to the registered device. A copied token is useless on another device.

The status according to Microsoft Learn in November 2026:

  • For native applications on Windows, Token Protection is generally available. It protects Exchange Online, SharePoint Online and Teams, and on Windows also Azure Virtual Desktop and Windows 365.
  • On iOS, iPadOS and macOS, Microsoft also supports native apps but requires an MDM-managed device with the Enterprise SSO plug-in. The documentation does not state the Apple status consistently (generally available in one place, preview in another), so check it before you roll out. Apple’s native Mail and Calendar apps are not supported and are blocked when the policy is enforced.
  • For browser-based applications there is only a preview, limited to selected web apps that access Azure Resource Manager, such as the Azure portal.
  • The deployment guides list Microsoft Entra ID P1 as the licence requirement.

This leads to a clear conclusion: Token Protection protects desktop and mobile apps, not access to Outlook on the web or SharePoint in the browser. It does not replace phishing-resistant sign-in. Introduce it with a pilot group in report-only mode and review the sign-in logs before enforcing it.

What if a token has already been stolen?

Three mechanisms work together here.

Continuous Access Evaluation (CAE). Exchange Online, SharePoint Online and Teams subscribe to critical events from Entra ID: a disabled account, a changed password, revoked sessions, high user risk. Instead of waiting up to an hour for a token to expire, clients lose access within minutes. With location-based policies you can also prevent tokens from being used outside trusted networks.

Risk policies. Microsoft Entra ID Protection detects, among other things, “Anomalous token” and “Attacker in the Middle”. According to Microsoft, the latter requires Microsoft 365 E5 with Enterprise Mobility + Security E5, while the other premium detections require Entra ID P2. You configure policies based on sign-in and user risk in Conditional Access. The legacy policies configured directly in ID Protection were retired on 1 October 2026.

Revoking sessions. If you suspect a compromise: block the account, revoke all sessions under Users > Revoke sessions, and check registered MFA methods and inbox rules. For synchronised accounts, Microsoft also recommends resetting the password in on-premises Active Directory.

How can IT spot device code sign-ins?

The following query for Microsoft Sentinel or Log Analytics lists successful sign-ins using the device code flow. In most organisations the list should be short, and every unknown entry deserves a follow-up.

SigninLogs
| where TimeGenerated > ago(30d)
| where AuthenticationProtocol == "deviceCode"
| where ResultType == "0"
| project TimeGenerated, UserPrincipalName, AppDisplayName,
          IPAddress, Location = tostring(LocationDetails.countryOrRegion),
          DeviceDetail
| order by TimeGenerated desc

Before you block the flow, the same query serves as an inventory: it shows which tools or devices use it legitimately and need to be documented as exceptions.

What does this mean for management?

AiTM is not an exotic attack. It is available in off-the-shelf phishing kits. For management, this means the statement “we have MFA” no longer describes the level of protection adequately. In security questionnaires from customers and insurers, it is therefore worth stating the type of MFA, not just that it exists.

The costs lie less in licences than in the rollout. Conditional Access comes with Entra ID P1, which is included in Microsoft 365 Business Premium and E3. Passkeys in Microsoft Authenticator need no extra hardware. FIDO2 keys for administrators are a manageable item. The effort goes into planning, communication and exceptions.

Our recommendation: move administrators and finance processes to phishing-resistant methods first, block the device code flow and require managed devices in parallel, then extend to all users and add Token Protection for supported apps.

Next step

We test whether an AiTM attack would succeed in your tenant as part of a Microsoft 365 penetration test, conceptually and without singling out your staff. We implement the switch to phishing-resistant sign-in in a Conditional Access project.

Book an introductory call

Frequently asked questions

Does number matching in Authenticator protect against AiTM?

No. Number matching prevents users from accidentally approving someone else’s sign-in, for example during MFA fatigue attacks. In AiTM phishing, however, the sign-in is the victim’s own, just routed through a proxy. The victim matches the number correctly.

Are passkeys in Microsoft Authenticator really phishing-resistant?

Yes, Microsoft lists passkeys in Authenticator as a phishing-resistant method. The passkey is bound to the domain of the Microsoft sign-in and does not work on a proxy domain.

Do I need Token Protection if I already use phishing-resistant MFA?

It is a sensible addition for tokens stolen in other ways, for example by malware on an endpoint. Because it currently covers only native apps, it does not replace phishing-resistant sign-in.

What does the switch to phishing-resistant MFA cost?

Licence costs are often low, because Conditional Access is part of Entra ID P1 and passkeys in Authenticator need no hardware. The real costs come from planning, piloting and supporting staff.

Let's talk about your IT security

In the introductory call (30 minutes, no obligation) we clarify:

  • where your company stands today and what concerns you most
  • which next step makes sense for your organisation
  • what effort and price range to expect
Bastian Wenske

Bastian Wenske

Founder & Managing Director

Heidelberger Straße 15
12059 Berlin
Germany

Prefer to reach out directly? Send us an email at [email protected].