Linux PrivEsc
METHODOLOGY:
Run "uname -a" to check kernel version.
Run "sudo -l" command. (If nothing found, move ahead)
Check /etc/passwd for usernames.
If /etc/passwd has W access then use openssl to create new root user.
Check if /etc/shadow has RW access. (Crack the hash)
Check for backup files at /home/user, /root, /tmp, /var/backups
Enumerate user's home directory (check for interesting files, intel, ssh keys)
Check web root dir. cd /etc/apache2. grep -Ri DocumentRoot .
Check grep -R '$bigtree\["config"\]["db"\]' . (. for current dir)
Alternative for above find . -iname '*config*'
Enumerate the /var/www/ directory to find config files and other info.
Check already found credentials for database running on machine.
Check if root login is allowed with SSH (grep PermitRootLogin /etc/ssh/sshd_config)
If you find nothing after this, then follow these steps:
FILE PERMISSIONS /etc/shadow
#READ ACCESS
#Extract the hash and save it in hash.txt file in Kali machine
#Check the hash type using https://hashcat.net/wiki/doku.php?id=example_hashes
#Crack it using JOHN or HASHCAT
john --format=sha512crypt --wordlist=/usr/share/wordlists/rockyou.txt hash.txt
hashcat -m 1800 hash.txt /usr/share/wordlists/rockyou.txt
#Switch to that user using "su username" followed by password you cracked
#WRITE ACCESS
#Create a password hash
mkpasswd -m sha-512 newpass
#Replace the user's hash with the one we generatedFILE PERMISSIONS /etc/passwd
SUDO PRIVESC
SUID/SGID FILES
CRON JOBS
PASSWORDS AND KEYS
BACKUP FILES
MYSQL UDF
NFS
SSH PORT FORWARDING
MYSQL UDF
Last updated
Was this helpful?
