Thursday, 18 January 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


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

No comments:

Post a Comment