Pages

Wednesday 31 May 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 posts

Snmpcheck


"snmpcheck is a free open source utility to get information via SNMP protocols. It works fine against Windows, Linux, Cisco, HP-UX, SunOS systems and any devices with SNMP protocol support. It could be useful for penetration testing or systems monitoring. snmpcheck has been tested on GNU/Linux, *BSD, Windows systems and Cygwin. snmpcheck is distributed under GPL license and based on Athena-2k script by jshaw. " read more...

Website: http://www.nothink.org/perl/snmpcheck


Related news


  1. Hacker Tools Mac
  2. Hack Tools
  3. Hack Tools
  4. Hack Tools For Mac
  5. Hacking Tools For Mac
  6. Hack Tools For Windows
  7. Pentest Tools List
  8. Hacking Tools Mac
  9. Pentest Tools Kali Linux
  10. Hacking Tools Github
  11. Pentest Tools Nmap
  12. Free Pentest Tools For Windows
  13. Hacking Tools For Pc
  14. Hack Tools For Pc
  15. Tools 4 Hack
  16. Hack Tools Mac
  17. Hack Tools 2019
  18. Hacking Tools
  19. Hacker Tools For Windows
  20. Hacking Tools Hardware
  21. Hacker Tools Apk Download
  22. Tools For Hacker
  23. World No 1 Hacker Software
  24. Pentest Tools Bluekeep
  25. Pentest Tools Website
  26. Hackrf Tools
  27. Pentest Tools For Mac
  28. Beginner Hacker Tools
  29. Pentest Tools For Android
  30. Hack App
  31. Pentest Tools Open Source
  32. Hacker Tools For Ios
  33. Wifi Hacker Tools For Windows
  34. Hacking Tools For Windows 7
  35. Github Hacking Tools
  36. Pentest Tools Open Source
  37. Hack Tools For Mac
  38. What Are Hacking Tools
  39. Best Hacking Tools 2020
  40. Nsa Hack Tools Download
  41. Blackhat Hacker Tools
  42. Pentest Tools Nmap
  43. Hacker Search Tools
  44. Pentest Tools For Mac
  45. Hack Tools 2019
  46. Hack Tools 2019
  47. Pentest Tools For Windows
  48. Hacking Tools Pc
  49. World No 1 Hacker Software
  50. Hacking Tools Windows
  51. How To Install Pentest Tools In Ubuntu
  52. Ethical Hacker Tools
  53. Pentest Tools Review
  54. Pentest Tools Framework
  55. Black Hat Hacker Tools
  56. Hacker
  57. Pentest Tools Kali Linux
  58. Pentest Tools For Android
  59. Hacking Tools Usb
  60. Install Pentest Tools Ubuntu
  61. Hacker Tool Kit
  62. Hacker Tools Software
  63. Pentest Recon Tools
  64. Pentest Tools Linux
  65. Hacking Tools Free Download
  66. Hacker Techniques Tools And Incident Handling
  67. Hacker Tools For Mac
  68. Hacker Hardware Tools
  69. Termux Hacking Tools 2019
  70. Tools For Hacker

You have won an Le Creuset

.

You have won an Le Creuset





Your chance to receive a FREE Le Creuset

.

Your chance to receive a FREE Le Creuset





CONGRATULATIONS! You are the lucky online winner of a brand new Sweepstakes Le Creuset entry!

.

CONGRATULATIONS! You are the lucky online winner of a brand new Sweepstakes Le Creuset entry!





You have won an Le Creuset

.

You have won an Le Creuset





You have won an Ultimate Nonstick Cookware

.

Congrats [aidagorgeous19.syira]





Ultimate Nonstick Cookware - Your order has shipped!

.

Ultimate Nonstick Cookware - Your order has shipped!





Your chance to receive a FREE Ultimate Nonstick Cookware

.

Your chance to receive a FREE Ultimate Nonstick Cookware





CONGRATULATIONS! You are the lucky online winner of a brand new Sweepstakes Ultimate Nonstick Cookware entry!

.

You have won an Ultimate Nonstick Cookware





You have won an Ultimate Nonstick Cookware

.

You have won an Ultimate Nonstick Cookware





Discover the natural benefits of CBD with our tasty jelly treats

.

Discover the natural benefits of CBD with our tasty jelly treats





presale:CBD Gummies May be Able to Help You

.

CBD - Get your benefits NOW





Stop Living with Anxiety, Try CBD Gummies!

.

CBD - Get your benefits NOW





Pure CBD- Relieve Anxiety, Reduce Blood Sugar Levels

.

CBD - Get your benefits NOW





Confirm Your Order Today! [5N]

.

CBD - Get your benefits NOW





Have you suffered from a stroke or seizure disorder? Pure CBD helps suppress symptoms!

.

CBD - Get your benefits NOW





CBD Gummies: Stop your pain now!

.

CBD - Get your benefits NOW





Try the Amazing Miracle

.

CBD - Get your benefits NOW





Welcome to CBD You have been selected to try Pure CBD Gummies

.

CBD - Get your benefits NOW





Stop Suffering from Anxiety, Try CBD Gummies!

.

CBD - Get your benefits NOW