MetaSploit tutorial for beginners
This tutorial is to be a starting guide for metasploit. It assumes that you already have metasploit installed, or that you are running kali / backtrack linux.
References used:
Basic concept of metasploit:
– Run msfconsole
– Identify a remote host
– Pick a vulnerability and use an exploit
– Configure the exploit
– Execute the payload against the remote host
Start the database service
In kali linux
1 | applications>kali linux>system services>metasploit>start |
Run msfconsole
In kali linux, choose
1 | applications>kali linux>top10security tools>metasploit framework |
or open a terminal and type
1 | msfconsole |
You will meet with the following:
This is msfconsole. Msfconsole is the main interface to metasploit. There are GUI interfaces (armitage), and a web interface too (websploit). With msfconsole, you can launch exploits, create listeners, configure payloads etc.
Getting help
Metasploit has lots of great documentation built in. Type help to get a basic list of commands.
1 | help show |
Will give you the help section for the show command.
1 | help search |
Will give you the help section for the search command.
If you get the error ‘Database not connected or cache not built’ use ‘db_status’ to see if the database connected. if not, start the database (instructions above) and re-start msfconsole. If ‘db_status’ reports ‘connected’ then run the ‘db_rebuild_cache’ command to rebuild your database cache.
Identify a remote host
You can run nmap inside msfconsole and save its output into the metasploit database.
1 | db_nmap–v–sV host_or_network_to_scan |
This is a handy way to get an initial list of hosts on your network. To show a list of all available port scanners:
1 | search portscan |
More examples of portscanning into the metasploit database are here:
To list all the hosts found by nmap:
1 | hosts |
To add these hosts to your list of remote targets
1 | hosts–R |
Pick a vulnerability and use an exploit
Once you know what your remote hosts system is (nmap, lynix, maltego, wp-scan, etc) you can pick an exploit to test. rapid7 have an easy way to find exploits. There is also a way to search within msfconsole for various exploits:
1 2 3 4 | search type:exploit search CVE–XXXX–XXXX search cve:2014 search name:wordpress |
See metasploit unleashed for more examples of the search command
Once you have decided on an exploit to use, issue the following command into msfconsole:
1 | useexploit/path/to/exploit_name |
eg: use exploit/unix/webapp/php_wordpress_total_cache
From this point on, the available options change based on the exploit you are using, but you can get a list of the available options with:
1 | show payloads |
For a list of the available targets:
1 | show targets |
Configure the exploit
In Metasploit each exploit has a set of options to configure for your remote host:
1 | show options |
This gives a list. You need to set the options with ‘yes’ next to them.
1 | set RHOST192.168.0.15 |
If you issues the ‘hosts -R’ command then you will see that the remote hosts parameters are already filled in for you.
Execute the exploit against the remote host
1 | run |
or
1 | exploit |
If successful, you’ll know. If not, then try again with a different exploit 😉
jonathansblog.co.uk
Lượt xem (636)
Để lại bình luận: