METASPLOIT

Samyak
QuikNapp
Published in
4 min readAug 7, 2020

WHAT IS METASPLOIT?

The Metasploit framework is a very powerful tool which can be used by cybercriminals as well as ethical hackers to probe systematic vulnerabilities on networks and servers. Because it’s an open-source framework, it can be easily customized and used with most operating systems.

Due to its wide range of applications and open-source availability, Metasploit is used by everyone from the evolving field of DevSecOps pros to hackers. It’s helpful to anyone who needs an easy to install, reliable tool that gets the job done regardless of which platform or language is used. The software is popular with hackers and widely available, which reinforces the need for security professionals to become familiar with the framework even if they don’t use it.

Metasploit now includes more than 1677 exploits organized over 25 platforms, including Android, PHP, Python, Java, Cisco, and more.

HOW TO SETUP METASPLOIT?

Setup your metasploit

You get metasploit by default with kali linux . Also you can install it using the following commands.

Since Metasploit depends on PostgreSQL for database connection, to install it on Debian/Ubuntu based systems run:

apt install postgresql

You can download and install metasploit from: https://github.com/rapid7/metasploit-framework

After installation our task is to setup and run metasploit for that we can use following commands:

1. First we’ll start the PostgreSQL database service by running the following command:

/etc/init.d/postgresql start

Or

service postgresql start

2. To create the database run:

msfdb init

3. Now we’re good to go , run metasploit using following command:

msfconsole

4. After running you’ll get a msf > prompt

Type db_status to check if services are running fine .

How to load and use exploit in metasploit.

To find an exploit we use “search” command.

Metasploit fetches a list of relevant exploit to use alongwith its description.

Let we choose one to bruteforce ssh login, i.e, exploit no.17.

To use an exploit we have “use” command.

We can use either path or exploit no.

Command > use 17

It will load the exploit as use see in screenshot i.e,auxillary(scanner/ssh/ssh_login).

“Show options” command will show all the options with proper description.

We will use “set” command to change current settings.

Rhosts is the victim ip and username is the default username.

Pass_file set password wordlist use to bruteforce.

Verbose will print all the output(Failed and Success).

“Exploit” command will use current settings to bruteforce.

And finally we get the password and are able to login using this password.

Note:-I have used hydra machine from TryHackMe. And used metasploit instead of hydra to demonstrate how metasploit works.

ADVANTAGES

1. It is open source and actively developed

2. It allows users to access its source code and add custom modules

3. Msfvenom-Generating shell code to use in manual exploits also becomes easy by using the msfvenom application from the command line.

4. Knowing the target- Doing Active and passive scans, which include port scanning, banner grabbing, and various other scans, depends upon the type of target.

5. To conduct internal footprinting, NMAP proves as one of the finest available tools as we discussed in our previous post.

6. Metasploit has inbuilt database functionalities, which can be used to perform NMAP scans from within the Metasploit framework console and store the results in the database.

--

--