Saját bloglista

2024. január 17., szerda

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. New Hack Tools
  2. Pentest Tools For Android
  3. Nsa Hacker Tools
  4. Hacking Tools Kit
  5. Hacking Tools
  6. Hacking Tools For Kali Linux
  7. Hack Tool Apk No Root
  8. How To Install Pentest Tools In Ubuntu
  9. Pentest Tools For Android
  10. New Hacker Tools
  11. Hacking Tools For Windows Free Download
  12. Hacking Tools Github
  13. Hacking Tools For Windows Free Download
  14. Pentest Tools Website
  15. Github Hacking Tools
  16. Game Hacking
  17. Physical Pentest Tools
  18. Hacker Tools Online
  19. What Are Hacking Tools
  20. Hacker Tools Windows
  21. Hack Tools Mac
  22. Hack Tools For Windows
  23. Hackers Toolbox
  24. Hacking Tools For Windows
  25. Pentest Tools Download
  26. Pentest Tools For Ubuntu
  27. Hacking Tools 2019
  28. Kik Hack Tools
  29. Hacker Tools 2020
  30. Hack Tools For Mac
  31. What Are Hacking Tools
  32. New Hack Tools
  33. New Hacker Tools
  34. Pentest Tools Github
  35. Hacking Tools For Beginners
  36. Hacker Tools Apk Download
  37. Computer Hacker
  38. Pentest Tools Alternative
  39. Pentest Tools Windows
  40. Bluetooth Hacking Tools Kali
  41. Pentest Tools Github
  42. How To Install Pentest Tools In Ubuntu
  43. Pentest Tools Nmap
  44. Pentest Tools Online
  45. Hacker Search Tools
  46. Hacker Security Tools
  47. Hacker Tools Software
  48. Hacking Tools Software
  49. Computer Hacker
  50. Pentest Tools Online
  51. Hacking Tools For Windows
  52. Android Hack Tools Github
  53. Game Hacking
  54. Hacker Security Tools
  55. Nsa Hack Tools Download
  56. Pentest Tools Github
  57. Hacking Tools Windows 10
  58. Hacking Tools 2019
  59. Hacker Tools For Ios
  60. Hack Tool Apk No Root
  61. Hacking Tools 2020
  62. Pentest Tools Alternative
  63. Pentest Automation Tools
  64. Hacking Tools Hardware
  65. Nsa Hack Tools
  66. Computer Hacker
  67. Pentest Tools For Mac
  68. What Is Hacking Tools
  69. Hack Tools Pc
  70. Hacker Tools Free
  71. Blackhat Hacker Tools
  72. Hacker Techniques Tools And Incident Handling
  73. Hacker Tools 2019
  74. Install Pentest Tools Ubuntu
  75. Beginner Hacker Tools
  76. Beginner Hacker Tools
  77. Pentest Tools Url Fuzzer
  78. Hacking Tools
  79. Pentest Tools Subdomain
  80. Pentest Tools Review
  81. Hacker Tools For Ios
  82. Hacking Tools For Windows Free Download
  83. New Hacker Tools
  84. Pentest Reporting Tools
  85. Black Hat Hacker Tools
  86. Hack Tool Apk No Root
  87. Pentest Tools Free
  88. Growth Hacker Tools
  89. Pentest Tools Windows
  90. Hacking Tools And Software
  91. Hacker Search Tools
  92. Hack Tools For Games
  93. Pentest Tools Nmap
  94. Hacking Tools For Pc
  95. Hacking Tools Download
  96. Nsa Hack Tools Download
  97. Pentest Tools Tcp Port Scanner
  98. Hack Tools Pc
  99. Hacking Tools For Pc
  100. Top Pentest Tools
  101. Hacker Tools Free
  102. Hack Tools Github
  103. Kik Hack Tools
  104. Hack Tools For Windows
  105. Pentest Tools List