Web Development

Adversary-in-the-Middle (AiTM): Definition & Defense

Analyze how Adversary-in-the-Middle (AiTM) attacks use reverse proxies to bypass MFA. Identify session hijacking risks and implement FIDO2 defenses.

Adversary-in-the-Middle (AiTM) is a cyberattack where a perpetrator inserts themselves into the communication stream between two parties, such as a user and a web application, to intercept or manipulate data. Unlike traditional phishing, this method uses a reverse proxy to mirror legitimate sites in real time, making it one of the few ways attackers can bypass multi-factor authentication (MFA). Understanding AiTM is critical for digital professionals because it allows criminals to hijack active sessions and perform financial fraud even on "secured" accounts.

What is Adversary-in-the-Middle (AiTM)?

Adversary-in-the-Middle, also called Man-in-the-Middle (MitM), occurs when an unauthorized party positions themselves between two users, two devices, or a user and a server. This placement ensures all communications go through the attacker's controlled system. While "Man-in-the-Middle" is a common industry term, the MITRE ATT&CK framework uses Adversary-in-the-Middle as the official designation for this technique.

In a modern AiTM phishing scenario, the attacker does not build a fake version of a website. Instead, they use a proxy server to relay requests and responses between the victim and the actual legitimate website. This allows the attacker to capture sensitive data, like login credentials and session cookies, as they pass through the proxy in real-time.

Why Adversary-in-the-Middle (AiTM) matters

AiTM attacks represent a shift toward more industrial and effective cybercrime. They are particularly dangerous for the following reasons:

  • MFA Bypass: Because the attacker intercepts the actual session cookie after a user successfully authenticates, they skip the MFA process entirely.
  • Scale of Impact: These attacks are not isolated incidents. Microsoft 365 Defender detected AiTM campaigns targeting more than 10,000 organizations.
  • Speed of Execution: Attackers often act within minutes of stealing a session cookie to launch fraudulent activities.
  • Lower Entry Barrier: Criminal actors like DEV-1101 develop and rent out AiTM phishing kits, allowing less technical criminals to execute sophisticated attacks.
  • Financial Loss: A primary goal is Business Email Compromise (BEC), where attackers manipulate finance-related email threads to redirect payments to their own accounts.

How Adversary-in-the-Middle (AiTM) works

The attack typically follows a sequence designed to capture a "session token" that proves the user is already logged in.

  1. Traffic Redirection: The attacker uses protocol manipulation (like ARP or DNS) to force the victim's device to communicate through the attacker's system.
  2. Reverse Proxy Deployment: The attacker sets up a proxy server using tools like Evilginx2, Modlishka, or Muraena.
  3. Real-time Interception: When the user enters their credentials on the proxy site, the proxy sends those details to the real site.
  4. Token Theft: Once the user completes the MFA on the real site, the real site sends a session cookie back. The attacker intercepts this cookie.
  5. Session Hijacking: The attacker injects the stolen cookie into their own browser, gaining full access to the account without needing a password or MFA code.

Best practices

To protect organizational assets and data from AiTM attacks, practitioners should implement these defense layers:

  • Use phishing-resistant MFA: Adopt FIDO2 or WebAuthn authentication. Since these methods bind authentication to a specific device, attackers cannot reuse stolen credentials or tokens.
  • Apply conditional access: Restrict account logins based on trusted device status, specific geolocations, or behavioral analytics.
  • Monitor for session anomalies: Look for session tokens being used from unknown locations or multiple IP addresses simultaneously.
  • Implement Token Binding: Use technologies that bind session tokens to a specific device so the token becomes useless if stolen and moved to an attacker's machine.
  • Deploy TLS inspection: Use network-based protections that can detect the presence of AiTM proxies within the traffic flow.

Common mistakes

  • Mistake: Believing that standard MFA (like SMS or App codes) provides absolute protection. Fix: Recognize that AiTM proxies can capture these codes or the resulting session cookies.
  • Mistake: Only monitoring for failed login attempts. Fix: Monitor for successful logins followed by suspicious "post-breach" activities, such as changing inbox rules or data enumeration.
  • Mistake: Ignoring internal email security. Fix: Implement DMARC, DKIM, and SPF to prevent attackers from spoofing internal communications during a BEC phase.
  • Mistake: Slow response times. Fix: Use automated disruption tools. Attackers often launch financial fraud within minutes of a cookie theft.

AiTM vs Man-in-the-Middle (MitM)

While often used interchangeably, these terms have different focuses in a security context.

Feature Man-in-the-Middle (MitM) Adversary-in-the-Middle (AiTM)
Primary Goal Eavesdropping or data alteration Hijacking authentication and bypassing MFA
Common Method Passive network sniffing or data manipulation Active reverse proxying of phishing sites
Outcome Stolen credentials or altered messages Session hijacking and Business Email Compromise
Target Network communications Web-based authentication processes

Rule of thumb: MitM is a broad category targeting network traffic, while AiTM is a refined, modern approach specifically designed to defeat MFA and hijack web sessions.

FAQ

Can AiTM attacks bypass hardware security keys? If the key follows FIDO2 standards, it is generally resistant to AiTM. FIDO2 uses public-key cryptography where the private key never leaves the device. The attacker cannot generate a valid response to an authentication challenge without the physical device.

What happens after an attacker steals a session cookie? The attacker gains immediate access to the authenticated session. In many cases, Microsoft reported attackers used this access to perform Business Email Compromise (BEC), manipulating finance-related emails to redirect payments.

How do I detect an AiTM attack in progress? Look for "risky sign-ins" where a user connects to a known phishing URL and then successfully signs in from a different network device or IP. High-confidence identification of AiTM kits can trigger automatic account disruption.

Is AiTM the same as a normal phishing website? No. A normal phishing site is a fake copy of a website. An AiTM attack uses a reverse proxy to show the user the actual website they are trying to visit, making it much harder to detect visually.

Which tools do attackers use for these attacks? Commonly used open-source tools include Evilginx2, Modlishka, and Muraena. These are often bundled into kits and sold to other cybercriminals.

Start Your SEO Research in Seconds

5 free searches/day • No credit card needed • Access all features