Linux Privilege Escalation
System Info
Obtain information about the system architecture, distribution, and kernel version.
uname -a # System information
lsb_release -a # Distribution information
getconf LONG_BIT # System architecture
cat /proc/version # Kernel version
cat /etc/os-release # OS detailsPath
Check if you have write permissions for any directory in the PATH.
echo $PATH | tr ':' '\n' | sort -u | xargs -I{} bash -c 'if [ -w "{}" ]; then echo "[+] {}"; fi'Environment Variables
Sometimes we can find password or sensitive information in environment variables.
env # Environment variables
set # Shell variablesGroups
List all the groups users belongs to.
Docker
If you belong to the Docker group, you could mount the filesystem within a container and have full access to it, allowing you to modify it.
LXD/LXC
Similar to Docker, with LXD/LXC, we can also mount the filesystem within a container, granting full access to it.
Sudo
Capabilities
https://book.hacktricks.xyz/linux-hardening/privilege-escalation/linux-capabilities
SUID
Open Ports
Cron Jobs
https://book.hacktricks.xyz/linux-hardening/privilege-escalation#scheduled-cron-jobs