Monday, June 5, 2023

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

No comments:

Post a Comment