Hard2bit
← Back to blog

Microsoft 365 Account Takeover: How Attackers Bypass MFA with AiTM and Token Theft

By Adrián González · CEO · Published: 05 June 2026 · Updated: 05 June 2026
AiTM reverse proxy intercepting Microsoft 365 authentication and stealing ESTSAUTH session cookie despite MFA

If your organisation still believes that having Microsoft Authenticator or SMS-based MFA makes it immune to Account Takeover (ATO), there's a problem. Hard2bit's DFIR teams are responding weekly to critical intrusions in Microsoft 365 tenants where MFA was bypassed in seconds — not because MFA failed, but because attackers walked around it entirely.

The technical reality is uncomfortable: attackers no longer try to guess passwords or break MFA algorithms — they simply sidestep them. This article dissects, at the protocol level, how modern Adversary-in-the-Middle (AiTM) attacks use reverse proxies (Evilginx2, Muraena, Modlishka) to relay sessions and capture authentication cookies. We then look at what happens after compromise, how to detect AiTM in Sentinel with KQL, and the strategic mitigation that actually works: phishing-resistant MFA with FIDO2, channel binding, conditional access and continuous access evaluation.

The evolution of phishing: Adversary-in-the-Middle (AiTM) and reverse proxies

Static phishing (cloning a login HTML and harvesting credentials) is useless against MFA. To bypass it, cybercrime has adopted reverse-proxy architectures built with frameworks like Evilginx2, Muraena and Modlishka.

Reverse-proxy architecture: how the attack actually works

In an AiTM attack the attacker's server interposes itself dynamically between the victim and login.microsoftonline.com. There's no pre-rendered fake page — the proxy is acting as a transparent man-in-the-middle in real time.

  1. TLS termination and SNI: the attacker's proxy terminates the TLS connection with the victim's browser using a valid SSL certificate (usually Let's Encrypt, on a typo-squatted domain like login.micros0ft-security.com).
  2. Transparent proxying: simultaneously, the proxy opens a legitimate connection to Microsoft. It acts as a perfect man-in-the-middle, rewriting links on the fly (modifying DOM and HTTP headers) so the victim interacts with the real Microsoft server through the attacker's infrastructure.

Hard2bit tip: if you want to evaluate whether your current infrastructure is vulnerable to reverse-proxy tactics, consider an advanced cybersecurity audit that simulates these vectors in a controlled environment.

Anatomy of token theft (Pass-the-Cookie)

The attacker's real target is not the password — it's the trust artefact Microsoft issues after a successful authentication: the session cookie.

JWT, ESTSAUTH and the difference with PRT

When the user enters their password and approves the MFA prompt on their phone, Entra ID issues a series of tokens based on JSON Web Tokens (JWT).

On managed devices, Windows uses a Primary Refresh Token (PRT), which is strongly hardware-bound to the device's TPM via cryptography. But at the web-browser layer, the session is maintained through standard cookies — primarily ESTSAUTH and ESTSAUTHPERSISTENT.

As these cookies pass through the attacker's reverse proxy in cleartext (inside the TLS terminated by the attacker), they are intercepted before reaching the victim.

# Simplified traffic capture on the attacker's server:
HTTP/1.1 200 OK
Set-Cookie: ESTSAUTH=0.AT8A_...[JWT_Payload_Truncated]...; domain=.login.microsoftonline.com; secure; HttpOnly

Once the attacker exports this cookie and injects it into their own browser, they inherit the user's identity and MFA state. From Entra ID's perspective the session has already been validated, so it grants immediate access to SharePoint, Exchange Online or Teams without prompting again.

Post-exploitation: persistence and evasion in Entra ID

Once inside, the clock is ticking. Attackers know the ESTSAUTH cookie has a limited lifetime, so their first move is to guarantee continuous access.

Abusing the Microsoft Graph API and mailbox manipulation

The attacker typically accesses Outlook on the Web (OWA) or uses scripts that interact directly with the Microsoft Graph API to:

  1. Data exfiltration: rapid keyword search across the mailbox (password, invoice, IBAN, confidential).
  2. Hiding rules: creating inbox rules to move any security alert email or customer reply to Deleted Items or RSS Feeds, blinding the victim.
  3. Registration of a new MFA device: adding an attacker-controlled device at mysignins.microsoft.com, allowing future authentication even if the password is changed or the cookie expires.

Forensic detection: tracking AiTM in Microsoft Entra ID sign-in logs

Detecting an AiTM attack requires sharpening monitoring of Microsoft Entra ID sign-in logs. Don't look for failed logins — the danger is in successful logins with anomalous context.

If you use Microsoft Sentinel or another SIEM, search for these patterns using KQL (Kusto Query Language):

  • SessionId analysis: look for the same SessionId that jumps suddenly from one IP address (the victim's) to a different IP or a different ASN (the attacker injecting the cookie) within a short time window.
  • User-Agent mismatches: abrupt browser changes within the same authenticated session.
  • Account update events: monitor audit events like Update user or Add registered security info immediately after a sign-in from an unusual IP.

// Basic KQL example to detect IP changes within the same session
SigninLogs
| where ResultType == 0
| summarize IPCount = dcount(IPAddress), make_set(IPAddress) by SessionId, UserPrincipalName
| where IPCount > 1

Strategic mitigation: real defences against AiTM

The traditional approach no longer works. To protect your Microsoft 365 tenant you have to implement a solid Zero Trust architecture. From Hard2bit's Microsoft 365 security practice, we recommend two foundational pillars:

1. Conditional Access policies and Continuous Access Evaluation (CAE)

Context is everything. Configure strict policies in Entra ID to limit from where and with what access is allowed:

  • Compliant devices: require that Office 365 access only happens from devices enrolled in Microsoft Intune and meeting corporate health policies. The attacker will have the cookie, but their laptop won't be in your Intune.
  • Continuous Access Evaluation (CAE): enable CAE so token revocation happens near real-time if a critical change is detected (abrupt IP change, user disabled).

2. Phishing-resistant MFA (FIDO2 and Passkeys)

The definitive cryptographic solution. Replace SMS codes and app prompts with hardware security keys (FIDO2/YubiKeys) or Windows Hello for Business.

These standards use Channel Binding. The cryptographic signature of the authentication is bound to the real domain name (login.microsoftonline.com). If the victim is on the attacker's proxy (micros0ft-security.com), the cryptographic challenge fails at the protocol level — there is no possible way for the proxy to relay it. For more context on this control class, our passkey glossary entry explains the underlying mechanism.

Your next step in security

False sense of security is the biggest enemy of any organisation. Account takeover in Microsoft 365 via AiTM and token theft is a daily, silent, highly effective threat. Solving it doesn't require magic — it requires a defence-in-depth architecture: phishing-resistant authentication, strict context-aware access, fine-grained monitoring and a clear incident response plan when something does happen.

If you're not sure whether your current Entra ID configuration would resist an Evilginx2 attack, or if you suspect you may have suffered a silent breach, don't wait for the damage to become irreversible.

Talk to a Hard2bit expert today. We'll analyse the security posture of your tenant, tune your Conditional Access policies and harden your corporate identity against next-generation threats.

_Disclaimer: The threats and detections described in this article must be assessed in the context of each organisation's stack and configuration. KQL queries shown are simplified examples for illustration — production detection requires tuning, baselining and correlation across multiple sources. This article is informational and does not replace a formal compliance assessment or a hands-on technical audit._

Frequently asked questions

What is Account Takeover (ATO) in Microsoft 365?

Microsoft 365 Account Takeover (ATO) is the compromise of a corporate Entra ID account that gives an attacker access to a user's email, SharePoint files, OneDrive, Teams chats and any SaaS app federated through Entra ID. Modern ATO rarely involves password guessing — it usually starts with phishing or AiTM (Adversary-in-the-Middle) reverse-proxy attacks that capture authentication session cookies (ESTSAUTH), letting the attacker bypass MFA without ever knowing the password.

Why doesn't traditional MFA stop AiTM attacks?

Traditional MFA methods (SMS codes, Microsoft Authenticator push, TOTP) protect the moment of authentication but not the resulting session. In an AiTM attack the user actually completes MFA correctly — the problem is that the attacker's reverse proxy sits between user and Microsoft, transparently relaying the entire flow and capturing the session cookie at the end. From the user's perspective everything looks normal. From Entra ID's perspective the session was validated. The attacker walks away with a working session cookie that grants full access.

How can I detect AiTM attacks in Microsoft Entra ID?

Focus on successful sign-ins with anomalous context, not failed ones. Key detection signals in Sentinel/KQL: same SessionId appearing from multiple IPs or ASNs in a short window, abrupt User-Agent changes within an authenticated session, sign-ins from unusual locations followed by Add registered security info or Update user audit events. Also valuable: monitoring for sign-ins flagged as risk-based detections by Entra ID Identity Protection and correlating them with Outlook on the Web mailbox rule creation events.

Does FIDO2 / Passkeys really prevent AiTM?

Yes — and this is the key strategic answer. FIDO2 and Passkeys use channel binding: the cryptographic challenge is tied to the real origin (login.microsoftonline.com). If the user is interacting with an attacker's proxy on a different domain (login.micros0ft-security.com), the cryptographic exchange simply fails because the origin doesn't match. There is no possible way for the proxy to relay the challenge correctly. This is fundamentally different from MFA methods that produce a code or approval that can be relayed.

What is Continuous Access Evaluation (CAE) and why does it matter?

Continuous Access Evaluation (CAE) is an Entra ID capability that allows near real-time revocation of tokens when critical changes occur: user disabled, password reset, IP change deemed risky, location anomaly. Without CAE, even after you detect a compromise it can take up to an hour for token revocation to take effect because Microsoft Graph and other services cache the token validity. With CAE properly configured, an attacker holding a stolen cookie can be cut off in seconds rather than 60+ minutes.

What should I do if I suspect a Microsoft 365 account compromise?

Act immediately and in this order: revoke all active sessions for the affected user (Entra ID admin centre or PowerShell Revoke-AzureADUserAllRefreshToken), reset the password, force re-authentication on all devices, audit recent sign-in logs for unusual IPs, check for new MFA device registrations, review inbox rules for hidden forwarding or deletion rules, audit Microsoft Graph API consent grants, and check for new OAuth application authorisations. If exfiltration is suspected, activate your incident response procedure — Hard2bit's DFIR team can provide rapid containment and forensic analysis.