How to Prevent Man In the Middle Attack? (original) (raw)

Last Updated : 6 Dec, 2025

A Man-in-the-Middle (MITM) attack occurs when an attacker secretly positions themselves between two communicating parties (e.g., your browser and a web server), so they can intercept, read, and often modify the messages passing between them all without either party knowing.

For example, suppose you are connected to a Wi-Fi network and doing a transaction with your bank. An attacker is also connected to the same Wi-Fi. The attacker does the following:

Man in the Middle Attack

This way the attacker is suitably situated between you and your bank's server. Every bit of sensitive data that you send to your server including your login password, is visible to the attacker. **ARP cache poisoning is one of the ways to perform an MITM attack, other ways are:

SSL/TLS protects data by encrypting it so only the legitimate endpoints can read it — but only when it’s configured correctly. Even with encryption, an attacker who records (captures) a valid encrypted login request can replay that request later to impersonate the user unless the application prevents re-use.

**Replay protection (nonce)

A nonce is a one time, unique value the server gives the client before login. The client sends the nonce with the username/password and the server accepts it only once. Because the nonce is single-use, replaying a previously captured request fails so nonces stop replay attacks.

Types of Man-in-the-Middle Attacks

Man-in-the-Middle Attack Techniques

How to Detect a Man-in-the-Middle Attack?

**How to prevent Man-in-the-Middle attacks?

**Case Study of Man In the Middle Attack

**Users should be aware of