« Home | C++ Std::String Buffer Overflow And Integer Overflow » | 3069 hash passwords » | OWASP Blog Moved To Website » | Masad Clipper And Stealer - Windows Spyware Exfilt... » | Arris Cable Modem Backdoor - I'm A Technician, Tru... » | Learning Web Pentesting With DVWA Part 1: Installa... » | 2020-12-13 SUNBURST SolarWinds Backdoor Samples » | 2350 Interesting News » | 2346 Interesting News » | 2319 Interesting News »

Practical Dictionary Attack On IPsec IKE

We found out that in contrast to public knowledge, the Pre-Shared Key (PSK) authentication method in main mode of IKEv1 is susceptible to offline dictionary attacks. This requires only a single active Man-in-the-Middle attack. Thus, if low entropy passwords are used as PSKs, this can easily be broken.

This week at the USENIX Security conference, Dennis Felsch will present our research paper on IPsec attacksThe Dangers of Key Reuse: Practical Attacks on IPsec IKE. [alternative link to the paper]

In his blog post, Dennis showed how to attack the public key encryption based authentication methods of IKEv1 (PKE & RPKE) and how to use this attack against IKEv2 signature based authentication method. In this blog post, I will focus on another interesting finding regarding IKEv1 and the Pre-Shared Key authentication.

IPsec and Internet Key Exchange (IKE)

IPsec enables cryptographic protection of IP packets. It is commonly used to build VPNs (Virtual Private Networks). For key establishment, the IKE protocol is used. IKE exists in two versions, each with different modes, different phases, several authentication methods, and configuration options. Therefore, IKE is one of the most complex cryptographic protocols in use.

In version 1 of IKE (IKEv1), four authentication methods are available for Phase 1, in which initial authenticated keying material is established: Two public key encryption based methods, one signature based method, and a PSK (Pre-Shared Key) based method.

The relationship between IKEv1 Phase 1, Phase 2, and IPsec ESP. Multiple simultaneous Phase 2 connections can be established from a single Phase 1 connection. Grey parts are encrypted, either with IKE derived keys (light grey) or with IPsec keys (dark grey). The numbers at the curly brackets denote the number of messages to be exchanged in the protocol.

Pre-Shared Key authentication

As shown above, Pre-Shared Key authentication is one of three authentication methods in IKEv1. The authentication is based on the knowledge of a shared secret string. In reality, this is probably some sort of password.

The IKEv1 handshake for PSK authentication looks like the following (simplified version):


In the first two messages, the session identifier (inside HDR) and the cryptographic algorithms (proposals) are selected by initiator and responder. 

In messages 3 and 4, they exchange ephemeral Diffie-Hellman shares and nonces. After that, they compute a key k by using their shared secret (PSK) in a PRF function (e.g. HMAC-SHA1) and the previously exchanged nonces. This key is used to derive additional keys (ka, kd, ke). The key kd is used to compute MACI over the session identifier and the shared diffie-hellman secret gxy. Finally, the key ke is used to encrypt IDI (e.g. IPv4 address of the peer) and MACI

Weaknesses of PSK authentication

It is well known that the aggressive mode of authentication in combination with PSK is insecure and vulnerable against off-line dictionary attacks, by simply eavesedropping the packets. For example, in strongSwan it is necessary to set the following configuration flag in order to use it:
charon.i_dont_care_about_security_and_use_aggressive_mode_psk=yes

For the main mode, we found a similar attack when doing some minor additional work. For that, the attacker needs to waits until a peer A (initiator) tries to connect to another peer B (responder). Then, the attacker acts as a man-in-the middle and behaves like the peer B would, but does not forward the packets to B.

From the picture above it should be clear that an attacker who acts as B can compute (gxy) and receives the necessary public values session ID, nI, nR. However, the attacker does not know the PSK. In order to mount a dictionary attack against this value, he uses the nonces, and computes a candidate for for every entry in the dictionary. It is necessary to make a key derivation for every k with the values of the session identifiers and shared Diffie-Hellmann secret the possible keys ka, kd and ke. Then, the attacker uses ke in order to decrypt the encrypted part of message 5. Due to IDI often being an IP address plus some additional data of the initiator, the attacker can easily determine if the correct PSK has been found.

Who is affected?

This weakness exists in the IKEv1 standard (RFC 2409). Every software or hardware that is compliant to this standard is affected. Therefore, we encourage all vendors, companies, and developers to at least ensure that high-entropy Pre-Shared Keys are used in IKEv1 configurations.

In order to verify the attack, we tested the attack against strongSWAN 5.5.1.

Proof-of-Concept

We have implemented a PoC that runs a dictionary attack against a network capture (pcapng) of a IKEv1 main mode session. As input, it also requires the Diffie-Hellmann secret as described above. You can find the source code at github. We only tested the attack against strongSWAN 5.5.1. If you want to use the PoC against another implementation or session, you have to adjust the idHex value in main.py.

Responsible Disclosure

We reported our findings to the international CERT at July 6th, 2018. We were informed that they contacted over 250 parties about the weakness. The CVE ID for it is CVE-2018-5389 [cert entry].

Credits

On August 10th, 2018, we learned that this attack against IKEv1 main mode with PSKs was previously described by David McGrew in his blog post Great Cipher, But Where Did You Get That Key?. We would like to point out that neither we nor the USENIX reviewers nor the CERT were obviously aware of this.
On August 14th 2018, Graham Bartlett (Cisco) email us that he presented the weakness of PSK in IKEv2 in several public presentations and in his book.
On August 15th 2018, we were informed by Tamir Zegman that John Pliam described the attack on his web page in 1999.

FAQs

  • Do you have a name, logo, any merchandising for the attack?
    No.
  • Have I been attacked?
    We mentioned above that such an attack would require an active man-in-the-middle attack. In the logs this could look like a failed connection attempt or a session timed out. But this is a rather weak indication and no evidence for an attack. 
  • What should I do?
    If you do not have the option to switch to authentication with digital signatures, choose a Pre-Shared Key that resists dictionary attacks. If you want to achieve e.g. 128 bits of security, configure a PSK with at least 19 random ASCII characters. And do not use something that can be found in public databases.
  • Am I safe if I use PSKs with IKEv2?
    No, interestingly the standard also mentions that IKEv2 does not prevent against off-line dictionary attacks.
  • Where can I learn more?
    You can read the paper[alternative link to the paper]
  • What else does the paper contain?
    The paper contains a lot more details than this blogpost. It explains all authentication methods of IKEv1 and it gives message flow diagrams of the protocol. There, we describe a variant of the attack that uses the Bleichenbacher oracles to forge signatures to target IKEv2. 

Related posts


  1. Android Hack Tools Github
  2. Hacker Tools Apk
  3. Hacker Search Tools
  4. Android Hack Tools Github
  5. How To Make Hacking Tools
  6. Pentest Tools Alternative
  7. Pentest Tools Download
  8. Computer Hacker
  9. Pentest Tools For Mac
  10. Pentest Tools Nmap
  11. Beginner Hacker Tools
  12. Hacking Tools Github
  13. World No 1 Hacker Software
  14. Pentest Automation Tools
  15. Hack And Tools
  16. Hacker
  17. Hacking Tools Mac
  18. New Hacker Tools
  19. Kik Hack Tools
  20. Hack Tools Github
  21. Tools Used For Hacking
  22. Hack Tools For Mac
  23. Hacker Tools 2019
  24. Hacker Tools Apk Download
  25. Pentest Tools Port Scanner
  26. Hack Tool Apk No Root
  27. Pentest Tools Url Fuzzer
  28. Underground Hacker Sites
  29. Hacking Tools Software
  30. Pentest Recon Tools
  31. Hacking App
  32. Termux Hacking Tools 2019
  33. Hack Tools For Ubuntu
  34. Pentest Tools Subdomain
  35. Pentest Tools Port Scanner
  36. Hacking App
  37. Physical Pentest Tools
  38. Bluetooth Hacking Tools Kali
  39. Best Pentesting Tools 2018
  40. Hacking Tools For Beginners
  41. Computer Hacker
  42. Hack Tools For Pc
  43. Pentest Tools Review
  44. Pentest Tools Linux
  45. Hacking Tools Software
  46. Hacking Tools 2019
  47. Hack Tools For Ubuntu
  48. Hacking Tools
  49. Bluetooth Hacking Tools Kali
  50. Ethical Hacker Tools
  51. Pentest Tools Alternative
  52. Pentest Tools Url Fuzzer
  53. Hacking Tools Online
  54. Hacking Tools And Software
  55. Pentest Tools Linux
  56. Hacker Tools Mac
  57. Hacking Tools 2019
  58. Hackers Toolbox
  59. New Hack Tools
  60. Hacking Tools For Windows
  61. Top Pentest Tools
  62. Hack Tools For Windows
  63. Ethical Hacker Tools
  64. Tools For Hacker
  65. How To Hack
  66. Pentest Tools Open Source
  67. Pentest Tools Android
  68. Hacker Tools Github
  69. Pentest Tools Subdomain
  70. Hacker Tools Online
  71. Pentest Tools Tcp Port Scanner
  72. Pentest Tools Free
  73. Hacking Tools For Kali Linux
  74. Pentest Tools Online
  75. Hacker Tools Free
  76. Hacking Tools
  77. Pentest Tools Subdomain
  78. Hacker Tools Hardware
  79. Pentest Reporting Tools
  80. Pentest Tools Url Fuzzer
  81. Tools For Hacker
  82. Top Pentest Tools
  83. Hacker Tools Apk Download
  84. Hack App
  85. Hacking Tools For Pc
  86. Hacker Tools Free Download
  87. Hacking Tools For Windows
  88. Hack Tools Mac
  89. Hacker Tool Kit
  90. Hack And Tools
  91. Hacker Tools Online
  92. Hack Tool Apk
  93. Beginner Hacker Tools
  94. World No 1 Hacker Software
  95. Kik Hack Tools
  96. Hack Tools
  97. Hack Tools For Windows
  98. Ethical Hacker Tools
  99. Hacker Tools
  100. Hacker Tools Github
  101. Pentest Tools For Android
  102. Hacker Tools 2020
  103. Hacking Tools For Windows
  104. Hacking Tools Hardware
  105. Pentest Tools Online
  106. Hacking Apps
  107. Hack Tool Apk No Root
  108. Tools 4 Hack
  109. Pentest Tools Tcp Port Scanner
  110. Hack And Tools
  111. Hacker Tools Free Download
  112. Pentest Tools Windows
  113. Pentest Tools Online
  114. Hacking Tools Software
  115. Hacking Tools Mac
  116. Hacking Tools For Windows
  117. How To Install Pentest Tools In Ubuntu
  118. Hacking Tools
  119. World No 1 Hacker Software
  120. Hacker Tools 2019
  121. Hack App
  122. Hacker
  123. Hack Tool Apk
  124. Usb Pentest Tools
  125. Pentest Tools Kali Linux
  126. Hacker Tools Github
  127. Hack Tools Online
  128. Hacking Tools Kit
  129. Pentest Box Tools Download
  130. Pentest Tools For Windows
  131. How To Install Pentest Tools In Ubuntu
  132. Pentest Tools Port Scanner
  133. Nsa Hack Tools
  134. Hacking Tools And Software
  135. Wifi Hacker Tools For Windows
  136. Hacking Tools 2019
  137. Hack Tools For Pc
  138. Pentest Tools Review
  139. Pentest Tools Alternative
  140. Hack Tools
  141. Pentest Tools Port Scanner
  142. Hacker Tools Linux
  143. Hacker Tools For Windows
  144. Physical Pentest Tools
  145. Hacking Apps
  146. Pentest Tools For Mac
  147. Hack Tool Apk
  148. Hacks And Tools
  149. Hacking Tools Name
  150. Pentest Tools Subdomain
  151. Pentest Tools Url Fuzzer
  152. Hacking Tools Online
  153. New Hacker Tools
  154. Hacker Tools Windows
  155. Hacking Tools For Beginners
  156. Bluetooth Hacking Tools Kali
  157. Hack App
  158. Pentest Tools Linux
  159. Hacking Tools For Beginners
  160. Hacker Hardware Tools
  161. Hacker Tools 2019
  162. How To Make Hacking Tools
  163. Hacking Tools Mac
  164. Hacker Tools Online
  165. Hack Tools For Pc
  166. Best Pentesting Tools 2018
  167. Hacking Tools
  168. Hacking Tools For Windows Free Download
  169. Hack Tools For Windows
  170. Pentest Tools