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
| How the attacker cuts in | What the attacker gains | Defense that works |
|---|---|---|
| Getting the user to connect to a fake Wi-Fi access point with the same name | All traffic that passes through that path | Use a VPN on public Wi-Fi |
| ARP spoofing and DNS spoofing | The position to redirect the destination of the traffic to itself | Do not ignore the certificate warnings in the browser |
| SSL stripping (downgrading HTTPS to HTTP) | Login information in plaintext | Always verify that the connection is HTTPS |
| Stealing the session cookie | Hijacking of an already logged-in session | Connect through the corporate VPN and invalidate suspicious sessions |
| Interception of the password | An attempt at unauthorized login | Set 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
- SQL Injection - How Attackers Exploit DatabasesSQL injection inserts malicious queries through input fields to read or modify database records. Learn parameterized queries and other defenses.
- Tokenization - Replacing Sensitive Data with TokensTokenization swaps credit card numbers and other sensitive data with substitute tokens. See how it differs from encryption and reduces PCI DSS scope.
- Replay Attacks - Reusing Captured DataA replay attack intercepts and retransmits legitimate communication to gain unauthorized access. Nonces, timestamps, and challenge-response protocols counter it, and FIDO/WebAuthn is structurally resistant.
- OpenID Connect (OIDC) - The Identity Layer on OAuth 2.0OpenID Connect (OIDC) adds an identity layer on top of OAuth 2.0, providing standardized user authentication. It returns an ID token with user claims, enabling SSO across web and mobile apps.