AiTM attacks: How attackers bypass MFA and how to stop them

by Chris Collier
AiTM attacks: How attackers bypass MFA and how to stop them

AiTM Attacks: How Attackers Bypass MFA

In short: Only MFA that is bound to the genuine domain stops AiTM phishing. FIDO2 security keys and passkeys sign a login only for the service they were registered with (relying party ID), and only when the browser is on the genuine address (origin). A proxy on a phishing domain therefore never obtains a login that the real service accepts.

An AiTM (adversary-in-the-middle) attack is an advanced form of credential theft in which attackers insert themselves between a user and a legitimate authentication service to intercept credentials and session tokens. This method allows attackers to bypass Multi-Factor Authentication (MFA), even when strong authentication mechanisms are in place. AitM attacks have evolved from the traditional Man-in-the-Middle attacks but incorporate more sophisticated approaches with even more malicious intent. These attacks present a significantly higher potential for severe damage. Typical targets are cloud accounts such as Microsoft 365 or Google Workspace. Ready-made phishing kits like Evilginx and Tycoon 2FA put these attacks within reach of less skilled criminals.

Man-in-the-Middle vs. Adversary-in-the-Middle Attacks

Both Man-in-the-Middle (MitM) and Adversary-in-the-Middle (AitM) attacks involve an attacker intercepting communication between two parties, but they differ in their execution, scope, and primary targets. We’ll explore some of these differences to establish a comparison of both methods and their unique objectives.

Man-in-the-Middle Attack

A MitM attack occurs when an attacker secretly intercepts and possibly alters communication between two parties without their knowledge. The attacker can passively eavesdrop or actively manipulate the data being exchanged.The attacker intercepts the data being transferred between two communicating parties (i.e. the user and a website or the client and a server). The primary goals of an MitM attack are to steal credentials, session cookies or other sensitive information that can then be manipulated.

Adversary-in-the-Middle Attack 

An AiTM attack goes after the sign-in itself. The attacker runs a convincing copy of the login page as a reverse proxy that forwards every input to the real service in real time. The user appears to sign in normally and even confirms the second factor. In the end, the attacker holds a valid session token.

How an AiTM attack unfolds:

1.   The user receives a phishing email or QR code that links to an address resembling the real login page.

2.   The proxy displays the genuine sign-in page and passes username, password and MFA code through to the service.

3.   After the successful sign-in, the service issues a session cookie.

4.   The proxy captures this cookie. The attacker loads it into their own browser and is signed in.

MitM vs. AitM: What’s the Difference?

Man-in-the-Middle (MitM) Adversary-in-the-Middle (AiTM)
Target
General network communication
Authentication sessions (MFA)
Technique
Intercepts and manipulates traffic
Acts as a proxy between user and authentication service
Objective
Data theft, manipulation, espionage
MFA bypass, session hijacking
Execution
Network-level attack
Web-based phishing attack
Mitigation
Encryption (TLS, VPN, HTTPS), network security
Phishing-resistant MFA, token binding, conditional access

Why MFA Doesn't Stop AiTM Attacks? 

MFA is a one-time barrier; therefore, once the attacker gains a session token, they no longer need to perform MFA. As the session is already hijacked, full access to the application is granted for the duration of the session. The attacker may continue to reuse the stolen session token to access the user’s account until the session expires, or the user logs out of the application.

This applies to every method in which the user types in or approves something that can be passed on:

MFA methodStops AiTM?Why
SMS code
No
The user types the code into the proxy page, and the attacker forwards it immediately.
One-time code from an authenticator app
No
The code is usually valid for 30 seconds. That is enough time to relay it.
Push approval
No
The user approves a real sign-in that runs through the proxy.
Push with number matching
No
Prevents accidental approvals, but not a real-time proxy.
FIDO2 security key or passkey
Yes
The signature is only valid for the genuine domain. The proxy never receives a valid response.

This is why the US agency CISA classifies only FIDO/WebAuthn and PKI-based methods such as smart cards as phishing-resistant.

How FIDO2 Does Prevents AiTM Attacks 

FIDO2/WebAuthn uses phishing-resistant methods that bind authentication to the device. No reusable secrets such as passwords or codes are transmitted, and the signature is only valid for the genuine domain. A sign-in through the proxy therefore fails, and the attacker never obtains a session token. The attacker also cannot generate a valid response without the legitimate device. Therefore, session hijacking, a key part of AiTM attacks, becomes ineffective.

FIDO2 uses public-key cryptography in four steps:

  1. A private key is securely stored on the FIDO2 authenticator, such as a hardware security key.
  2. A public key is registered with the website or service.
  3. During login, the website sends a challenge to the user’s device.
  4. The user’s FIDO2 authenticator signs the challenge using the private key, and only for the domain it was registered with.

Even if an attacker does successfully intercept and relay an authentication request, they cannot steal the private key because it never leaves the user’s device. Each device generates a unique private key per website. An attacker cannot export or transfer these keys to another device. This applies to device-bound passkeys, for example on a hardware security key. Our article on passkeys for enterprises passkeys for enterprises explains how they differ from synced passkeys.

Why an AiTM proxy never gets a valid FIDO2 login

The protection comes from three bindings that are checked at every FIDO2 login:

  • Origin: the address actually opened, made up of scheme, host and port, for example https://login.example.com. The browser writes it into the signed login data itself. A phishing page cannot fake it.

  • Relying party ID (RP ID): the domain of the service the passkey was registered for. The browser only allows the login if the opened address belongs to that domain.

  • Challenge: a one-time random value from the server. It makes every signature unique, so an intercepted response cannot be reused.

How the login fails through the proxy

  1. The phishing link takes the user to the attacker’s page, for example login-example.co instead of login.example.com.

  2. The proxy requests a challenge from the real service and passes it on to the browser.

  3. The browser sees that the opened address does not belong to the service’s registered domain. There is no matching passkey for the phishing domain, so the key signs nothing.

  4. Even if a signature were created, it would contain the wrong origin. The real service checks challenge, origin and RP ID and rejects the login.

  5. Without a valid login, the service issues no session token. The attacker has nothing to hijack.

Note the limit of this protection: binding to origin and RP ID prevents an attacker from relaying the login. It does not protect a session token that has already been stolen in another way, for example by malware on the device. That requires the additional measures in the next section.

Choosing a FIDO2 security key for your organization? Our comparison of the iShield Key 2 and YubiKey 5 covers the key criteria: passkey storage, FIPS 140-3, firmware updates, access control and supply chain.

Additional Mitigation Techniques

  • Implement conditional access policies to restrict logins based on device trust, geolocation, and behavioral analytics.
  • Implement token binding whereby session tokens are always bound to a specific device.
  • Monitor for anomalous sessions to detect and terminate suspicious logins  from unknown locations or devices. Monitor for session token reuse
  • Deploy network-based protections that leverage TLS inspection and zero-trust security models to detect AitM proxies.
  • Implement email authentication protocols (DMARC, DKIM, SPF) to prevent spoofing. All three check whether an email really comes from the domain it claims to come from.

Conclusion

MitM attacks represent a broad category of methods that specifically target network communications, while AitM phishing attacks provide a more refined approach, specifically designed to hijack authentication processes and allow attackers to bypass MFA.

Organizations should use both network security measures for MitM defense and adopt phishing-resistant authentication methods that prevent MFA bypass. Enterprise security strategies that implement FIDO2 passwordless authentication will protect against these threats, as AiTM techniques evolve.

One example is the Swissbit iShield Key 2. It supports FIDO2/WebAuthn, works via USB-A, USB-C or NFC and is also available as a FIPS 140-3 Level 3 version.

AiTM Attacks: Frequently Asked Questions

A man-in-the-middle attack eavesdrops on or alters general network traffic. An AiTM attack targets the sign-in: a fake login page forwards everything to the real service and then captures the session token.

No. SMS codes, one-time codes from apps and push approvals can be relayed through a proxy. FIDO2 security keys and passkeys only sign for the genuine domain, so the sign-in through the fake page never completes.

Not reliably. The user enters the code on the phishing page, and the attacker uses it right away. Number matching for push requests helps little here, because the sign-in really does take place.

A typical sign is a login from an unknown location shortly after the user’s regular sign-in. Another is the same session token showing up on two devices. Many identity providers flag these patterns as risky sign-ins.

It checks that the challenge is its own, that the origin matches the genuine address, that the RP ID belongs to the registered domain and that the signature matches the stored public key. Only if everything matches is the login accepted.

A passkey is bound to the domain it was registered for. On a different domain, the browser does not offer it, and a signature for the genuine domain cannot be created there.

No. FIDO2 prevents attackers from capturing the login through a proxy. A cookie stolen from the device, for example by malware, needs short session lifetimes, token binding and conditional access.

Sources

CISA: Implementing Phishing-Resistant MFA (fact sheet, 2022), cisa.govNIST SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management (2025), pages.nist.gov

  • CISA: Implementing Phishing-Resistant MFA (fact sheet, 2022), cisa.gov

  • NIST SP 800-63B-4: Digital Identity Guidelines, Authentication and Authenticator Management (2025), pages.nist.gov

  • FIDO Alliance: Passkeys, fidoalliance.org/passkeys

  • W3C: Web Authentication Level 2, relying party identifier and origin, w3.org/TR/webauthn-2

Does that sound interesting to you?

Want to test phishing-resistant MFA in your organization?

Chris Collier

As a dedicated technologist and advocate for all things related to Identity, Chris Collier is responsible for Technical Product Marketing and Business Development at Swissbit. With a 20-year background in technical product marketing and management, Chris helps organizations design, deploy, and manage complex issues associated with the complexities of IAM (identity and access management).

Today’s technologies for SSO, MFA, PAM and, IGA (single sign-on, multi-factor authentication, privileged access management, identity governance and administration) are growing ever more complex. Chris has first-hand experience and understands the pain associated with managing multiple cutting-edge and legacy technologies that serve the same purpose, but are not compatible with each other, nor are they compatible with an organization’s needs. Follow him on LinkedIn.

Visit us:

Stay in touch with Swissbit

Receive the latest news. The Swissbit newsletter will keep you updated regularly on exciting news about storage and security solutions, as well as current events and new products.

About Swissbit

We provide industry-leading data storage and security solutions that ensure reliable storage, data protection, and secure access for critical applications. This enables our customers to accelerate digital transformation across various industries.