w0dm4n / Pestilence

Trojan on ELF executable
10 stars 7 forks source link

Binary to shellcode ? #1

Open suriya73 opened 6 years ago

suriya73 commented 6 years ago

is that possible to make binary file to shellcode ?

w0dm4n commented 6 years ago

Yes, you can dump the hexa from the binary with some simple command:

hexdump -v -e '"\""x" 1/1 "%02x" ""' binaryname

You can also do something like

mov rsi, rdi mov rdi, 1 mov rdx, 6 syscall

Then get the hexcode from an online assembler:

"\x48\xc7\xc0\x01\x00\x00\x00\x48\xc7\xc7\x01\x00\x00\x00\x48\xc7\xc2\x06\x00\x00\x00\x0f\x05"

Save it on a buffer and do a mmap with exec right, then you can call it by ptr("hello\n"); and it will print it