sexta-feira, 26 de maio de 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





More articles

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

0 comentários:

Postar um comentário