Cron jobs
These are divided into the system-wide area (/etc/crontab) and user-dependent executions. Some applications and scripts require credentials to run and are therefore incorrectly entered in the cronjobs. Furthermore, there are the areas that are divided into different time ranges (/etc/cron.daily, /etc/cron.hourly, /etc/cron.monthly, /etc/cron.weekly). The scripts and files used by cron can also be found in /etc/cron.d/ for Debian-based distributions.
Scheduled tasks are listed under the /etc/cron.* directories, there * represents the frequency at which the task will run.
System admin sometimes add their own scheduled task in the /etc/crontab file:
Basically, the principle behind this technique is:
- writing to a directory called by a cron job,
- and include a bash script with a reverse shell command,
- which should send us a reverse shell when executed.
The command explained:
Basically, if we spot a file listed here and located in one of the cron locations, it may be running as a cron job.
1. /etc/crontab
The crontab command can create a cron file, which will be run by the cron daemon on the schedule specified. When created, the cron file will be created in /var/spool/cron for the specific user that creates it.
Each entry in the crontab file requires six items in the following order: minutes, hours, days, months, weeks, commands. For example, the entry 0 */12 * * * /home/admin/backup.sh would run every 12 hours.
The root crontab is almost always only editable by the root user or a user with full sudo privileges
2. /var/log/cron.log
Inspect the cron log file (/var/log/cron.log) for running cron jobs:
Example of output:
3. /etc/cron.d
Certain applications create cron files in the /etc/cron.d directory and may be misconfigured to allow a non-root user to edit them.
4. /var/spool/cron/crontabs/root
pspy
This tool can help you to locate running processes.
Last update: 2026-02-02 Created: May 23, 2023 19:56:20