A man-in-the-middle (MITM) attack is one where an attacker positions themselves between two parties who believe they are talking directly, such as your laptop and your bank, and relays their traffic so they can read it, change it or steal passwords and session cookies inside it. Unlike passive eavesdropping, it is active: the attacker must first redirect the traffic.

This guide explains how attackers get into the middle of a connection, from ARP spoofing on an office network to BGP hijacks across the internet, what they do once they are there, how adversary-in-the-middle phishing gets past multi-factor authentication, real examples, and the defences that work at each layer. If you want the listening-only kind of attack, read our guide to eavesdropping attacks; for the broader term, see snooping in cyber security.

What is a man-in-the-middle attack?

NIST's glossary defines it as an attack where the attacker sits between two communicating parties in order to intercept or alter the data passing between them. It adds a detail that matters later: in authentication, the attacker sits between the person signing in and the service that verifies them.

The attack has several names for one position: man-in-the-middle, person-in-the-middle, manipulator-in-the-middle (OWASP), adversary-in-the-middle (MITRE ATT&CK technique T1557) and, in IETF documents, an on-path attacker. OWASP describes the mechanics plainly: the attacker splits one connection into two, one with the victim and one with the real server, and acts as a proxy that can read, insert and modify what passes through. Over HTTPS that means two separate TLS sessions, and the victim's browser should notice that the certificate it receives is not the real server's.

Every MITM attack therefore needs three things:

  1. A position on the path. On a switched network or across the internet, other people's traffic does not reach an attacker by default. The attacker has to abuse a protocol that decides where traffic goes: ARP, DHCP, DNS, Wi-Fi association or BGP.
  2. Relaying. Both ends must keep working, or the victim notices. MITM tools forward everything, which is why nothing looks broken.
  3. A way past authentication. Encryption alone does not stop a MITM, because the attacker can encrypt too. What stops it is each side proving who it is: the server with its certificate, the user with their sign-in. Most of the attacks below are ways of defeating one of those two checks.

How MITM differs from eavesdropping and snooping

The three terms overlap, and quiz questions often blur them. The difference is what the attacker has to do and what they can do afterwards.

SnoopingPassive eavesdroppingMan-in-the-middle
What it isUnauthorized access to data, in transit or at restListening to traffic the attacker can already seeSitting between two parties and relaying their traffic
Does the attacker change anything?Not necessarilyNoYes: routing, names or trust, and sometimes the data itself
What it threatensConfidentialityConfidentialityConfidentiality, integrity and authentication
Typical exampleReading an unlocked screen or someone else's mailboxCapturing traffic on an open Wi-Fi networkARP spoofing, an evil twin, an AiTM phishing proxy
Trace left behindAccess logs, sometimesAlmost noneDuplicate addresses, certificate warnings, unusual sign-ins
Main defenceLeast privilege and access reviewsEncryption in transitChecking who is at the other end: certificates, HSTS, phishing-resistant MFA

The integrity column is the one that makes MITM dangerous. OWASP's own example is an attacker who changes the amount of a money transfer inside an intercepted session, and Google's Chrome team warns that a single plain-HTTP navigation lets an attacker load content of their choosing, malware included.

How attackers get into the middle

ARP spoofing on a local network

On an Ethernet or Wi-Fi segment, devices find each other's hardware (MAC) addresses with the Address Resolution Protocol. MITRE ATT&CK notes that ARP is stateless and has no authentication, so a device updates its cache from any reply it receives, including a gratuitous one nobody asked for. An attacker on the same segment tells the victim that the router's IP address belongs to the attacker's MAC address, and can tell the router the same about the victim for the return traffic. Both then send their packets to the attacker, who forwards them on. Tools such as Ettercap, listed by OWASP, automate the whole thing.

A laptop, a network switch and a router in a row. A second laptop, in orange, is plugged into the switch, and the first laptop's traffic now detours through it before reaching the router.
Fig. 1 Nothing on the victim's screen changes: the traffic still reaches the router, only by way of the attacker.

Two related tricks work on the same local segment:

  • Name resolution poisoning. When DNS cannot resolve a name, Windows falls back to LLMNR and NBT-NS broadcasts. An attacker running a tool such as Responder answers them, and the victim sends its username and NTLMv2 hash, which can be cracked offline (MITRE T1557.001).
  • Rogue DHCP. A fake DHCP server hands devices a network configuration that names the attacker's system as their DNS server or gateway (MITRE T1557.003).

All three need the attacker on your local network: a compromised PC, a device plugged into a spare port, or a shared Wi-Fi network.

Rogue access points and evil twins

An evil twin is an access point that broadcasts the same network name (SSID) as a real one, often with a stronger signal. MITRE notes that attackers also listen for devices probing for networks they have joined before and answer with the matching name, so a phone can connect on its own to what it believes is the office network. Once a device joins, the attacker is its gateway: every packet passes through them, and a fake captive portal can ask for credentials. Airports, coffee shops and libraries are typical locations, and MITRE records the APT28 group using a Wi-Fi Pineapple for exactly this. Our eavesdropping guide illustrates the setup; here, the point is that an evil twin gives the attacker the position for everything that follows.

DNS spoofing and cache poisoning

Whoever answers a DNS query decides where your browser goes. An attacker already in the middle on a local network can answer queries directly, which is DNS spoofing. Cache poisoning goes further: it gets a forged answer into a resolver's cache, so every user of that resolver is sent to the wrong address. A 2008 CERT/CC vulnerability note described how the DNS protocol's 16-bit transaction ID, combined with the fixed source ports many implementations used, let attackers inject forged answers into caching resolvers. Randomizing source ports made the attack far harder, but CERT/CC noted that only protocol changes such as DNSSEC could prevent it completely.

The most damaging DNS attacks skip the protocol altogether. In January 2019, CISA's Emergency Directive 19-01 described attackers who took over accounts that manage DNS records for several US federal agency domains, pointed A, MX and NS records at their own servers, and then obtained valid TLS certificates for those domains. Because the certificates were valid, users saw no warning at all.

BGP hijacking

The Border Gateway Protocol, which carries routes between internet providers, largely trusts each network to announce only addresses it is allowed to announce. On April 24, 2018, Cloudflare documented a two-hour hijack in which eNet (AS10297) announced more-specific routes for part of the address space of Amazon's Route 53 DNS service. The hijacked servers answered queries for myetherwallet.com with addresses at a Russian provider, which poisoned the resolvers that used them. The fake site presented a self-signed certificate; users who clicked through the warning handed over their logins, which were used to steal Ethereum. The fix at the routing layer is route origin validation with RPKI (RFC 6811, which counts "monkey-in-the-middle" attacks among the threats it addresses), and that is work for ISPs and cloud providers. For everyone else, the lesson is the certificate warning.

What attackers do once they are in the middle

TLS stripping, and why HSTS stops it

Many visits start with a typed name or a plain http:// link, so the first request goes out unencrypted and the site answers with a redirect to HTTPS. An attacker in the middle catches that redirect, keeps the browser on HTTP and talks HTTPS to the real site on the victim's behalf. The victim sees the right site, only without the padlock. This is TLS stripping, also called SSL stripping, and the HSTS preload site lists it as the protocol downgrade that HSTS prevents, alongside cookie hijacking.

A laptop connects to a middle box over a line with an open orange padlock, and the middle box connects to a web server over a line with a closed padlock.
Fig. 2 The site is still encrypted, just not on the victim's side of the attacker: the one hop that matters.

HTTP Strict Transport Security (RFC 6797) closes the gap. A site sends one response header:

Strict-Transport-Security: max-age=31536000; includeSubDomains

From then on, for as long as max-age says, the browser rewrites every http:// link to that site as https:// before sending anything, and treats any certificate error as fatal, with no button to continue. The weakness is the first visit, before the browser has seen the header, which the RFC calls the bootstrap MITM vulnerability. The HSTS preload list covers it: domains on the list are built into Chrome, and Firefox, Safari and Edge use lists based on Chrome's, so the browser never tries HTTP for them at all.

As of September 2026, preloading is a commitment. The preload site requires a max-age of at least 31,536,000 seconds (one year), includeSubDomains, the preload directive and HTTPS on every subdomain, including internal ones, and it warns that removal is slow. It now says preloading is not recommended for most sites, because Chrome and Safari already upgrade navigations to HTTPS by themselves; preloading adds value when those upgrades fail in the presence of an active attacker, which is exactly the MITM case. Turn on HSTS for every site you run, and preload a domain once you are sure all of its subdomains will stay HTTPS-only. Browsers are moving the same way: in October 2025, Google said that Chrome 154, scheduled for October 2026, turns on "Always Use Secure Connections" for public sites by default, asking the user before the first visit to a public site without HTTPS. Our guide to renewing an SSL certificate covers the other half: a certificate that expires on an HSTS site locks every visitor out.

Certificate warnings people click through

If stripping fails, the attacker can present their own certificate and hope. The browser shows a warning, and many people continue. In a 2013 field study of more than 25 million browser warnings, users clicked through 70.2% of Google Chrome's SSL warnings and 33.0% of Mozilla Firefox's. RFC 6797 is blunt about it: letting users click through certificate errors is "a recipe for a man-in-the-middle attack", which is why a site that sends HSTS opts out of the button entirely.

Two situations produce no warning at all, which makes them worse:

  • A rogue root certificate on the device. In February 2015, US-CERT (now part of CISA) warned that Superfish VisualDiscovery adware, pre-installed on some Lenovo PCs from September 2014, installed its own trusted root certificate and intercepted, decrypted and re-encrypted all browser HTTPS traffic, a man-in-the-middle built into the machine. Its private key could be recovered from the software, so any attacker could create certificates those PCs would trust, and uninstalling the software did not remove the certificate.
  • A valid certificate obtained through DNS control, as in the 2019 CISA directive above. Monitoring Certificate Transparency logs for certificates you did not request is how that case is caught.

After you sign in, the site gives your browser a session cookie, and from then on that cookie, not your password, is what proves who you are. MITRE ATT&CK (T1539) notes that a stolen session cookie lets an attacker use a web application as the signed-in user without credentials, and can get around some forms of multi-factor authentication. On any plain HTTP request, an attacker in the middle can read and inject cookies. HTTPS with HSTS removes that chance, and the Secure cookie attribute, described in RFC 6797's introduction, tells the browser to send a cookie only over an encrypted connection. NIST SP 800-63B-4 points to an emerging answer for the cookies that do get copied: Device Bound Session Credentials, which prove possession of a key held on the device instead of presenting a bearer token anyone can replay.

Adversary-in-the-middle phishing: stealing the session after MFA

AiTM phishing moves the middle from the network to the sign-in page, which is why it works from anywhere. The victim follows a link to a look-alike domain. Behind it, a proxy loads the real sign-in page and relays every step: the victim types their password, approves the push notification or enters the code, the real service issues a session cookie, and the proxy passes it on while keeping a copy.

A laptop signs in through a proxy server to a real sign-in server, with a phone approving the login. The server sends back a cookie token, and the proxy keeps an orange copy of it.
Fig. 3 MFA did its job and the sign-in succeeded. The attacker never needed the password again, only the cookie that came back.

Microsoft Threat Intelligence reported on July 12, 2022 that one AiTM campaign had targeted more than 10,000 organizations since September 2021, using the open-source Evilginx2 kit against Office 365 (now Microsoft 365) sign-ins. The phishing page held two TLS sessions, one with the victim and one with the real site. Microsoft stressed that this is not a vulnerability in MFA: the attacker steals the session after it, whatever sign-in method the user chose. In some cases the attackers started payment fraud from the victim's mailbox as little as five minutes after stealing the session. A June 2023 follow-up described a kit from a group Microsoft tracks as Storm-1167, sent from a compromised trusted vendor. After replaying the stolen cookie, the attacker added a new phone-based MFA method, which the tenant's settings allowed without an MFA challenge, then sent more than 16,000 phishing emails to the victim's contacts. Recovery meant revoking session cookies and rolling back the MFA change, not just resetting a password. The kits keep changing (Microsoft names Evilginx2, Modlishka, Muraena, EvilProxy and NakedPages, and MITRE's T1557 entry now lists newer ones such as Kali365), but the mechanism does not.

That mechanism is also why most MFA fails against it. A one-time code or a push approval is something the user relays, and a proxy relays it too. NIST SP 800-63B-4 states that authenticators whose output is entered by hand, such as one-time passwords and out-of-band codes, are not phishing-resistant for exactly this reason. WebAuthn, the standard behind FIDO2 security keys and passkeys, is: the response is cryptographically bound to the domain name the browser actually connected to, so a proxy on a look-alike domain receives nothing the real site will accept. CISA's October 2022 fact sheet calls FIDO/WebAuthn the only widely available phishing-resistant authentication, with smart-card (PKI) sign-in as the less widely available alternative. A passkey is a FIDO credential of this kind, stored on a phone, computer or security key, and either synced between a person's devices or bound to one.

Important

Passkeys and FIDO2 security keys are the one control that defeats AiTM phishing. Conditional access, sign-in alerts and short session lifetimes limit the damage, but a code or a push approval can always be relayed.

Real man-in-the-middle attack examples

Documented cases show the same pattern: a position on the path, then a failed or bypassed identity check.

WhenWhat happenedHow the attacker got in the middleWhat would have stopped it
2014 to 2015Superfish adware on some Lenovo PCs intercepted all browser HTTPSA pre-installed trusted root certificate with a recoverable private keyAn inventory of trusted roots; removing the rogue certificate
2018MyEtherWallet users lost EthereumBGP hijack of Route 53 addresses, poisoned DNS, a self-signed certificateRPKI filtering by providers, HSTS, not clicking through the warning
2019DNS tampering against US federal agency domainsStolen DNS account credentials, then valid certificates for the domainsMFA on DNS accounts, Certificate Transparency monitoring
2021 to 2022AiTM phishing aimed at more than 10,000 organizationsAn Evilginx2 proxy relaying the Office 365 sign-in pagePhishing-resistant MFA, conditional access
2023Storm-1167 AiTM and business email compromiseAn indirect-proxy sign-in page, linked from a compromised vendor's emailPhishing-resistant MFA, revoking sessions, MFA to add MFA methods
VariousAPT28 evil twins; LuminousMoth ARP spoofing; Lazarus Group ResponderRogue Wi-Fi, forged ARP replies and poisoned name resolution (MITRE ATT&CK)WPA3 with 802.1X, Dynamic ARP Inspection, LLMNR and NBT-NS disabled

How to prevent man-in-the-middle attacks

No single control covers every layer, so defend each place an attacker can stand. In rough order of value for most organizations:

  1. Serve everything over HTTPS with HSTS. Every site, API and admin panel, subdomains included, with the Secure attribute on session cookies. Preload the domain once you are sure. Our security testing service checks TLS, HSTS and security headers on the sites you expose, along with DNSSEC and registrar lock on your domains.
  2. Move sign-in to phishing-resistant MFA. Passkeys or FIDO2 security keys for everyone you can, administrators first, plus conditional access policies that check the device or location, which Microsoft recommends alongside MFA. Our IT support team sets up MFA and conditional access on Microsoft Entra ID or Google identity, with phishing-resistant sign-in where possible.
  3. Protect DNS and the domain. Validate DNSSEC on your resolvers and sign your zones; RFC 4033 is clear that DNSSEC authenticates answers but does not encrypt them. For privacy and tamper protection on the path to the resolver, use encrypted DNS: DNS over TLS on port 853 (RFC 7858) or DNS over HTTPS (RFC 8484). Put MFA on every DNS and registrar account, as CISA required of federal agencies, and watch Certificate Transparency logs for certificates you did not order.
  4. Authenticate the Wi-Fi network, not just the user. Use WPA3, which the Wi-Fi Alliance says requires Protected Management Frames, and WPA3-Enterprise with 802.1X for staff. On a network with one shared password, anyone who knows it can run a convincing twin. With 802.1X, each device signs in with its own credentials and checks the authentication server's certificate; Microsoft's EAP documentation warns that a client that skips that check may connect to a rogue network, and recommends not letting users approve untrusted servers. Wi-Fi Enhanced Open encrypts guest traffic but does not authenticate the network, so it does not stop an evil twin.
  5. Harden the switches. On managed switches, enable DHCP snooping and Dynamic ARP Inspection, which checks every ARP packet on an untrusted port against the DHCP snooping database and drops the ones that do not match. Disable LLMNR and NetBIOS name resolution by Group Policy where nothing needs them, and require SMB signing.
  6. Pin certificates only where it fits. The OWASP Pinning Cheat Sheet says there is almost no situation where pinning is worth it, because the risk of outages usually outweighs the benefit. Consider it only for a native mobile app talking to servers you control, with a pinset you can update safely; never for websites.
  7. Keep an inventory of trusted root certificates on managed devices, so an interception certificate like Superfish's stands out.

And for everyone, at work and at home:

  • Never click through a certificate warning on a site you use regularly. Close the tab and report it; on your own network, check for an evil twin or a compromised router.
  • Check the address bar before you sign in, especially after following a link from an email or a message. A passkey that refuses to work on a page is a warning sign in itself.
  • Forget open Wi-Fi networks you no longer use, so devices do not rejoin a look-alike automatically, and prefer mobile data or a VPN on networks you do not control. Our guides to securing home Wi-Fi and the home network cover the router side, and our cyber security tips cover the everyday habits.

Signs of a man-in-the-middle attack, and what to do

Pure relaying is hard to see, but getting into the middle usually leaves marks.

SignWhat it may meanWhat to do
Certificate warning on a familiar siteAn interception certificate or a hijacked nameDo not continue; try from another network and report it to IT
A site you always reach over HTTPS loads over HTTPTLS stripping on the current networkDisconnect, and add HSTS if it is your site
The router's IP address maps to an unfamiliar MAC address in arp -aARP spoofing on the local segmentFind the port, isolate the device, enable Dynamic ARP Inspection
An open network named like a secured one, or a portal asking for work credentialsAn evil twinDisconnect and forget the network; alert whoever runs the real one
A new MFA method, inbox rule or unfamiliar sign-in after a phishing clickAiTM session theftRevoke all sessions, remove the added MFA method and rules, reset the password
Certificates in CT logs that nobody orderedDNS or registrar account takeoverAudit DNS records, secure the accounts, have the certificate revoked

For a business, the last two rows are the urgent ones. Microsoft's 2023 case is the reminder: a password reset alone leaves the stolen session and the attacker's MFA method in place.