Linux Privilege-Escalation
Typically you want to become the user with uid=0
aka. root
.
initial enumeration
Typically we start with system enumeration
Another common step is user enumeration
We should also enumerate networks
Search for typical locations for passwords:
automated tools
There are many tools that automate those checks
linpeas
linenum
linux-exploit-suggester
linuxprivchecker.py
exploitation
kernel exploits
uname -a
→ google kernel version + exploit- user the
linux-exploit-suggester
- a list of exploits can be found at https://github.com/lucyoa/kernel-exploits
search for weak file permissions
- eg.
/etc/passwd
and/etc/shadow
unshadow
hashcat -m 1800 creds.txt rockyou.txt -O
sudo exploits
LD_PRELOAD
? (inenv_keep
)
Create new preloaded library with teh following source code:
compile and preload it:
-
abuse CVE-2019-14287, !root in sudoers
- https://www.exploit-db.com/exploits/47502
sudo -u#-1 /bin/bash
-
- Defaults: pwfeedback in sudo -l (you get asterisk instead of nothing when entering a password)