Minggu, 04 Juni 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 word

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

Tidak ada komentar:

Posting Komentar