Page semi-protected

Man-in-the-middle attack

From Wikipedia, the free encyclopedia
  (Redirected from Man in the middle attack)
Jump to: navigation, search

In computer security, a man-in-the-middle attack (often abbreviated mitm, or the same using all capital letters) is an attack where the attacker secretly relays and possibly alters the communication between two parties who believe they are directly communicating with each other. Man-in-the-middle attacks can be thought about through a chess analogy. Mallory, who barely knows how to play chess, claims that she can play two grandmasters simultaneously and either win one game or draw both. She waits for the first grandmaster to make a move and then makes this same move against the second grandmaster. When the second grandmaster responds, Mallory makes the same play against the first. She plays the entire game this way and cannot lose using this strategy unless she runs into difficulty with time because of the slight delay between relaying moves. A man-in-the-middle attack can be used against many protocols.[1] One example of man-in-the-middle attacks is active eavesdropping, in which the attacker makes independent connections with the victims and relays messages between them to make them believe they are talking directly to each other over a private connection, when in fact the entire conversation is controlled by the attacker. The attacker must be able to intercept all relevant messages passing between the two victims and inject new ones. This is straightforward in many circumstances; for example, an attacker within reception range of wireless access point can insert himself as a man-in-the-middle.[2]

As an attack that aims at circumventing mutual authentication, or lack thereof, a man-in-the-middle attack can succeed only when the attacker can impersonate each endpoint to their satisfaction as expected from the legitimate end. All protocols include some form of endpoint authentication specifically to prevent attacks. For example authentication forwarded to either one or two parties using a mutually trusted certificate of authority.[3]


An illustration of the man-in-the-middle attack




  3. Bob responds with his encryption key:
    Alice     Mallory     ← [Bob's key] Bob
    Alice     ← [Mallory's key] Mallory     Bob
  6. However, because it was actually encrypted with Mallory's key, Mallory can read it, or, modify it (as desired), re-encrypt with Bob's key, and forward it to Bob:

This example[4][5][6] shows the need for Alice and Bob to have some way to ensure that they are truly using each individual private key, rather than the public key of an attacker. Otherwise, such attacks are generally possible, in principle, against any message sent using public-key or private_key technology. A variety of techniques can help defend against attacks.

Detection and Defense

MITM attacks are largely detected, or prevented by two means: authentication, and tamper detection. Authentication provides some degree of a guarantee that a given message has come from a source. Means of tamper detection, by comparison, merely shows evidence that a message may have been altered, rather than providing any guarantees.


All systems that are secure against MITM attacks provide some method of authentication for messages. Most require an exchange of information (such as public keys) in addition to the message over a secure channel. Such protocols often use key-agreement protocols have been developed, with different security requirements for the secure channel, though some have attempted to remove the requirement for any secure channel at all.[7]

A public key infrastructure, such as Transport Layer Security, may harden Transmission Control Protocol against Man-in-the-middle-attacks. In such structures, clients and servers exchange certificates which are issued and verified by a trusted third party called a certificate authority (CA). If the original key to authenticate this CA has not been itself the subject of a MITM attack, then the certificates issued by the CA may be used to authenticate the messages sent by the owner of that certificate. Use of mutual authentication, in which both the server and the client validate the other's communication, covers both ends of a MITM attack, though the default behavior of most connections is to only authenticate the server.

Attestments, such as verbal communications of a shared value (as in ZRTP), or recorded attestments such as audio/visual recordings of a public key hash[8] are used to ward off MITM attacks, as visual media is much more difficult and time-consuming to imitate than simple data packet communication. However, these methods require a human in the loop in order to successfully initiate the transaction.

HTTP Public Key Pinning, sometimes called "certificate pinning", helps prevent a MITM attack in which the certificate authority itself is compromised, by having the server provide a list of "pinned" public key hashes during the first transaction. Subsequent transactions then require one or more of the keys in the list must be used by the server in order to authenticate that transaction.

Tamper Detection

Latency examination can potentially detect the attack in certain situations,[9] such as with long calculations that lead into tens of seconds like hash functions. To detect potential attacks, parties check for discrepancies in response times. For example: Say that two parties normally take a certain amount of time to perform a particular transaction. If one transaction, however, were to take an abnormal length of time to reach the other party, this could be indicative of a third party's interference inserting additional latency in the transaction.

Quantum Cryptography, in theory, provides tamper-evidence for transactions through the no-cloning theorem. Protocols based on quantum cryptography typically authenticate part or all of their classical communication with an unconditionally secure authentication scheme e.g. Wegman-Carter authentication.[10]

DNSSEC extends the DNS protocol to use signatures to authenticate DNS records, preventing simple MITM attacks from directing a client to a malicious IP address.

Forensic analysis

Captured network traffic from what is suspected to be an attack can be analyzed in order to determine whether or not there was an attack and determine the source of the attack, if any. Important evidence to analyze when doing network forensics of a suspected attack include:[11]

  • IP address of the server
  • DNS name of the server
  • X.509 certificate of the server
    • Is the certificate self signed?
    • Is the certificate signed by a trusted CA?
    • Has the certificate been revoked?
    • Has the certificate been changed recently?

Beyond cryptography





See also

  • Computer security – the design of secure computer systems.
  • Evil Maid Attack – attack used against full disk encryption systems
  • Man-on-the-side attack – a similar attack, giving only regular access to a communication channel.
  • Spoofing attack


  4. ^ MiTM on RSA public key encryption
  5. ^ How Encryption Works
  6. ^ Public-key cryptography
  7. ^ Merkle, Ralph C (April 1978). "Secure Communications Over Insecure Channels". Communications of the ACM. 21 (4): 294–299. doi:10.1145/359460.359473. Received August, 1975; revised September 1977 
  9. ^ Aziz, Benjamin; Hamilton, Geoff (2009). "Detecting man-in-the-middle attacks by precise timing.". 2009 Third International Conference on Emerging Security Information, Systems and Technologies: 81–86. Retrieved 2017-02-25. 
  10. ^ "5. Unconditionally secure authentication". 

External links