What is a man-in-the-middle attack?
A man-in-the-middle (MITM) attack is a cyberattack in which an attacker puts themselves between two parties, typically a user and an application, to intercept or alter their communications. The user thinks they're interacting directly with a trusted site and, without knowing it, hands over login credentials, financial information or other sensitive data.
Attackers either listen in on the connection or impersonate one side, for example, with a spoofed website. What they capture can let them take over accounts, steal money or gain access to an organization's network, and a stolen credential or session can be the first step in a larger attack. Industry sources also refer to this as an on-path attack or, in its phishing form, an adversary-in-the-middle (AITM) attack.
How a man-in-the-middle attack works
A MITM attack has two stages:
- Interception. The attacker gets between the user and the service, for example by setting up a fake Wi-Fi hotspot, joining a poorly secured network, spoofing DNS or Address Resolution Protocol (ARP) so traffic passes through their device, or sending a phishing link to a lookalike site.
- Getting to readable data. Most web traffic is encrypted with Transport Layer Security (TLS), and attackers rarely break that encryption. They go around it instead: by downgrading the connection to unencrypted HTTP, by presenting a certificate the user's device trusts, or by proxying the real site so the user signs in through the attacker, who captures the password and session cookie.
With credentials or a session in hand, the attacker can sign in as the user.
Types of man-in-the-middle attacks
Common types of MITM attacks include:
- ARP and IP spoofing. On a local network, the attacker forges address information so traffic meant for a router or server reaches them first.
- DNS spoofing. The attacker corrupts DNS responses so that a trusted domain name redirects users to a fake site.
- SSL stripping. The attacker downgrades a connection from HTTPS to HTTP so traffic travels unencrypted.
- HTTPS spoofing. The attacker uses a lookalike domain, sometimes with a valid certificate, so the padlock still appears.
- TLS interception. Also called SSL hijacking, this uses a proxy that presents like a certificate the user's device trusts, so the attacker can read encrypted traffic.
- Wi-Fi eavesdropping. The attacker sets up a hotspot that appears to be a trusted network and intercepts traffic from anyone who connects.
- Email hijacking. The attacker takes over an email account, such as one at a bank, to watch transactions and send false payment instructions.
- Session hijacking. The attacker steals the session cookie or token that proves a user is signed in, then uses it to act as that user.
What is adversary-in-the-middle phishing?
Adversary-in-the-middle (AITM) phishing is a modern form of MITM attack. The attacker runs a proxy site between the user and the real sign-in page. It passes along everything the user enters, including multi-factor authentication (MFA) prompts, and captures the password and the session cookie the real service returns. With that cookie, the attacker can sign in as the user without having to complete MFA again.
This isn't a flaw in MFA itself. One-time codes and push approvals can be linked via a proxy, but phishing-resistant methods, such as FIDO2 security keys and passkeys, are tied to the real site and won't work on a lookalike. Phishing kits sold to cyber criminals make AiTM attacks easier to run.
Examples of man-in-the-middle attacks
Two well-documented cases show how these attacks work in practice:
- AITM phishing campaign (2021-2022). Microsoft reported in July 2022 that an AITM phishing campaign had targeted more than 10,000 organizations since September 2021. Attackers used proxy phishing sites to steal passwords and session cookies, signed in to users' mailboxes even when MFA was enabled and then attempted business email compromise.
- Lenovo and Superfish (2014-2015). Lenovo shipped some laptops with Superfish adware that installed its own root certificate to insert ads into encrypted web pages. Because every affected laptop used the same certificate key, anyone who extracted it could intercept those users' HTTPS traffic. The problem was disclosed in 2015.
How to detect man-in-the-middle attacks
Early detection limits the damage. Warning signs include:
- Certificate warnings. An unexpected certificate error, or a missing padlock on a site that normally uses HTTPS.
- Lookalike addresses. Small changes to a website or email address, such as swapped or added characters.
- Unexpected sign-ins. A sign-in or active session from a new device, location or network, which can signal a stolen session.
- Suspicious networks. A Wi-Fi network labeled "unsecured," or one that copies the name of a known network.
- Unusual network activity. Spoofed addresses or unexpected traffic paths flagged by network monitoring.
How to prevent man-in-the-middle attacks
Preventing MITM attacks takes several layers of protection:
- Enforce HTTPS. Serve sites over HTTPS with HTTP Strict Transport Security, keep certificates valid and train users not to click through certificate warnings.
- Use phishing-resistant MFA. Require FIDO2 security keys or passkeys, especially for administrators and other high-risk accounts, because one-time codes and push approvals can be relayed.
- Protect sessions. Shorten session lifetimes, tie sessions to a device where possible and revoke sessions when a sign-in looks suspicious.
- Limit what a stolen session can do. Use Privileged Access Management (PAM) to enforce least privilege access, require additional verification for sensitive actions, and grant elevated access just-in-time instead of leaving it standing.
- Be careful on untrusted networks. A VPN encrypts traffic on public Wi-Fi, but it doesn't protect against a lookalike site or a stolen session.
- Secure email and certificates. Use S/MIME to encrypt and sign email, and manage certificates so expired or unknown certificates get caught.
More resources
Blogs
When identity controls become the attack surface
Credential misuse at scale is now the default