:
:

Powered by GetResponse email marketing software

Actually Make Money Online

Your Helpful Resource About "Actually Make Money Online"

Tuesday, January 23, 2024

Emulating Shellcodes - Chapter 2

 Lets check different  Cobalt Strike shellcodes and stages in the shellcodes emulator SCEMU.




This stages are fully emulated well and can get the IOC and the behavior of the shellcode.

But lets see another first stage big shellcode with c runtime embedded in a second stage.


In this case is loading tons of API using GetProcAddress at the beginning, then some encode/decode pointer and tls get/set values to store an address. And ends up crashing because is jumping an address that seems more code than address 0x9090f1eb.

Here there are two types of allocations:


Lets spawn a console on -c 3307548 and see if some of this allocations has the next stage.

The "m" command show all the memory maps but the "ma" show only the allocations done by the shellcode.



Dumping memory with "md" we see that there is data, and dissasembling this address with "d" we see the prolog of a function.

So we have second stage unpacked in alloc_e40064


With "mdd" we do a memory dump to disk we found the size in previous screenshot,  and we can do  some static reversing of stage2 in radare/ghidra/ida

In radare we can verify that the extracted is the next stage:


I usually do correlation between the emulation and ghidra, to understand the algorithms.

If wee look further we can realize that the emulator called a function on the stage2, we can see the change of code base address and  is calling the allocated buffer in 0x4f...



And this  stage2 perform several API calls let's check it in ghidra.


We can see in the emulator that enters in the IF block, and what are the (*DAT_...)() calls

Before a crash lets continue to the SEH pointer, in this case is the way, and the exception routine checks IsDebuggerPresent() which is not any debugger pressent for sure, so eax = 0;



So lets say yes and continue the emulation.


Both IsDebuggerPresent() and UnHandledExceptionFilter() can be used to detect a debugger, but the emulator return what has to return to not be detected. 

Nevertheless the shellcode detects something and terminates the process.

Lets trace the branches to understand the logic:


target/release/scemu -f shellcodes/unsuported_cs.bin -vv | egrep '(\*\*|j|cmp|test)'



Continuing the emulation it's setting the SEH  pointer to previous stage:


Lets see from the console where is pointing the SEH chain item:


to be continued ...


https://github.com/sha0coder/scemu






Continue reading

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 articles

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