Manual Checks
A list of useful commands to perform manual privilege escalation on Linux
operating system.
OS info
1
| (cat /proc/version || uname -a ) 2>/dev/null
|
1
| cat /etc/os-release 2>/dev/null
|
Path
Env info
1
| (env || set) 2>/dev/null
|
CPU info
System stats
Kernel Exploit
1
| searchsploit "Linux Kernel"
|
Drives
Check what is mounted and unmounted
1
| ls /dev 2>/dev/null | grep -i "sd"
|
1
| cat /etc/fstab 2>/dev/null | grep -v "^#" | grep -Pv "\W*\#" 2>/dev/null
|
Check if credentials are in fstab
1
| grep -E "(user|username|login|pass|password|pw|credentials)[=:]" /etc/fstab /etc/mtab 2>/dev/null
|
Processes
Network
Hostname, hosts
1
| cat /etc/hostname /etc/hosts /etc/resolv.conf
|
Interfaces
Neighbours
IPtables rules
1
| (timeout 1 iptables -L 2>/dev/null; cat /etc/iptables/* | grep -v "^#" | grep -Pv "\W*\#" 2>/dev/null)
|
Files used by network services
SUDO and SUID
Check commands you can execute with sudo
Find all SUID binaries
1
| find / -perm -4000 2>/dev/null
|
Open Ports
1
| (netstat -punta || ss --ntpu)
|
1
| (netstat -punta || ss --ntpu) | grep "127.0"
|
Users
Info about me
1
| id || (whoami && groups) 2>/dev/null
|
List all users
1
| cat /etc/passwd | cut -d: -f1
|
List users with console
1
| cat /etc/passwd | grep "sh$"
|
List superusers
1
| awk -F: '($3 == "0") {print}' /etc/passwd
|
Currently logged users
Login history
Last log of each user
List all users and their groups
1
| for i in $(cut -d":" -f1 /etc/passwd 2>/dev/null);do id $i;done 2>/dev/null | sort
|
Password Policy
1
| grep "^PASS_MAX_DAYS\|^PASS_MIN_DAYS\|^PASS_WARN_AGE\|^ENCRYPT_METHOD" /etc/login.defs
|