11. More Linux Privesc
Eleventh section in Complete Beginner learning path.
Introduction
A variety of examples of potential Linux privilege escalation techniques.
Service Exploits
If MySQL service is running as root and the "root" user for the service does not have a password assigned, this exploit can be used to run system commands as root via MySQL. Once this is downloaded to the target, follow the instructions in the comments of the exploit code to run it & achieve root.
Readable /etc/shadow
If /etc/shadow is world-readable, you can cat this out and send the password hashes to John the Ripper to attempt to crack them & access root/super users.
Writeable /etc/shadow
If /etc/shadow is world-writeable, we can generate a new password hash using:
Then we simply edit /etc/shadow and replace the root users password hash with our new one.
Writeable /etc/passwd
If /etc/passwd is writeable we can create a new root user by copying the current root user's row and changing the username to something like "root2" and replacing the "x" password. To generate a useable password we can use:
Sudo - Shell Escapes
GTFOBins can be used to find shell escapes for various programs that run on Linux machines.
History Files
History files can be viewed using cat ~/.*history | less
, you may be able to see failed commands with password contents here.
Last updated