Wednesday, January 24, 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 articles

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

No comments:

Post a Comment