OSCP - Linux Priviledge Escalation
Information Gathering
+ Get OS information
Check for misconfigurations - i.e Is shadow readable? Is passwd writeable?
Search for misconfigured PATH variables. Do they prioritize searching for executable files from a non-secure (i.e. world-writeable) path?
You might find plaintext passwords in there
Search for jobs using programs that run with root privileges and are potentially write-accessible by low-privileged users
cat /etc/issue+ Check sudoers
cat /etc/*-release
cat /proc/version
uname -a
rpm -q kernel
dmesg | grep Linux
ls /boot | grep vmlinuz-
lsb_release -a
sudo -l+ Check password files
cat /etc/sudoers
Check for misconfigurations - i.e Is shadow readable? Is passwd writeable?
cat /etc/passwd+ Learn your environment
cat /etc/shadow
ls -l /etc/passwd
ls -l /etc/shadow
Search for misconfigured PATH variables. Do they prioritize searching for executable files from a non-secure (i.e. world-writeable) path?
cat /etc/profile+ Check history files
cat /etc/bashrc
cat ~/.bash_profile
cat ~/.bashrc
cat ~/.bash_logout
cat ~/.bash_history
env
set
You might find plaintext passwords in there
cat ~/.*_history+ Check cronjobs
Search for jobs using programs that run with root privileges and are potentially write-accessible by low-privileged users
crontab -l+ Check processes running as root for vulnerabilities
ls -alh /var/spool/cron
ls -al /etc/ | grep cron
ls -al /etc/cron*
cat /etc/cron*
cat /etc/at.allow
cat /etc/at.deny
cat /etc/cron.allow
cat /etc/cron.deny
cat /etc/crontab
cat /etc/anacrontab
cat /var/spool/cron/crontabs/root
ps aux | grep root+ Search files for plaintext credentials
ps -ef | grep root
grep -ir user *+ Find writable configuration files
grep -ir pass *
find /etc/ -writable -type f 2>/dev/null+ Run privesc scripts
LinEnum - https://www.rebootuser.com/?p=1758
linuxprivchecker.py - http://www.securitysift.com/download/linuxprivchecker.py
unix-privesc-check - https://github.com/pentestmonkey/unix-privesc-check
Escaping jail shells
python -c 'import pty;pty.spawn("/bin/bash")'
echo os.system('/bin/bash')
/bin/sh -i

0 comments:
Post a Comment