10/100

Metasploit

LUHack

Metasploit


What is Metasploit?


Pitfalls


How it can be useful


How it works


Prerequisite: “The Terminal”


The Terminal T’Internet
terminal prompt website
terminal emulator web browser

Like a website, you can navigate between terminal prompts


Demo

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
ansible@debian:/session$ exit
logout
Connection to 192.168.0.4 closed.
iron ~/f/lancs/luhack/chonk-deploy master! > sh
$ bash
iron ~/f/lancs/luhack/chonk-deploy master! > node
Welcome to Node.js v20.11.1.
Type ".help" for more information.
>
iron ~/f/lancs/luhack/chonk-deploy master! > python
Python 3.11.2 (main, Nov 30 2024, 21:22:50) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
iron ~/f/lancs/luhack/chonk-deploy master! > sh
$ ssh ansible@chonk
Last login: Fri Feb  7 12:35:06 GMT 2025 from 100.84.145.21 on pts/0
ansible@luhack-big-chonk:~$ ^C
ansible@luhack-big-chonk:~$
logout
Connection to chonk closed.
$
iron ~/f/lancs/luhack/chonk-deploy master! >

Examples of prompts


Metasploit commands

There are many, but the commands that you will probably need today are:

1
2
$ msfconsole
$ msfvenom

msfconsole

The main Metasploit console


msfvenom

A tool for generating payloads.


Meterpreter

A payload that is used to control a compromised system.

AKA a fancy bash shell


Example usage


Finding exploits

1
msf > search foo

Running an exploit

1
2
3
4
5
6
7
msf > use exploit/linux/http/ivanti_connect_secure_rce_cve_2023_46805
msf exploit(ivanti_connect_secure_rce_cve_2023_46805) > show targets
    ...targets...
msf exploit(ivanti_connect_secure_rce_cve_2023_46805) > set TARGET < target-id >
msf exploit(ivanti_connect_secure_rce_cve_2023_46805) > show options
    ...show and set options...
msf exploit(ivanti_connect_secure_rce_cve_2023_46805) > exploit

Payloads


Summary

Metasploit is a useful tool for learning how to exploit vulnerable machines and for doing automated pen tests.


luhack.uk/w14