The Be Sure Blog

Code Snippets | Problem Solving | Tips & Tricks

The Be Sure Blog banner

Man in the Middle attacks

posted on 15.1.2023 by Below Surface in "Cyber Security"

The attacker intercepts and relays messages between to parties, while they believe they are still interacting with each other. This is called Man-in-the-middle attack. Every router, gateway or Wifi-Access-Point can act as a man in the middle. SSL encryption will not prevent this attack, because the attacker has the private key to decrypt the data. There are three different kinds of Man-in-the-middle attacking:

  1. Session Hijacking
  2. MitM: IP Spoofing
  3. MitM: Replay/Playback

1. MitM: Session Hijacking: The attacker hijacks a session between a trusted client and network server by forecasting the sequence number of the following TCP-Package after getting in between the communication of two systems. The attacking computer substitutes the IP address for the trusted client while the server continues the session, believing it communicates with the client. For example like this:

  1. A client connects to a server.
  2. The attacker’s computer gains control of the client.
  3. The attacker’s computer disconnects the client from the server.
  4. The attacker’s computer replaces the client’s IP address with its own IP address and spoofs the client’s sequence numbers.
  5. The attacker’s computer continues dialog with the server and the server believes it is still communicating with the client.

This works because mutual authentication only will be done once at the beginning of the communication

2. MitM: IP Spoofing: Internet communication works by having the sender’s (source address) and receiver’s contact (destination address) included in the IP header. This is a weakness of TCP/IP because it is generally not possible to encrypt the data. Furthermore there is no way to check the IP-Header to be legitimate by the receiver, each IP-Package can be manipulated. An attacker will pretend to be one of the two parties to get the intended data. Or to block one party to communicate with the other. For IP Spoofing to work, the system must be vulnerable for this kind of attack.

ARP-Spoofing: Is a variance of IP Spoofing used by attackers to get in the position of a man-in-the-middle by exploiting ethernet vulnerabilities. ARP-requests are faked and the MAC-Adress forged to be able to redirect the traffic. ARP-Spoofing is only possible if the attacker is in the same network as the victim, no matter if Ethernet or WiFi is used.

DNS-Spoofing: In different ways it’s possible for an attacker to redirect traffic to his own system before allowing it to arrive at the correct location. The easiest way is if the attacker responds to a DNS request with a faked IP-Address. This fake address is given to the victim, which leads to the attacker controlled server.

3. MitM: Replay/Playback:



cyber security
man in the middle
session hijacking
ip spoofing
replay attack
playback attack


More posts of this category

Distributed Denial of Service Attacks

What are DDoS attacks and which types are existent

Cyber Security

Password Attack Hacking

Learn about the different types of password hacking

Cyber Security

Drive-by attack hacking

Drive-by attacks or Drive-by downloads are a common way to distribute malware

Cyber Security