Man-in-the-middle attack prevention is layered: enforce HTTPS with TLS 1.3 and HSTS, validate certificates and never click through warnings, use phishing-resistant MFA such as passkeys, encrypt traffic on untrusted networks with a VPN, disable legacy protocols such as LLMNR and NBT-NS, and monitor for ARP, DNS and certificate anomalies. No single control covers every attack path.
Key takeaways
- TLS only protects you if certificates are validated — clicking through a certificate warning hands the attacker the connection.
- Phishing-resistant MFA such as passkeys stops AiTM phishing proxies that steal passwords and session cookies.
- On your own network, disable LLMNR and NBT-NS, require SMB and LDAP signing, and use DHCP snooping and dynamic ARP inspection.
You type your bank's address, the page looks right, the padlock is there — and someone else is reading every keystroke. That is a man-in-the-middle attack: an attacker sits between you and the service you trust, and neither side can tell. Here is how it works, and the controls that actually stop it.
What is a man-in-the-middle attack?
A man-in-the-middle (MitM) attack happens when an attacker secretly positions themselves between two parties who believe they are talking directly to each other, so they can intercept, read or alter the traffic passing between them.
MITRE ATT&CK documents this as adversary-in-the-middle, technique T1557. Attackers abuse features of common networking protocols that determine where traffic flows — ARP, DNS, LLMNR and others — to force a device to communicate through a system they control, so they can collect information or take further action. The technique sits under the credential access and collection tactics, because its usual payoff is stolen passwords, tokens and session cookies.
The attack is old, but it keeps evolving. The network version poisons ARP or DNS on a local network. The web version strips HTTPS or presents a forged certificate. The modern version is a phishing proxy that relays the real login page to the victim and captures the session cookie after MFA. The defenses differ for each, which is why prevention has to be layered.
How does a man-in-the-middle attack work?
Every MitM attack exploits a step where one side accepts an answer without proof of who sent it. The attacker gets into the path, then exploits whatever the protocol fails to authenticate.
On a local network, the classic routes are ARP cache poisoning, where forged ARP replies claim the attacker's machine is the gateway; DHCP spoofing, where a rogue server hands out the attacker's gateway or DNS; and name resolution poisoning, where unauthenticated LLMNR and NBT-NS replies capture Windows authentication attempts.
A rogue Wi-Fi network, called an evil twin, works the same way: devices join a familiar network name and hand their traffic to the attacker.
On the web, the attacker downgrades or impersonates. SSL stripping keeps the victim on plain HTTP while the attacker talks HTTPS to the real server. A forged certificate attack presents a certificate the victim's device trusts, often because a root certificate was installed by malware or by a corporate intercepting proxy.
An adversary-in-the-middle phishing kit such as Evilginx sits between the victim and the real login page, serving the genuine page content through itself so the victim types real credentials into a real-looking flow, including the MFA prompt.
What are the main types of man-in-the-middle attacks?
MitM attacks fall into four families, and each one needs a different control. Knowing which family you face is the first step in choosing defenses.
| Type | How it works | Where it happens | Key defense |
|---|---|---|---|
| ARP poisoning | Forged ARP replies claim the gateway IP | Same local network | Dynamic ARP inspection, 802.1X |
| DNS spoofing | Forged DNS answers redirect victims | Local network or resolver | DNSSEC, trusted resolvers, monitoring |
| SSL stripping | HTTPS downgraded to plain HTTP | First request, any network | HSTS, HSTS preload |
| AiTM phishing proxy | Fake login relays the real site | Internet, via email or QR code | Passkeys, FIDO2 security keys |
| Evil twin Wi-Fi | Look-alike network name | Cafes, airports, hotels | VPN, known-network discipline |
| Certificate forgery | Trusted but false certificate | Compromised device or CA | Certificate transparency, pinning |
MITRE ATT&CK lists four sub-techniques under T1557: name resolution poisoning and SMB relay, ARP cache poisoning, DHCP spoofing, and evil twin. Downgrade attacks can also establish the position, by negotiating a weaker protocol version or cipher.
What are real examples of man-in-the-middle attacks?
Three documented cases show how different the attack can look: adware that broke HTTPS on 750,000 laptops, a state group that hijacked DNS at the registrar level, and a phishing kit that defeats one-time codes.
Lenovo Superfish, 2015. Lenovo shipped consumer laptops with Superfish VisualDiscovery adware preinstalled. To inject ads into encrypted pages, it installed a self-signed root certificate and acted as a man-in-the-middle between the browser and every website visited, including HTTPS sites.
Worse, every laptop shared the same private key and the same easy-to-crack password, so anyone on the same network could intercept or modify HTTPS traffic without triggering a browser warning. The FTC later settled charges with Lenovo, noting the software was installed on about 750,000 computers.
Sea Turtle DNS hijacking. MITRE's procedure examples for T1557 describe the Sea Turtle group changing DNS records held at service providers so traffic meant for legitimate resources went to servers it controlled, letting it capture credentials at scale. DNS hijacking is a MitM attack that needs no local network access at all: change the record, and the victims come to you.
AiTM phishing kits. Tools such as Evilginx sit as a relay between a real website and a phished user, capturing usernames, passwords, authentication tokens and session cookies. The victim sees the genuine login page and completes MFA normally; the attacker simply replays the stolen session cookie. These kits are sold as phishing-as-a-service, which is why one-time codes no longer count as strong protection.
How do you detect a man-in-the-middle attack?
Detection is harder than prevention, but there are warning signs worth teaching every employee and watching for in your monitoring.
- Certificate warnings: a browser warning about an invalid or changed certificate for a site you visit daily is a reason to stop, not to click through.
- Missing padlock or HTTP where HTTPS is expected: check the address bar before entering credentials, every time.
- Unexpected re-login prompts: a site that suddenly asks you to sign in again may have lost your session to a proxy.
- Logins from unfamiliar places: review sign-in logs for locations and devices you do not recognize.
- Duplicate ARP replies and unexpected DHCP servers: monitor for ARP anomalies and rogue DHCP offers on your networks.
- DNS answers that do not match: compare resolver answers against known-good records and watch for sudden changes.
- Certificate transparency alerts: monitor transparency logs for certificates issued for your domains that you did not request.
For a quick self-check, our free SSL checker shows whether a site's certificate chain, TLS version and expiry look right. If a familiar site suddenly shows a different issuer or an expired certificate, treat it as an incident until proven otherwise.
How do you prevent MitM attacks on the web?
Web prevention starts with encryption done properly. CISA's website security guidance tells organizations to disable HTTP, enforce HTTPS and HTTP Strict Transport Security, and disable weak ciphers such as SSLv2, SSLv3, 3DES and RC4.
Use TLS 1.3 everywhere and keep TLS 1.2 only where compatibility demands it. The OWASP Transport Layer Security cheat sheet says web applications must default to TLS 1.3, may support TLS 1.2, and must disable TLS 1.0 and 1.1, which were formally deprecated by RFC 8996 in March 2021. For TLS 1.3, use the standard AEAD cipher suites, AES-GCM or ChaCha20-Poly1305, and disable null, anonymous and export ciphers.
Add HSTS with a long max-age and includeSubDomains once every subdomain supports HTTPS, and consider HSTS preload for domains that will always be HTTPS. HSTS tells browsers to use HTTPS only, which defeats SSL stripping on repeat visits. Fix mixed content too: a page that loads scripts over HTTP hands the attacker a way in.
Use certificate pinning in mobile apps where you control both ends, and plan for key rotation before you pin anything. Monitor certificate transparency logs for certificates issued for your domains, and automate renewal so an expired certificate never tempts anyone to click through a warning.
How do you stop AiTM phishing from stealing sessions?
Adversary-in-the-middle phishing is the fastest-growing form of MitM, and it defeats the MFA most companies rely on. The proxy relays the real login page, the user enters a password and a one-time code, and the attacker captures the session cookie. The code was valid; the session still gets stolen.
The fix is phishing-resistant authentication: passkeys and FIDO2 security keys. The authentication is cryptographically bound to the real site, so a proxy on a look-alike domain cannot relay it. CISA recommends phishing-resistant MFA, including FIDO or hardware-based PKI authentication, for access to company systems and networks.
Roll it out in priority order: email and cloud administration first, then VPNs, password managers, developer platforms, financial systems and privileged accounts. For accounts that cannot use passkeys yet, use number matching and phishing-resistant policies on push approvals, and monitor sign-ins for impossible travel and new devices. Conditional access policies that require compliant devices close the gap further.
How do you prevent MitM attacks on your own network?
Network-level MitM exploits protocols that trust the first answer they hear. The fixes are configuration, not products, and most of them cost nothing.
- Disable LLMNR and NBT-NS on Windows hosts, and disable WPAD proxy auto-discovery unless you run it deliberately.
- Require SMB signing and LDAP signing with channel binding, and prefer Kerberos over NTLM so captured hashes cannot be relayed.
- Enable DHCP snooping so only trusted switch ports can offer DHCP leases, and enable dynamic ARP inspection alongside it.
- Use 802.1X port authentication so an unknown device cannot simply plug in and start poisoning the network.
- Segment the network so a compromised device in one segment cannot reach the gateway traffic of another.
- Use DNSSEC and trusted resolvers, and monitor for DNS changes on your domains and for unexpected resolver behavior.
- Encrypt everything above layer 2 so that even a successful network position yields unreadable traffic.
MITRE's mitigations for T1557 say the same thing in framework language: disable legacy protocols that may be used for MitM, encrypt sensitive traffic, filter unnecessary traffic, and limit access to network infrastructure that can reshape traffic. Our guide to how to secure your Wi-Fi covers the home side of the same problem, including rogue access points and weak router settings.
What should individuals do to avoid MitM attacks?
Technical controls fail when people ignore warnings, join suspicious networks or fall for phishing pages. Five habits cover most of the personal risk.
- Never click through a certificate warning. If your browser says a certificate is invalid, stop and investigate. The warning is the defense working.
- Use a VPN on public Wi-Fi. A properly configured VPN encrypts all traffic to your organization's network, making interception on a hostile network useless.
- Forget networks you no longer use. Devices probe for remembered network names, which is how evil twin attacks find you. Remove old hotel and cafe networks.
- Type addresses yourself. Open your bank, email and cloud accounts from a bookmark, not from a link in a message.
- Use passkeys where offered. A passkey cannot be phished by a proxy, and a password manager will not autofill on a fake domain.
Keep your devices updated and verify software downloads with signatures, not only with HTTPS. A signed update that fails verification should never be installed, whatever the download page says.
What should you do if you suspect a MitM attack?
Act fast and assume the session is compromised. Disconnect from the suspicious network, do not enter any more credentials, and switch to a trusted connection such as mobile data before doing anything else.
- Change passwords for any account you used on the suspicious network, from a trusted device, and sign out of all sessions.
- Revoke sessions and tokens in your email, cloud and VPN accounts, and check for new mail-forwarding rules or unknown MFA devices.
- Check your device for unknown root certificates, changed DNS settings, unknown profiles and new proxy configuration.
- Tell your IT or security team with the network name, time and what you saw. They can check logs for other affected users.
- Report it to your organization's security team and, if money was lost, to the FBI's IC3 and your bank.
If the attack happened on a company network, preserve evidence: ARP tables, DHCP logs, DNS logs and the certificate the attacker presented. That evidence is what lets the team find how the attacker got into position and close the gap.
The bottom line
Man-in-the-middle attacks succeed by exploiting trust that nobody verified: an unauthenticated ARP reply, a downgraded connection, a clicked-through warning, or a one-time code handed to a proxy. Prevention is about removing those unverified steps, one layer at a time.
Start with the highest-value fixes: TLS 1.3 and HSTS on everything you run, passkeys for your most important accounts, and LLMNR, NBT-NS and unsigned SMB disabled on your network.
Then check your own public posture with the free SSL checker — if your own site allows an HTTP downgrade, your visitors are the ones at risk.
Frequently asked questions
What is a man-in-the-middle attack?
A man-in-the-middle attack happens when an attacker secretly positions themselves between two parties who believe they are talking directly to each other, so they can read, alter or replay the traffic. MITRE ATT&CK now calls it adversary-in-the-middle, technique T1557.
Can HTTPS stop a man-in-the-middle attack?
Yes, when it is set up correctly. HTTPS with TLS 1.3 encrypts traffic, authenticates the server with a certificate, and detects tampering. It fails if the attacker can present a trusted certificate, if the site allows an HTTP downgrade, or if the user clicks through a certificate warning.
What is SSL stripping?
SSL stripping is a downgrade attack in which the attacker intercepts the first plain HTTP request and keeps the victim on HTTP while talking HTTPS to the real server. The victim sees a normal-looking page with no padlock. HSTS, which tells browsers to use HTTPS only, is the main defense.
How can I tell if I am under a man-in-the-middle attack?
Watch for certificate warnings, a missing padlock, a site that suddenly asks you to log in again, unexpected Wi-Fi captive portals, and logins from unfamiliar locations. On a network, watch for duplicate ARP replies, unexpected DHCP servers and DNS answers that do not match.
Does a VPN prevent man-in-the-middle attacks?
A properly configured VPN encrypts all traffic between your device and your organization's network, which makes interception on a hostile Wi-Fi network useless to the attacker. It does not protect you from a phishing proxy or from a compromised VPN server, so it is one layer, not the whole defense.
What is certificate pinning?
Certificate pinning is when an application only accepts a specific certificate or public key for a given server. If an attacker presents a different certificate, even one signed by a trusted authority, the connection fails. It is mainly used in mobile apps where the developer controls both ends.
Can MFA stop a man-in-the-middle attack?
One-time codes cannot: an adversary-in-the-middle phishing proxy relays your code to the real site and steals the session cookie. Phishing-resistant MFA such as passkeys and FIDO2 security keys can, because the authentication is bound to the real site and cannot be relayed to a fake one.
Is public Wi-Fi safe if I only visit HTTPS sites?
Mostly, but not completely. HTTPS protects the content of your traffic, but an attacker on the same network can still run captive-portal tricks, DNS spoofing and SSL stripping against sites without HSTS. Use a VPN on public Wi-Fi and never ignore a certificate warning.
Sources
The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.
Checked against CISA website security guidance, MITRE ATT&CK T1557, the OWASP TLS cheat sheet and the FTC's Lenovo Superfish complaint.
How we write and fact-check →