What is Man-in-the-Middle Attack?
How It Works, Types and Prevention

A man-in-the-middle attack is a cyber attack where someone secretly sits between you and a website or app. They can read or change what passes between you, such as passwords or bank details, while both sides think they talk directly. Secure https sites, a VPN and care on Wi-Fi help stop it.

Short Answer A man-in-the-middle attack is a cyber attack where someone secretly sits between two parties, such as your laptop and your bank’s website. From there, they can read or change what passes between them. Both sides think they are talking directly. Security teams call it MITM for short. It works like a postman who opens, reads and reseals your letters before delivering them.

What is a Man-in-the-Middle Attack?

When you open a website or send an email, your device swaps small packets of data with another computer. Experts call this flow of data traffic. Normally, it passes through several networks on its way to the right place, and encryption stops anyone along the way from seeing inside it.

In a man-in-the-middle attack, an attacker quietly puts themselves on that path. The attacker can then listen in, which experts call eavesdropping. They can also change messages on the way, for example by swapping a bank account number in an invoice. The victim usually sees nothing unusual, because the attacker passes the traffic along so everything still seems to work.

The main goals are simple. First, attackers want secrets such as passwords, one-time codes and card details. Second, they may want to change information to trick you into paying the wrong person. In short, MITM is a form of interception: catching data meant for someone else.

Key Words to Know

  • Encryption: scrambling data so only the right receiver can read it. Anyone who catches it sees only nonsense.
  • HTTPS: the secure version of the web. The “S” means the browser and the website encrypt everything between them.
  • TLS (Transport Layer Security): the standard that does the encrypting behind HTTPS. It also checks that the website is the real one.
  • Certificate: a digital ID card for a website. Your browser checks it to confirm the site is real.
  • Session cookie: a small file that keeps you signed in, so you do not type your password on every page.
  • Public Wi-Fi: a wireless network in an airport, cafe or hotel that many strangers share.

How Does a Man-in-the-Middle Attack Work?

Most attacks happen in two stages. The attacker first gets into the middle of the connection. Then they read or change what flows through. Here is what happens, step by step.

  1. Getting in the middle: the attacker finds a way to make your traffic pass through them. A common way is a fake Wi-Fi network with a trusted-sounding name, such as “Airport_Guest_WiFi”. When a laptop joins it, every request goes through the attacker’s device first.
  2. Reading the traffic: anything sent without encryption is now visible. That can include passwords typed on an old website or messages in an app that does not encrypt.
  3. Changing the traffic: the attacker can also alter data before passing it on. For example, they may send you to a look-alike sign-in page or edit a file you download.
  4. Passing it along: finally, the attacker forwards your traffic to the real website and sends the answers back to you. So the page loads normally.

Encryption stops this. When a site uses HTTPS correctly, the attacker in the middle sees only scrambled data. Also, if they try to pretend to be the website, its certificate check fails and your browser shows a warning.

A laptop on a copied Wi-Fi network sends its data through a hidden device before it reaches the real website
The hidden device forwards every message, so pages still load and nothing looks wrong.

An Example From an Airport Lounge

Priya is a sales manager at a Pune company. At the airport, she connects her laptop to a network called “Lounge WiFi”. However, the real lounge network has a slightly different name. Someone nearby set up this copy. Her browser shows a warning on the company’s older webmail page, but she is in a hurry, so she clicks past it and signs in. As a result, the person running the fake network now has her email password.

Types of Man-in-the-Middle Attacks

Attackers reach the middle in different ways. Here are the common types of man-in-the-middle attack. Many of them use spoofing, which means faking an identity, such as a network name or a website address.

  • Fake Wi-Fi hotspot: a copy of a real network name, sometimes called an “evil twin”, that tricks devices into joining it.
  • DNS spoofing: the DNS is the internet’s address book. Here, a false entry sends you to a fake site even though you typed the right address.
  • HTTPS stripping: also called SSL stripping, the attacker keeps your connection on the old, unencrypted “http” version of a site to read it.
  • Session hijacking: the attacker copies your session cookie and uses it to act as you, without needing your password.
  • Email hijacking: the attacker gets into a mailbox and quietly sits in the middle of a real email conversation. They read along and step in at the right moment, often about a payment.
Type What Happens Main Defense
Fake Wi-Fi hotspot Your device joins the attacker’s network Use known networks or mobile data
DNS spoofing The correct address opens a fake site HTTPS and certificate checks
HTTPS stripping The site loads without encryption HSTS, which forces the secure version
Session hijacking Someone reuses your sign-in cookie HTTPS, short sessions, sign out
Email hijacking A stranger joins a real email thread Strong sign-in and call-back checks

Man-in-the-Middle Attack Examples

A real man-in-the-middle attack usually looks like a normal workday with one small odd moment. The first example continues Priya’s story, because one attack often leads to the next.

A Changed Bank Account in a Supplier Email

A week later, the attacker uses Priya’s stolen password to read her mailbox quietly. They find an ongoing thread with a steel supplier about a large order. Then, just before payment, they send a reply that looks like it came from the supplier. It says the supplier has a “new bank account”. The accounts team pays the new account, and the money goes to the attacker. This kind of fraud is a form of business email compromise, and it often starts with a stolen mailbox password.

A Session Taken Over at a Cafe

Another day, a colleague on cafe Wi-Fi opens an old internal tool that still uses plain “http”. Because it does not encrypt, someone in the middle can copy his session cookie and open the tool as him. Encryption everywhere and a stronger sign-in would have stopped both attacks early. In the supplier story, a call to the supplier on a known number would also have saved the money.

Signs of a Man-in-the-Middle Attack

A man-in-the-middle attack is hard to spot, because the attacker wants everything to look normal. Still, a few warning signs often show up. If you notice one, stop before you type anything.

  • Certificate warnings: your browser says the connection is not private or the certificate is not valid. Never click past this on a sign-in page.
  • Odd site addresses: the address starts with “http” instead of “https”, or the name has a small spelling change.
  • Sudden logouts: a site keeps signing you out or asking you to sign in again.
  • Two networks with the same name: you see two Wi-Fi networks with almost the same name.
  • Slow or strange connections: pages load slowly or look different from usual.
  • Unexpected changes in emails: a known contact suddenly sends new bank details or asks for urgent payment.

No single sign proves a man-in-the-middle attack. However, together they are a good reason to disconnect and tell your IT team.

Talk to an ExpertCan your staff work safely on public Wi-Fi? Talk to our team about protecting remote work.

Ways to Prevent a Man-in-the-Middle Attack

Strong defenses against a man-in-the-middle attack already exist, and most are standard today. TLS, the standard behind HTTPS, is designed to stop others from reading, changing or faking your messages. So if you encrypt all traffic and every site proves its identity, a person in the middle learns very little. Prevention has two parts: users and IT teams.

For Staff and Home Users

  • Know what https protects: on public Wi-Fi, a site that opens with “https” and shows no warning keeps your data scrambled. The danger comes from warnings you click past, old “http” sites and apps that do not encrypt.
  • Prefer trusted networks: avoid open Wi-Fi for work. Use your phone’s mobile data as a hotspot instead.
  • Use the company VPN: a virtual private network wraps your work traffic in an encrypted tunnel to the office, even on a cafe network.
  • Never ignore certificate warnings: close the page instead of clicking “continue”.
  • Turn on a second sign-in step: multi-factor authentication means a stolen password alone is not enough. Passkeys, which use your fingerprint, face or phone PIN, work only on the real website, so they protect even better than one-time codes.
  • Keep devices updated: updates close security gaps that attackers use. Good patch management makes this routine for every company laptop.
  • Turn off auto-join: stop devices from joining networks on their own.

For IT Teams and Website Owners

  • HTTPS everywhere: use HTTPS on every page and internal tool, not just sign-in. Retire old “http” systems.
  • Turn on HSTS: HTTP Strict Transport Security is a setting where a website tells browsers, “always use my secure version”. After that, the browser refuses plain “http” for that site and blocks clicking past certificate warnings. Adding the site to the built-in HSTS list in browsers protects even the very first visit.
  • Use current TLS: keep TLS settings up to date and turn off old, weak versions on servers.
  • Protect sign-in sessions: mark session cookies as secure so browsers send them only over HTTPS, and keep sessions short.
  • Adopt zero trust: zero trust means you trust no device or network by default. Every request must prove who it is, wherever it comes from.
  • Add payment call-back checks: before any change to a supplier’s bank details, call the supplier on a number you already have.
Two connections compared: plain data an onlooker can read, and scrambled data inside a secure tunnel that they cannot
With HTTPS or a VPN, anyone in the middle sees only scrambled data and cannot change it unnoticed.

Man-in-the-Middle Attack vs Trick Emails

People often confuse these two attacks, because both aim to steal passwords or money. Trick emails are called phishing. However, they work differently. Phishing tricks you with a fake message, such as an email that asks you to click a link and sign in. In contrast, a man-in-the-middle attack hides inside a real conversation and catches data on the way.

Question Man-in-the-Middle Attack Phishing
How it starts The attacker gets onto your connection The attacker sends you a fake message
What you see Often nothing unusual A message asking you to act
What it needs from you Using an unsafe network or site Clicking a link or replying
Main defense Encryption, HSTS, trusted networks Awareness, email filters, a second sign-in step

The two can also work together. For example, a phishing email may lead you to a fake page that sits in the middle. It passes your password and one-time code to the real site.

What to Do If You Suspect an Attack

If you think a man-in-the-middle attack has happened, stay calm and act quickly. First, disconnect from the network and switch to mobile data or a trusted connection. Then, from a safe device, change the password you may have exposed and sign out on all devices. Next, tell your IT team, so they can check your account and warn colleagues.

If money has already gone to a wrong account, speed matters. In India, call the national cyber crime helpline 1930 or report it on cybercrime.gov.in. Also tell your bank at once, because quick reports give the best chance of stopping the payment.

Frequently Asked Questions About Man-in-the-Middle Attack

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

It is like someone secretly listening to your phone call and changing a few words before the other person hears them. Online, the attacker sits between your device and a website or app. Neither side knows they are there. So the attacker can read passwords or change details, such as a bank account number, while everything still seems to work normally.

What does a man-in-the-middle attack do?

It lets an attacker see and change data meant for someone else. In practice, that means stealing passwords, one-time codes and session cookies, or reading private emails. It can also mean changing information on the way, such as the bank account in an invoice or the file in a download. The victim usually notices nothing, because pages still load normally.

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

Many security teams now use neutral names for the same idea. “Adversary-in-the-middle” is common, and MITRE ATT&CK, a public list of attack methods that security teams use, has it as a technique name. Others say “on-path attack”. One guide from NIST, the US standards body, also says “person-in-the-middle”. All these names mean the same attack, and the short form MITM is still widely used.

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

In cryptography, the study of secret codes, it means an attacker who sits between two people as they agree on a secret key. Each person thinks they share a key with the other, but both actually share keys with the attacker. Certificates and digital signatures, which work like a tamper-proof stamp, prevent this. They prove who is really on the other side before anyone shares a secret.

What does a man-in-the-middle attack involve?

It involves three parties: you, the real website or person you are talking to, and a hidden attacker on the path between you. The attacker needs a way onto that path, such as a copied Wi-Fi network. From there, any data that is not encrypted can be read or changed. Encryption and certificate checks remove most of that chance.

What prevents man-in-the-middle attacks?

Encryption prevents most of them. HTTPS with current TLS scrambles data and proves the website is real. HSTS makes browsers always use the secure version of a site. A company VPN protects traffic on public Wi-Fi, and multi-factor authentication stops a stolen password from being enough. Finally, staff should never click past certificate warnings and should check any change to bank details by phone.

What makes man-in-the-middle attacks dangerous?

They are dangerous mainly because they are quiet. The attacker passes traffic along, so pages load and emails arrive as usual. As a result, a victim may not notice for days or weeks. During that time, the attacker can collect passwords, read business emails and wait for the right moment to change a payment. That is why prevention matters more than spotting it afterward.
Use CaseSecure Remote and Hybrid Workforces

References

  1. Definition of a man-in-the-middle attack: NIST Computer Security Resource Center, Glossary: Man-in-the-Middle Attack (MitM)
  2. What TLS protects against: IETF, RFC 8446: The Transport Layer Security (TLS) Protocol Version 1.3
  3. How HSTS works: IETF, RFC 6797: HTTP Strict Transport Security (HSTS)
Stay Updated

Get the Latest Terms & Insights.

New encyclopedia terms, threat intelligence, and architecture decisions, by email.

Book a Consultation

A practice principal will contact you within 1 business day.

Thank you! A Signisys principal will be in touch within 1 business day.