۱۴۰۲ خرداد ۱۳, شنبه

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. Hack Tools Download
  2. Black Hat Hacker Tools
  3. Pentest Reporting Tools
  4. Hack Tools
  5. Hacker Tools Mac
  6. Tools For Hacker
  7. Hacking Tools For Beginners
  8. Tools For Hacker
  9. Computer Hacker
  10. Pentest Automation Tools
  11. Best Hacking Tools 2019
  12. Hacking Tools Software
  13. Hacking Tools Kit
  14. Github Hacking Tools
  15. Pentest Tools Url Fuzzer
  16. Hackers Toolbox
  17. Hacking Tools Hardware
  18. What Are Hacking Tools
  19. Pentest Tools Apk
  20. Hacking Tools For Windows 7
  21. Hacker Tools Online
  22. How To Install Pentest Tools In Ubuntu
  23. Hacker Security Tools
  24. What Are Hacking Tools
  25. Pentest Tools Review
  26. New Hacker Tools
  27. Black Hat Hacker Tools
  28. Hacker Tools
  29. Hacking Tools Software
  30. How To Hack
  31. Pentest Reporting Tools
  32. Hack Tools 2019
  33. Pentest Tools Github
  34. Blackhat Hacker Tools
  35. Hackers Toolbox
  36. Hacker Tools For Mac
  37. Hack Tools For Ubuntu
  38. Hacker Tools List
  39. Hackers Toolbox
  40. Hacking Tools Github
  41. Hacking Tools For Mac
  42. Hack Tools For Pc
  43. Pentest Tools Github
  44. Hack Apps
  45. Pentest Tools Find Subdomains
  46. Pentest Automation Tools
  47. Underground Hacker Sites
  48. Computer Hacker
  49. Hacking Tools And Software
  50. Pentest Tools Alternative
  51. Hacker Tools Linux
  52. Hack Tools Online
  53. Pentest Tools Website
  54. Hacking Tools Github
  55. Termux Hacking Tools 2019
  56. Pentest Tools
  57. Nsa Hacker Tools
  58. Hacking Tools Name
  59. Bluetooth Hacking Tools Kali
  60. Hacking Tools Windows 10
  61. Hack Tools
  62. Hacking Tools For Windows
  63. Hacks And Tools
  64. Pentest Tools

هیچ نظری موجود نیست: