Linux Privilege Escalation

  • Root account has full administrative access to operating system

  • Initial entry is through a low privilege account/shell

  • Target machine might have misconfigurations

SUID (Set User ID) Permission

  • Allows low privileged users to run exe with file system permissions of the owner (run as root)

  • Exe installed globally by the system

  • Example: Ping

Common examples are mount, cp, nano, ping

#Check permissions of ping
ls -al /bin/ping

#Output
-rwsr-xr-x 1 root root 64424 Jun 28  2019 /bin/ping
#the s bit denotes that SUID permission is set

#find all executables with SUID permission set
find / -perm -u=s -type f 2>/dev/null

[Manual] Using Find to execute root commands

  1. First we set SUID bit for executable Find (this will be our attack vector)

  1. Leverage Find to execute root commands:

Cat /etc/shadow output

LinPeas

Linpeas.sh --> automated script for Linux Priv Escalations that runs alot of checks for vulnerabilities

  • searches password, writable files

  • Go to Interesting Files --> SUID

Output of Linpeas.sh on the target Linux Desktop

Last updated