OS Enumeration
A first pass of Linux privilege escalation starts with identifying the OS and kernel, then checking whether a known exploit exists. These scripts automate most of the enumeration.
Enumeration Scripts
- LinPeas: https://github.com/carlospolop/privilege-escalation-awesome-scripts-suite/tree/master/linPEAS
- LinEnum: https://github.com/rebootuser/LinEnum
- LES (Linux Exploit Suggester): https://github.com/mzet-/linux-exploit-suggester
- Linux Smart Enumeration: https://github.com/diego-treitos/linux-smart-enumeration
- Linux Priv Checker: https://github.com/linted/linuxprivchecker
Locate the Kernel Version
The kernel version is often the quickest route to root.
- Identify kernel version:
uname -a; id - Search the kernel version online for exploit. (https://www.linuxkernelcves.com/cves is a good resource to search for kernel CVE's). LES (Linux Exploit Suggester) is also a good tool.
- Run the exploit
Keep in mind that exploits against a kernel could cause a system crash. Ensure you know what the code is doing before running it. Also, confirm it's within scope.