29 may 2023

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. 

Read more


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

No hay comentarios: