lunes, 22 de enero de 2024

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. Pentest Tools Bluekeep
  2. Pentest Tools For Mac
  3. Pentest Tools For Android
  4. Pentest Tools
  5. Pentest Tools Linux
  6. Tools Used For Hacking
  7. Hacking Tools Download
  8. Hack Tools 2019
  9. Hacker Tools List
  10. Hacker Tools For Windows
  11. Pentest Tools Apk
  12. Hack App
  13. Pentest Tools Find Subdomains
  14. Beginner Hacker Tools
  15. Computer Hacker
  16. Pentest Tools Free
  17. Hacker Hardware Tools
  18. What Is Hacking Tools
  19. Pentest Tools Find Subdomains
  20. Pentest Tools Online
  21. Hacking Tools Kit
  22. Hacker Tools Linux
  23. Install Pentest Tools Ubuntu
  24. Hak5 Tools
  25. Hacking Tools Pc
  26. Hacking Tools Software
  27. Hacker Search Tools
  28. New Hacker Tools
  29. Hacking Tools For Beginners
  30. Game Hacking
  31. How To Hack
  32. Hacking Tools Usb
  33. Hack App
  34. Pentest Tools Port Scanner
  35. New Hack Tools
  36. Hacker Tools Github
  37. Hack Tool Apk
  38. Pentest Tools Website
  39. Hak5 Tools
  40. Hacking Tools For Pc
  41. Best Hacking Tools 2020
  42. Pentest Tools
  43. Hacker
  44. Game Hacking
  45. How To Hack
  46. Hacking Tools For Games
  47. How To Make Hacking Tools
  48. Physical Pentest Tools
  49. Black Hat Hacker Tools
  50. Hacking Tools Mac
  51. Hacking Tools Usb
  52. Hacker Tools Apk
  53. Hack Tools For Ubuntu
  54. Hacker Tools Free
  55. Pentest Tools For Ubuntu
  56. Hacking Tools For Windows 7
  57. Pentest Tools Online
  58. Hacker Tools Hardware
  59. Hack Tools Download
  60. Hack App
  61. Hack Tools
  62. Hacking Tools Hardware
  63. Pentest Tools Open Source
  64. Usb Pentest Tools
  65. Hacker Tools Apk
  66. Pentest Tools Port Scanner
  67. Nsa Hack Tools
  68. Computer Hacker
  69. What Are Hacking Tools
  70. Hacker Tools Hardware
  71. Hacking Tools 2019
  72. Pentest Tools Find Subdomains
  73. Pentest Tools For Mac
  74. Hacker Tools For Windows
  75. Black Hat Hacker Tools
  76. Hacker Tools
  77. New Hacker Tools
  78. Hacker Tools Software
  79. Hacker Tools 2020
  80. Pentest Tools Apk
  81. Hack And Tools
  82. Pentest Tools Free
  83. Pentest Tools Website
  84. Hacker Tools Online
  85. Pentest Tools Tcp Port Scanner
  86. Pentest Box Tools Download
  87. Pentest Tools Bluekeep
  88. Hacking Tools For Windows Free Download
  89. Hack Tools Online
  90. Hacker Tools Free Download
  91. Hack Tools For Mac
  92. Hacking Tools For Pc
  93. Android Hack Tools Github
  94. Pentest Tools Find Subdomains
  95. Pentest Tools Port Scanner
  96. Hacker Tools Github
  97. Hack Rom Tools
  98. Android Hack Tools Github
  99. Hack Website Online Tool
  100. Hacker Tools For Ios
  101. Hack Tools For Ubuntu
  102. Hack Tools For Games
  103. Hacker Tools 2019
  104. Hacking Tools 2019
  105. Best Pentesting Tools 2018
  106. Beginner Hacker Tools
  107. Hack Tools Download
  108. Pentest Tools Open Source

No hay comentarios:

Publicar un comentario

Seguidores

Archivo del blog