📋Linux Privesc Checklist
Grep TIps
Privileges,Users, etc
Network
Check DNS:
/etc/hosts
ifconfig
orip a
if it is dual homed, etc./etc/resolv.conf
if the host is configured to use internal DNS it can be starting point to query Active Directory.To see which other hosts the target has been communicating with we can use
arp -a
Docker
When creating a Docker container if -h or -hostname is not specified then hostname is container name.
Example hostname of docker container:
efaa6f5097ed
.dockerenv
in root directoryTo evaluate use CDK Refer: Forgotten-vulnlab
If sudo access on docker exec
sudo docker exec --privileged --user 0 -it container_name /bin/sh
WSL
To mount c drive in WSL
Disks & Other Peripheral
Check for unmounted drives with
lsblk
orfdisk -l
lsblk
to enumerate information about block devices (hard disks, USB drives, optical drives).lpstat
to check for printers
NFS
Check for NFS with
showmount -e <ip>
Then
cat /etc/exports
. If (rw,no_root_squash) then we can create setuid binary on bash:
shell.c
Compile and copy to nfs:
Run it after switching to low privileged session:
./shell
Files & File searching
To find .conf files:
To find setuid(SUID) binaries:
To get all hidden files:
To find scripts:
To check for writable directories:
or writable files:
If wordpress then it is quite common to have passwords in the config file:
Processes & Installed Packages
Check running processes:
ps aux
--> only rootps aux | grep root
watch -n 1 "ps -aux | grep pass"
- to get entries with passwordps fauxww
ps -ewwo pid,user,cmd --forest
If doas is present then check config file which can be found with
dpkg -l
to list packagesIf no sudo access: pspy:
./pspy64 -pf -i 1000
To add current path to $PATH:
To check cron jobs try ALL THESE:
crontab -l
(Run with sudo too)ls -lah /etc/cron*
grep "CRON" /var/log/syslog
- To check cron logs
To check binaries:
ls -l /bin /usr/bin/ /usr/sbin/
To check installed packages:
To check gtfo bins against installed packages (run the previous command before this):
Strace can be used to trace the system calls and signal processing of any command
Active Directory
Check
/etc/krb5.conf
If root user then use KeyTabExtract
Check for hashes:
In
/var/lib/sss/db
:
Check for cache
Last updated