Monday, May 29, 2023

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






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

No comments:

Post a Comment