Sunday, January 28, 2024

Fast Emulator For Shellcodes In Rust

I have developed a fast emulator for modern shellcodes, that perform huge loops of millions of instructions emulated for resolving API or for other stuff.

The emulator is in Rust and all the few dependencies as well, so the rust safety is good for emulating malware.  

There are shellcodes that can be emulated from the beginning to the end, but when this is not possible the tool has many features that can be used like a console, a memory tracing, register tracing, and so on.

https://github.com/sha0coder/scemu



In less than two seconds we have emulated 7 millions of instructions arriving to the recv. 

At this point we have some  IOC like  the ip:port where it's connecting and other details.

Lets see what happens after the recv() spawning a console at position: 7,012,204


target/release/scemu -f shellcodes/shikata.bin -vv -c 7012204



In the console, pressing "enter" several times to emulate  step into several steps and we arrive to a return instruction.


Let's see the stack in this moment:


The "ret" instruction is going to jump to the buffer read with recv() so is a kind of stager.

The option "-e" or "--endpoint" is not ready for now, but it will allow to proxy the calls to get the next  stage automatically, but for now we have the details to get the stage.


SCEMU also identify all the Linux  syscalls for 32bits shellcodes:



The encoder used in shellgen is also supported https://github.com/MarioVilas/shellgen

Let's check with cobalt-strike:


We can see where is connecting and which headers is using, so right now we can replicate the communications.



In verbose mode we could do several greps to see the calls and correlate with ghidra/ida/radare or  for example grep the branches to study the emulation flow.


target/release/scemu -f shellcodes/rshell_sgn.bin -vv | grep j


target/release/scemu -f shellcodes/rshell_sgn.bin -vv -c 44000 -l


The -l --loops options makes the emulation a bit slower but track the number of iterations.

Is possible to print all the registers in every step with  -r or --registers  but also is possible to track  specific register for example with --reg esi


target/release/scemu -f shellcodes/shikata.bin --reg esi 


In this case ESI register points to the API name, if we track EAX or ECX will see that are the counters of the loop. These shellcodes  contains a hard loop to locate the API names.

The flag -i or --inspect allow to monitor memory using expressions like "dword ptr [eax + 0xa]"

target/release/scemu -f shellcodes/shikata.bin -i 'dword ptr [esi]'

And more things to come...  find a demo below:

https://www.youtube.com/watch?v=qTYmMjW3DFs





Related news


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