Man-in-the-Middle Attack
Also known as: MITM attack, Adversary-in-the-middle attack, On-path attack
Attack in which an adversary secretly positions themselves between two communicating parties to intercept, read or alter the traffic between them.
In a man-in-the-middle (MITM) attack, an adversary inserts themselves into a communication channel so that each party believes it is talking directly to the other, while the attacker relays, observes and potentially modifies the messages. The same idea is also called an adversary-in-the-middle or on-path attack. Depending on what is exposed, an attacker can steal passwords and session cookies, read private data, inject malicious content into web pages and downloads or tamper with transactions such as payment details.
Interception becomes possible when an attacker controls or can influence part of the path between two endpoints: a rogue Wi-Fi access point, a compromised router, manipulated local network address resolution or falsified DNS responses. Without encryption and proper authentication, the attacker can read everything. Even encrypted connections can be intercepted if certificate validation is skipped, a fraudulent certificate is trusted or users click through browser warnings. A related technique, adversary-in-the-middle phishing, relays a real login page through an attacker's server to capture one-time codes and session tokens.
The main defense is authenticated encryption from end to end. TLS with correct certificate checking, enforced through HTTPS and HTTP Strict Transport Security, prevents most interception on the web, while end-to-end encryption with verified keys protects messages even from the servers that carry them. Phishing-resistant authentication such as passkeys defeats relayed logins because credentials are bound to the genuine domain. On untrusted networks, heeding browser warnings, keeping devices updated and, where appropriate, using a VPN reduce exposure. Organizations also use certificate pinning in apps and monitor their networks for rogue devices.
Key points
- An attacker in the middle relays traffic between two parties who believe they are connected directly.
- Rogue Wi-Fi, compromised routers and falsified DNS responses can give attackers an on-path position.
- Properly validated TLS and end-to-end encryption defeat most interception attempts.
- Phishing-resistant authentication stops relay attacks that capture one-time codes and session tokens.
Related entries
Transport Layer Security
Cryptographic protocol that encrypts and authenticates data sent between applications over a network, most visibly securing web traffic as HTTPS.
HTTPS
Secure version of the web's HTTP protocol that encrypts and authenticates traffic between browsers and websites using Transport Layer Security.
Certificate Authority
Trusted organization that issues digital certificates binding public keys to identities such as domain names, forming the basis of trust for HTTPS.
End-to-End Encryption
Communication method in which only the sender and intended recipients can decrypt messages, so that servers and intermediaries cannot read their content.
Packet Sniffing
Capturing and inspecting data packets as they travel across a network, used by administrators for troubleshooting and by attackers for eavesdropping.
Virtual Private Network
Technology that creates an encrypted tunnel between a device and another network, protecting traffic on untrusted links and connecting remote users securely.
Passkey
Passwordless login credential based on public-key cryptography and FIDO standards that is stored on a device and cannot be phished or reused across sites.
Encrypted DNS
Methods such as DNS over HTTPS and DNS over TLS that encrypt domain name lookups, hiding them from eavesdroppers on the network path.
Referenced by
Other entries that discuss or point to Man-in-the-Middle Attack.