How can I start Metasploit Framework on Kali Linux?. The Metasploit Framework is a tool created by Massachusetts-based security company Rapid7 to help security professionals perform penetration testing tasks and discover security vulnerabilities and IDS signature development. The Metasploit Framework provides the infrastructure, content, and tools to perform extensive security auditing and penetration testing.

Metasploit Framework Services

  • PostgreSQL Database server – used by Metasploit to store data from a project.
  • Ruby on Rails
  • Metasploit service

Metasploit Framework Requirements

These are the minimum hardware requirements for running Metasploit Framework on any Linux machine.

  • CPU – 2 GHz processor
  • RAM – 4 GB RAM available (8 GB recommended)
  • Disk Space – 1 GB available disk space (50 GB recommended)

So let’s see how you’ll run Metasploit Framework on Kali Linux Desktop distribution.

Run Metasploit Framework on Kali Linux 2020.x

These are the steps that need to be taken in order to get Metasploit up and running with database support on Kali Linux.

Step 1: Start PostgreSQL database server

The PostgreSQL database is installed but not started on Kali Linux. Start the service using the following command.

sudo systemctl enable --now postgresql

Confirm that the service is started and set to run on boot.

$ systemctl status [email protected][email protected] - PostgreSQL Cluster 12-main
     Loaded: loaded (/lib/systemd/system/[email protected]; enabled-runtime; vendor preset: disabled)
    Drop-In: /usr/lib/systemd/system/[email protected]
             └─kali_postgresql.conf
     Active: active (running) since Sun 2020-02-23 07:24:55 EST; 43s ago
    Process: 16154 ExecStartPre=/usr/share/kali-defaults/postgresql_reduce_shared_buffers 12/main (code=exited, status=0/SUCCESS)
    Process: 16156 ExecStart=/usr/bin/pg_ctlcluster --skip-systemctl-redirect 12-main start (code=exited, status=0/SUCCESS)
   Main PID: 16184 (postgres)
      Tasks: 7 (limit: 2318)
     Memory: 28.6M
     CGroup: /system.slice/system-postgresql.slice/[email protected]
             ├─16184 /usr/lib/postgresql/12/bin/postgres -D /var/lib/postgresql/12/main -c config_file=/etc/postgresql/12/main/postgresql.conf
             ├─16186 postgres: 12/main: checkpointer
             ├─16187 postgres: 12/main: background writer
             ├─16188 postgres: 12/main: walwriter
             ├─16189 postgres: 12/main: autovacuum launcher
             ├─16190 postgres: 12/main: stats collector
             └─16191 postgres: 12/main: logical replication launcher

$ systemctl is-enabled postgresql
enabled

You can also verify that PostgreSQL is running by checking the output of ss -ant and making sure that port 5432 is listening.

$ sudo  ss -ant | grep 5432
LISTEN  0       244            127.0.0.1:5432           0.0.0.0:*               
LISTEN  0       244                [::1]:5432              [::]:* 

Step 2: Initialise the Metasploit PostgreSQL Database on Kali Linux

Once the PostgreSQL database server is running, proceed to initialise the Metasploit PostgreSQL Database.

$ sudo msfdb init
[i] Database already started
[ ] Creating database user 'msf'
[ ] Creating databases 'msf'
[ ] Creating databases 'msf_test'
[ ] Creating configuration file '/usr/share/metasploit-framework/config/database.yml'
[ ] Creating initial database schema

This will create and initialize the msf database.

Step 3: Launch msfconsole on Kali Linux

We now have the PostgreSQL service up and running and the database initialized. The last step required is to launch msfconsole and verify database connectivity with the db_status command:

$ sudo msfconsole
                                                  
                                              `:oDFo:`                            
                                           ./ymM0dayMmy/.                          
                                        - dHJ5aGFyZGVyIQ== -                    
                                    `:sm⏣~~Destroy.No.Data~~s:`                
                                 - h2~~Maintain.No.Persistence~~h -              
                             `:odNo2~~Above.All.Else.Do.No.Harm~~Ndo:`          
                          ./etc/shadow.0days-Data' OR 1=1--.No.0MN8'/.      
                       -  SecKCoin  e.AMd`       `.-:///// hbove.913.ElsMNh -    
                      -~/.ssh/id_rsa.Des-                  `htN01UserWroteMe!-  
                      :dopeAW.Noo                     :is:TЯiKC.sudo-.A:  
                      :we're.all.alike'`                     The.PFYroy.No.D7:  
                      :PLACEDRINKHERE!:                      yxp_cmdshell.Ab0:    
                      :msf>exploit -j.                       :Ns.BOB&ALICEes7:    
                      :---srwxrwx:-.`                        `MS146.52.No.Per:    
                      :.Ac816/                        sENbove3101.404:    
                      :NT_AUTHORITY.Do                        `T:/shSYSTEM-.N:    
                      :09.14.2011.raid                       /STFU|wall.No.Pr:    
                      :hevnsntSurb025N.                      dNVRGOING2GIVUUP:    
                      :#OUTHOUSE-  -s:                       /corykennedyData:    
                      :$nmap -oS                              SSo.6178306Ence:    
                      :Awsm.da:                            /shMTl#beats3o.No.:    
                      :Ring0:                             `dDestRoyREXKC3ta/M:    
                      :23d:                               sSETEC.ASTRONOMYist:    
                       /-                        /yo-    .ence.N:(){ :|: & };:    
                                                 `:Shall.We.Play.A.Game?tron/    
                                                 ```-ooy.if1ghtf0r ehUser5`    
                                               ..th3.H1V3.U2VjRFNN.jMh .`          
                                              `MjM~~WE.ARE.se~~MMjMs              
                                                ~KANSAS.CITY's~-`                  
                                                J~HAKCERS~./.`                    
                                                .esc:wq!:`                        
                                                    ATH`                            
                                                  `


       =[ metasploit v5.0.76-dev                          ]
  -- --=[ 1971 exploits - 1088 auxiliary - 339 post       ]
  -- --=[ 558 payloads - 45 encoders - 10 nops            ]
  -- --=[ 7 evasion                                       ]
msf5 > 

Verify database connectivity.

msf5 > db_status
[*] Connected to msf. Connection type: postgresql.
msf5 > 

Since Metasploit Framework is part of the Kali Linux operating system, it is updated via the apt package manager.

sudo apt update
sudo apt install metasploit-framework

Tags:

  • How to install Metasploit Framework on Kali Linux
  • Running Metasploit Framework on Kali Linux
  • How to start Metasploit Framework on Kali Linux
  • Using Metasploit Framework on Kali Linux

For other Linux distributions, check:

How To Install Metasploit Framework on Debian Linux

How to Install Nessus Scanner on Ubuntu / Debian