Skip to main content

Man-in-the-Middle (MITM) Attacks Explained

About 2 min read

A man-in-the-middle attack (MITM) is an attack technique in which an attacker inserts themselves between two parties who are communicating, eavesdropping on and tampering with the contents of their communication. Because the attacker impersonates a legitimate communication partner to both sides, the victims find it difficult to notice that they are under attack. It is abused to steal passwords and session information, and on communication that is not encrypted, the attacker reads the contents as they are.

A Takeover Can Happen Without the Password Ever Being Known

What a man-in-the-middle attack steals is not limited to credentials such as passwords. If communication after login is intercepted, the session cookie or token that the server issues to identify the user can itself fall into the attacker's hands. Because these act as proof of identity for after the login procedure has been completed, the attacker can operate the service as the victim without ever knowing the password and without having to pass two-factor authentication. What makes this damage troublesome is that changing the password alone may not stop it: as long as the stolen session remains valid, the takeover continues, so the response must include invalidating the session itself (forcibly logging out all devices). Beyond hardening the login step, preventing session information from being intercepted through encryption of the communication channel is a precondition for preventing this kind of takeover.

Normal Communication Compared with a Man-in-the-Middle Attack

Normal path
User
HTTPS connection with a verified certificate
The traffic is encrypted, so login information is not intercepted in plaintext along the way
Legitimate server
Compromised path
User
Attacker who has cut in
Cuts into the traffic with a fake Wi-Fi access point or with ARP or DNS spoofing, and poses as the legitimate counterpart to both sides
Without HTTPS it reads login information in plaintext, and with SSL stripping it downgrades the HTTPS connection to HTTP in order to read it
Steals the session cookie and tampers with the contents of the communication
Legitimate server
How the attacker cuts inWhat the attacker gainsDefense that works
Getting the user to connect to a fake Wi-Fi access point with the same nameAll traffic that passes through that pathUse a VPN on public Wi-Fi
ARP spoofing and DNS spoofingThe position to redirect the destination of the traffic to itselfDo not ignore the certificate warnings in the browser
SSL stripping (downgrading HTTPS to HTTP)Login information in plaintextAlways verify that the connection is HTTPS
Stealing the session cookieHijacking of an already logged-in sessionConnect through the corporate VPN and invalidate suspicious sessions
Interception of the passwordAn attempt at unauthorized loginSet up two-factor authentication in advance

Attack Methods

Representative methods include ARP spoofing on public Wi-Fi, DNS spoofing, and setting up fake Wi-Fi access points. On communication that does not use HTTPS, there is a risk that login information is intercepted in plaintext. In an SSL stripping attack, an HTTPS connection is downgraded to HTTP in order to intercept the communication.

Concrete Damage Scenarios

The idea that "a man-in-the-middle attack is impossible on an HTTPS site" does not hold. "SSL inspection," in which a corporate proxy server decrypts and examines SSL/TLS communication, has the same structure, since it sits between the two parties and decrypts the traffic. Also, when you connect to free Wi-Fi at a café, if an attacker has set up a fake access point with the same name, you connect to the fake Wi-Fi without noticing, and your traffic passes through the attacker's device.

Defensive Measures

Countermeasures include verifying the HTTPS connection and using a VPN on public Wi-Fi. In addition to a strong random password, if you set up two-factor authentication, an intercepted password alone is less likely to be enough for an unauthorized login.

Was this article helpful?

Related Terms