Msfconsole kali linux install

Metasploit Tutorial on Kali Linux [Step-by-Step]

In this post, we are going to dive into the most popular penetration testing framework — Metasploit. We will look at ‘What is the Metasploit framework,’ ‘the Installation process,’ and how to use it in ethical hacking. Let’s get started.

What is the Metasploit Framework?

The Metasploit framework is the leading exploitation framework used by Penetration testers, Ethical hackers, and even hackers to probe and exploit vulnerabilities on systems, networks, and servers. It is an open-source utility developed by Rapid7 software company, which has also designed other security tools, including the Nexpose vulnerability scanner. For anybody aspiring to get in the security field, you need to master the Metasploit framework to prosper.

Metasploit Framework Interfaces

Metasploit is available in four (4) interfaces:

  • msfcli: Commonly written as ‘MSFcli.’ It is a single command-line interface for the Metasploit framework.
  • msfconsole: It is the most popular Metasploit interface for the Metasploit framework. It gives you an interactive shell where you can execute commands and run exploits.
  • msfweb: It is the web interface of Metasploit that allows you to set up projects and carry out penetration testing tasks.
  • Armitage: It is the Graphical User Interface (GUI) front-end for Metasploit developed in Java.

The msfconsole is the most popular interface for Metasploit, and it’s also the interface we will be using in this post.

Why Learn and Use Metasploit?

Before tools like Metasploit came along, penetration testers had to carry out all tasks manually using various tools, some not even supported by the target system. They had to code their tools and scripts from scratch before deploying them manually on the target system or network. A term like ‘Remote testing’ used today was uncommon. However, that has changed with Metasploit.

This framework comes with more than 1677 exploits (regularly updated) for over 25 platforms. That includes Android, Windows, Linux, PHP, Java, Cisco, etc. It also comes with more than 500 payloads which include:

  • Dynamic payloads that enable users to generate payloads and scripts that are undetectable by antiviruses.
  • Command shell payloads that enable users to gain access and execute commands/ scripts on the target machine.
  • Meterpreter payloads provide users with an interactive command-line shell that you can use to explore and exploit the target machine.

Minimum System Requirements for Metasploit

Metasploit is available for various platforms (thanks to open-source installers available on the Rapid7 website). The framework supports Debian-based systems, RHEL-based systems, Windows Server 2008 or 2012 R2, Windows 7 SP1+, 8.1, or 10, and more. You can also run Metasploit on Android using applications like Termux.

Читайте также:  Запустить скрипт php linux

Even though you can easily install Metasploit on your Linux or Windows system, it’s highly recommended you use Metasploit on penetration testing distributions like Kali Linux or Parrot OS. These distributions ship with Metasploit installed and many other hacking tools required for ethical hacking and security auditing.

The minimum hardware requirements for running Metasploit are:

  • 512 MB RAM if you are using a system without GUI. The higher, the better.
  • 2 GB RAM if you are using a Graphical system. The higher, the better.
  • 1 GB Disk space

Getting Started With the Metasploit Framework

In this post, we will run Metasploit on Kali Linux. Kali Linux is the leading penetration testing distribution and ships with more than 600 security tools. You can checkout our step-by-step guide on installing Kali Linux on VirtualBox.

1. Start the PostgreSQL Database Service

To get started Metasploit framework, you need to start the PostgreSQL database. That enables Metasploit to carry out faster searches and store information when scanning or performing an exploit. Launch the Terminal and execute the command below.

sudo service postgresql start
sudo msfdb init

Metasploit Tutorial on Kali Linux [Step-by-Step]

2. Launch Metasploit

As discussed above, there are four interfaces available for use with the Metasploit framework. We will use the msfconsole in this post. Now, there are two ways you can use to launch msfconsole on Kali Linux.

With the command-line method, execute the command below on your Terminal.

Metasploit Tutorial on Kali Linux [Step-by-Step]

Alternatively, you can start msfconsole from the Kali GUI by clicking on the Menu button -> Exploitation tools -> Metasploit framework.

Metasploit Tutorial on Kali Linux [Step-by-Step]

That will open the Terminal, and you will be prompted to enter the user password before launching the msfconsole command-line shell.

Metasploit Tutorial

After successfully launching msfconsole , you will see a Terminal prompt with the format msf[metasploit_version] . For example, in our case, we are getting a msf5 > prompt, as shown below. That means we are running Metasploit version 5. If you are using a newer version, say Metasploit version 6, you will see a msf6 > prompt.

Metasploit Tutorial on Kali Linux [Step-by-Step]

1. help command

The first and the most basic command you should execute is the help command. If you are lost and don’t know which command to use, you can always refer to this documentation. It shows you all the commands you can run and a description of what they do.

Metasploit Tutorial on Kali Linux [Step-by-Step]

Metasploit exploits an existing vulnerability on a system. Therefore, if there is no vulnerability or it’s already patched, Metasploit won’t penetrate the system.

2. search command

The other very useful command is search . It allows you to search for a particular module among the hundreds of modules available in Metasploit. This command can take three parameters:

For example, I will use the syntax below to search for a common Unix exploit for VSFTPD version 2.3.4.

search type:exploit platform:unix vsftpd

Metasploit Tutorial on Kali Linux [Step-by-Step]

3. use command

The other most helpful command is the use command. It allows you to load a module that you want to use to attack or penetrate a system. These modules include exploits, payloads, auxiliaries, encoders, evasions, nops, and posts.

Читайте также:  Linux mint загрузка системы

As a demonstration, we will use a module to exploit an existing vulnerability on VSFTPD version 2.3.4. On the msfconsole, run the use command below to load our vsftpd_234_backdoor exploit.

use exploit/unix/ftp/vsftpd_234_backdoor

Metasploit Tutorial on Kali Linux [Step-by-Step]

If the module were successfully loaded, the prompt would change, as shown in the image above. It appends the path of the module in a different color (mostly red). If you see a similar message like «No payload configured, defaulting to. « don’t worry. It means Metasploit could not automatically load the payload, and you will need to do it manually. In simple terms, a Payload is the code/ script executed through the said exploit.

4. show options command

After successfully loading a module, the following command you need to execute is the show options command.

Metasploit Tutorial on Kali Linux [Step-by-Step]

This command shows you the different options you can change with the module. For example, in the image above, we see this module requires us to set the RHOST and RPORT.

  • RHOST: That is the IP address of the remote system that you want to exploit.
  • RPORT: That is the target port you wish to use on the target system.

5. set command

The other helpful command is set . This one allows you to set the various value displayed using the show options command. For example, if you wish to assign values to RHOST and RPORT we would use the syntax below.

set RHOST [target_IP]
set RPORT [traget_Port]
e.g
set RHOST 192.168.1.43
set RPORT 21

Metasploit Tutorial on Kali Linux [Step-by-Step]

If you rerun the show options command, you will notice there is a difference. The options RHOSTS and RPORT now have values assigned to them.

Metasploit Tutorial on Kali Linux [Step-by-Step]

Some modules will have several options to set (more than six). In case you find some terms hard to understand their meaning, you can always use the help command.

6. show payloads command

The other command you need to run after this step is show payloads . This command lists all the payloads compatible with this module.

Metasploit Tutorial on Kali Linux [Step-by-Step]

Running this command on our module only gave us one compatible payload. However, some modules will have more than ten compatible modules to choose from.

7. set payload command

To load a particular payload, use the set command as shown below.

set payload cmd/unix/interact

Metasploit Tutorial on Kali Linux [Step-by-Step]

8. run command

After successfully loading the payload, you are now ready to run this exploit against an existing vulnerability on the target system. Execute the command below.

Metasploit Tutorial on Kali Linux [Step-by-Step]

From the image above, you can see we successfully ran the exploit against a target system and obtained a command shell session. That means we are now inside the system, and we can now run any Linux commands from our msfconsole, and they will execute on our target system.

Читайте также:  Linux info cpu ram

Conclusion

That’s it! I believe you now have a good understanding of the Metasploit framework and how to get started. If you are setting foot in the security field, please check out our post on Setting Up a Hacking Lab with Metasploitable. That is an intentionally vulnerable machine that helps you learn Metasploit at an in-depth level, as there are so many vulnerabilities in this system that you can exploit.

Didn’t find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Leave a Comment Cancel reply

Ethical Hacking Tutorial

  • Install Kali Linux
    • Create Kali Linux bootable USB
    • Dual boot Ubuntu with Kali Linux
    • Install Kali Linux on VirtualBox
    • Install Kali Linux on Raspberry Pi
    • Install Kali Linux on Android
    • Install Kali Linux on Apple M1 with UTM
    • Setup Virtual PenTesting Lab
    • Setup Android Pentesting Lab
    • Setup Hacking Lab
    • Manage Pentest Projects with Cervantes
    • Nettacker — Automated Pentesting Framework
    • MobSF: Android App Pentesting
    • APKHunt: Android App Pentesting
    • Hack Social Media Accounts — ZPhisher
    • Analyze phishing email — Thephish
    • Install Gophish phishing framework
    • Gophish Phishing Campaign
    • FiercePhish Phishing Campaign
    • Snapchat Phishing using Grayfish
    • Using SocialFish to Hack Credentials
    • Social Engineering Toolkit Credentials Phishing
    • Lockphish V2.0 PIN phishing attack
    • Evil Twin WiFi Attack with Airgeddon
    • Browser-in-the-Browser Attack
    • Install Caine OS for Forensic Analysis
    • Install Metasploit Framework
    • Install OWASP Juice Shop
    • Install DVWA
    • Install Tor Browser
    • Install Pyrit
    • Embed payload in PDF File
    • Embed Metasploit Payload on APK
    • Payload Injection — Shellter
    • Obfuscate Android Payload — ApkBleach
    • Create windows undetectable payload — Technowlogger
    • Learn hacking with Metasploitable
    • Network Reconnaissance with Nmap
    • BEeF Hacking Framework
    • Intercept Network Traffic
    • Track IP Address using Image
    • Find Hidden Endpoints
    • Using WiFi Honeypot for Ethical Hacks
    • Hack Wi-Fi password
    • Encode message in image — Steganography
    • Shodan — The Search Engine for Hackers
    • L3MON — Hack Android Mobile Remotely
    • Torshammer — Perform DDoS attack
    • Local File Inclusion Attack
    • Using Xerosploit
    • Using Arpspoof
    • DVWA SQL Injection Exploitation
    • DVWA Exploits
    • Kali Vulnerability Scanner Tools
    • WPScan: WordPress Vulnerability Scanner
    • The Best 5 OSINT Tools
    • Using Infooze Tool
    • Using Mitaka Tool
    • Create Reverse Shell
    • WordPress Reverse Shell
    • Subdomain Enumeration Tools
    • SMTP Enumeration Tools
    • DNS Enumeration Tools
    • Wordlist Generator using Crunch
    • Automate SSH Brute Force Attack
    • Fuzzing Tools for Web Application Pentesting
    • Bypass CSRF Protection
    • Password Cracker — John The Ripper (JTR)
    • Crack Hashed Password — Hashview
    • Attack Login Forms with Burpsuite and THC-Hydra
    • Perform Postgres DB Brute Force Attack
    • Perform VNC Brute Force Attack

    Источник

Оцените статью
Adblock
detector