Privilege escalation

After exploitation - interesting cmd's

#check user privs
sudo -l

# Check installed FTP version
apt list --installed | grep ftp

# Check for locally open ports
netstat -antp | grep -i list

# Get SSH version on Linux
ssh -v localhost

# Get FTP daemon package version on Linux
dpkg -l pure-ftpd

# View OS related info
uname -a
lsb_release -a

Privilege Escalation — CVE-2024–48990 / CVE-2024–48991 (needrestart)

  1. Create a malicious config:

  1. Execute needrestart with custom config:

Linpeass

Using tools like linpeas.sh automates the enumeration process, making it more efficient and comprehensive.

Download LinPeass rom github

Transfer Linpeas to the victims machine

Execute from memory and send output back to the host

Analyze the Red findings

Go to GTFOBins

Type program that is a SUID and try things out, for example python sudo:

python -c 'import os; os.system("/bin/sh")'

CVE-2021-3493 - Ubuntu kernel priv escalation

Affected versions

Ubuntu 20.10

Ubuntu 20.04 LTS

Ubuntu 19.04

Ubuntu 18.04 LTS

Ubuntu 16.04 LTS

Ubuntu 14.04 ESM

If the target is one of the ubuntu version above, it will be affected by the Overlays privilege escalation vulnerability from which you can use the exploit below:

You have to complie the tool first with:

Shadow File

  1. Copy /etc/passwd

  2. Copy /etc/shadow

  3. Merge the files with unshadow tool

  1. Crack the passwords offline with John

DirtyCowl - 2016-5195

Check all executables that we can execute as sudo:

Once identified, try one of them, check the Gtfobins resource for available exploits

Check the sudo privileges we might have as current user:

If we can execute a binary with root privileges, we can check on gtfonbins how we can get root access through that executable

Check the crontabs

  • If we can find a executable script where we can right, we might use it in order to add all users to /etc/sudoers

Last updated