Man In The Middle Attack

Man In The Middle Attack

Here we can see, “Man In The Middle Attack”

What is MITM attack

A man in the middle (MITM) attack occurs when a perpetrator inserts himself into communication between a user and an application, either to listen in or mimic one of the parties, making it appear as if a normal information exchange is taking place.

An attack’s purpose is to steal personal data such as login credentials, account information, and credit card numbers. Users of financial apps, SaaS enterprises, e-commerce sites, and other sites requiring signing in are typical targets.

With the information gathered during an attack, identity theft, unapproved fund transfers, and unauthorized password changes could be possible.

It can also be used to gain a footing inside a guarded perimeter during an advanced persistent threat (APT) assault’s infiltration stage.

A MITM attack is essentially the same as a mailman opening your bank statement, writing down your account information, then resealing and bringing it to your door.

Also See:  Google to be sued by states over alleged Play store abuse

MITM attack progression

Interception and decryption are the two phases of a successful MITM implementation.


The first stage intercepts user traffic before it reaches its intended destination through the Attacker’s network.

A passive assault, in which an attacker makes free, malicious Wi-Fi hotspots available to the public, is the most frequent (and simplest) way to do this. They aren’t password secured and are usually titled in a way that matches their location. When a victim connects to one of these hotspots, the Attacker has complete access to any online data exchange.

Attackers that want to be more active in their interception can use one of the following methods:

  • IP spoofing is the process of an attacker impersonating a program by changing the packet headers of an IP address. As a result, users who try to access a URL associated with the program are directed to the Attacker’s website.
  • ARP spoofing is the process of utilizing bogus ARP packets to link an attacker’s MAC address to the IP address of a genuine user on a local area network. As a result, data sent to the host IP address by the user is instead forwarded to the Attacker.
  • DNS spoofing, also known as DNS cache poisoning, is the act of entering a DNS server and changing the address record of a website. As a result, users who try to access the site are redirected to the Attacker’s location via the changed DNS record.


Any two-way SSL traffic that has been intercepted must be decrypted without alerting the user or application. Several approaches can be used to accomplish this:

  • HTTPS spoofing – Once the initial connection request to a secure site is made, HTTPS spoofing sends a phoney certificate to the victim’s browser. It stores a digital thumbprint associated with the infected application, which the browser verifies against a list of trusted websites. Before the data is passed to the application, the Attacker has access to any data entered by the victim.
  • SSL BEAST – (browser exploit against SSL/TLS) is a browser use that controls a TLS version 1.0 flaw in SSL. In this case, malicious JavaScript infects the victim’s computer, intercepting encrypted cookies sent by a web application. The app’s cypher block chaining (CBC) is compromised, allowing the attacker to decrypt the app’s cookies and authentication tokens.
  • SSL hijacking – During a TCP handshake, an attacker passes forged authentication keys to the user and the application, resulting in SSL hijacking. This appears to be a secure connection, but the man in the middle is in charge of the entire session.
  • SSL stripping – By intercepting the TLS authentication sent from the application to the user, SSL stripping converts an HTTPS connection to HTTP. While maintaining the secured session with the application, the Attacker sends the user an unencrypted version of the application’s site. Meanwhile, the Attacker can see the entire session of the user.

How Do Man-in-the-Middle Attacks Work?

There are three stages to a man-in-the-middle attack:

  1. Stage one: Gain access to a location where the attack will be carried out.
  2. Stage two: Take on the role of the man-in-the-middle.
  3. Stage three: If necessary, defeat encryption.

The Attacker becomes the man-in-the-middle once they can get between you and your desired destination. They will attempt to deceive your computer using one or more spoofing attack techniques to succeed.

Man in the middle attack prevention

Blocking MITM attacks necessitates a combination of encryption and verification methods for applications and several practical steps on the part of users.

This means for users:

  • Wi-Fi connections that aren’t password-protected should be avoided.
  • Keeping an eye out for browser notifications that a website is insecure.
  • When not in use, immediately log out of a secure application.
  • When conducting sensitive transactions, avoid using public networks (e.g., coffee shops, hotels).

Secure communication protocols, such as TLS and HTTPS, aid website operators in preventing spoofing attacks by encrypting and authenticating transmitted data. This prevents site traffic from being intercepted and the decryption of sensitive data like authentication tokens.

It is recommended that applications use SSL/TLS to secure all website pages, not just those that require users to log in. This reduces the risk of an attacker stealing session cookies from a logged-in user browsing on an unsecured section of a website.’

Where Do Man-in-the-Middle Attacks Happen?

Man-in-the-middle attacks can take a variety of forms, but they typically take one of four forms:

  1. Public networks: When you connect to any public network, you are at the greatest risk. This includes public Wi-Fi at airports and cafes, as well as any network with no access restrictions. Because many techniques work best on local area networks and Wi-Fi networks, it is easier for an attacker to become a man-in-the-middle.
  2. On your computer: You could get malware (like a man-in-the-browser) that monitors and modifies your Internet connection, or you could get a phishing attack that hijacks your connection by luring you to sites that act as a man-in-the-middle.
  3. Router: Routers are frequently provided by your Internet service provider and come with pre-configured security settings. This means that many routers are still using default login credentials (such as admin/password) or are running outdated firmware that may be vulnerable.
  4. Web server: Attacker gains access to the genuine web server with which you intended to communicate.
Also See:  Snapchat taps Zynga for its own Among Us clone called ReVamp

Using Imperva to protect against MITM

Suboptimal SSL/TLS implementations, such as those that enable the SSL BEAST to exploit or support the use of outdated and under-secured cyphers, are frequently used in MITM attacks.

As part of its suite of security services, Imperva provides its customers with optimized end-to-end SSL/TLS encryption.

The certificates are optimally implemented on the Imperva content delivery network (CDN) to prevent SSL/TLS compromising attacks, such as downgrade attacks (e.g., SSL stripping), and ensure compliance with the latest PCI DSS demands.

The SSL/TLS configuration is kept up to date by professional security to keep up with compliance demands and counter emerging threats. It is offered as a managed service (e.g., Heartbleed).

Finally, customers can use the Imperva cloud dashboard to set up HTTP Strict Transport Security (HSTS) policies that force the use of SSL/TLS across multiple subdomains. This increases the security of a website or web application against protocol downgrade attacks and cookie hijacking attempts.

Example of a Man-in-the-Middle Attack

Assume you and a colleague are using a secure messaging platform to communicate. An attacker wants to eavesdrop on the conversation and send a false message from you to your colleague.

You start by requesting your colleague’s public key. A man-in-the-middle attack can begin if she sends you her public key, but the Attacker intercepts it.

The Attacker sends you a forged message that appears to come from a colleague but contains the Attacker’s public key instead.

You encrypt your message with the Attacker’s key, believing the public key belongs to your colleague, and send the encrypted message back to your “colleague.”

The Attacker intercepts the message once more, decrypts it with their private key, modifies it, and re-encrypts it with the public key obtained from your colleague who attempted to send it to you.

When your colleague examines the decoded message, she assumes you sent it.

  1. You send a message to a coworker, but an assailant intercepts it.
  2. You “Hello, could you please send your key to me?” Attacker The message is relayed to your colleague by the colleague attacker, unaware that there is a man-in-the-middle.
  3. “Hello there, could you please send me your key?” You Attacker Colleague
  4. A colleague returns her encryption key.
  5. [Colleague’s key] You, Attacker Colleague
  6. The Attacker replaces your colleague’s key with their own and relays the message to you, claiming it’s your colleague’s key.
  7. You have the [Attacker’s key] Colleague Assailant
  8. “The password to our S3 bucket is XYZ,” you encrypt a message with what you believe is your colleague’s key, considering that only your colleague can read it. [encrypted with the key of the Attacker] Colleague Assailant
  9. Because the message is encrypted with the Attacker’s key, they decrypt it, read it, and modify it before re-encrypting it with your colleague’s key and forwarding it to You Attacker. The colleague’s key was used to encrypt the message. Colleague
  10. You and your colleague both believe the message is safe.

This example emphasizes the importance of having a way to verify that parties are communicating with each other’s public keys rather than an attacker’s public key. It would help if you controlled the risk of man-in-the-middle attacks in addition to having strong information security practices.

Are Attacks by a Man-in-the-Middle Dangerous?

Man-in-the-middle attacks are risky and usually have two objectives:

  1. Obtain sensitive data and personal information.
  2. Manipulate the contents of a message that has been sent.

In practice, this entails gaining access to the following:

  1. For identity theft, personally identifiable information (PII) and other sensitive information are collected.
  2. To gain unauthorized access to online bank accounts, login credentials on a public Wi-Fi network.
  3. On an ecommerce site, stealing credit card numbers
  4. Redirecting traffic from legitimate websites to malware-hosting sites over public Wi-Fi hotspots

Websites and emails are common targets for MITM attacks. Because emails are not encrypted by default, an attacker can intercept and spoof emails sent by the sender using their login credentials.

What is the Difference Between a Man-in-the-Middle Attack and Sniffing?

Much of the information sent to the Internet is publicly accessible due to the nature of Internet protocols. When you connect to a local area network (LAN), your data packets are visible to all other computers on the web.

Suppose an attacker has access to any computers between your client and the server and is on the same network as you. In that case, they can use a sniffer to read the data, allowing them to listen in on your communication (including your client and the server).

The Attacker uses a man-in-the-middle attack to trick you or your computer into connecting to their computer. This makes you think they’re the place you’ve been looking for. Then they relate to your actual destination and pretend to be you, relaying and modifying data in both directions if necessary. Because information can be changed, this poses a much greater cybersecurity risk.

Sniffing and man-in-the-middle attacks are becoming more difficult, but not impossible, as cybersecurity moves toward encryption by default. To become a man-in-the-middle, attackers can use various techniques to deceive users or exploit flaws in cryptographic protocols. A secure connection alone isn’t enough to keep a man-in-the-middle from intercepting your data.

Other Methods for Man-in-the-Middle Attacks

There are more ways for attackers to get in the form of you getting to your destination. These techniques are usually classified into one of three groups:

  1. Server compromise: The Attacker takes over the server you’re trying to connect to and installs their software to intercept connections.
  2. Client compromise: It occurs when an attacker gains access to your computer and installs a trojan horse or other malware that allows them to listen in on all of your connections.
  3. Compromise of communication: An attacker takes control of a machine that relays data between you and the server.


I hope you found this information helpful. Please fill out the form below if you have any questions or comments.

User Questions:

  1. What causes a man-in-the-middle attack?

A man-in-the-middle attack is an eavesdropping attack in which an attacker intercepts a conversation or data transfer in progress. The attackers pose as both legitimate participants after inserting themselves in the “middle” of the transfer.

  1. Is a man in the middle attack an active one?

Active man-in-the-middle (MitM) is an attack method that allows an intruder to access sensitive data by intercepting and altering communications between a public network user and any requested website. The Attacker monitors communications that are sent over a public network.

  1. What is the evil twin’s attack?

Insecurity, an evil twin is a rogue wireless access point that impersonates a legitimate Wi-Fi access point for an attacker to steal personal or corporate data without the end-knowledge. user’s

Also See:  Hardlock API Error Code 38 Windows 7
  1. Who can successfully execute a man-in-the-middle attack?

Who is actually able to perform a man-in-the-middle attack? from AskProgramming

  1. Man-in-the-Middle Attack Example

Man-in-the-Middle Attack Example from ProgrammerHumor