Before attempting privilege escalation, we need to gather information about the target system to identify potential vulnerabilities.
- First of all, if you are not in the Metasploit console, you should start the Metasploit console:
cd ~
msfconsole
- Check the Linux distribution version:
lsb_release -a
Here's an example of the output you might see:
[*] exec: lsb_release -a
No LSB modules are available.
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: 2023.2
Codename: kali-rolling
- Check the kernel version:
uname -a
Here's an example of the output you might see:
Linux iZj6ceecakbzgu9eomquhhZ 5.15.0-56-generic #62-Ubuntu SMP Tue Nov 22 19:54:14 UTC 2022 x86_64 GNU/Linux
- Find SUID files that could potentially be exploited for privilege escalation:
find / -perm -u=s -type f 2>/dev/null
In the output, you should see the /usr/bin/nmap
binary, which has a known privilege escalation vulnerability in older versions, press Ctrl+C
to exit.
Press Ctrl+D to quit the Metasploit console then start the inspection