Cron Jobs
Last updated
Was this helpful?
Last updated
Was this helpful?
Cron is a job scheduler in Unix-based operating systems. Cron Jobs are used for scheduling tasks by executing commands at specific dates and times on the server. By default, Cron runs as root when executing /etc/crontab, so any commands or scripts that are called by the crontab will also run as root. It can be an intresting privelege escalation path.
You may want to enumerate cron jobs with the following commands
For example, inside /etc/crontab you can find the PATH: PATH=/home/user:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
We need to check if we have permissions to write on each path, if a the binary in the cron job is specified without the full command path, we may be able to exploit it.
If a cron job script running as root contains an *
inside a command, then you may be able to exploit it.
If you can modify a cron job script executed by root, or it use a directory where you have full access, the we can exploit it.
Read the following page for more wildcard exploitation tricks: