Bandit Level 22
Bandit Level 22 — read a cron job's configuration and script to see what a scheduled task does.
Source: This content is aggregated from overthewire (MIT). Visit the original repository for the latest version.
Level Goal
A program is running automatically at regular intervals from cron, the time-based job scheduler. Look in /etc/cron.d/ for the configuration and see what command is being executed.
Commands you may need to solve this level
cron, crontab, crontab(5) (use “man 5 crontab” to access this)
Study guide
Level map: logged in as bandit21, find the password for bandit22.
What this level teaches
How Linux schedules recurring work, and why reading someone else’s script is a security skill.
Key ideas
- cron is a daemon that runs commands at scheduled times. System-wide entries live in
/etc/cron.d/. - Crontab syntax. Five time fields (minute, hour, day of month, month, day of week) followed by the user and the command.
man 5 crontabexplains each field. - Whose permissions? A cron job runs as the user named in its entry, which may not be you.
- Follow the data. The job’s script reads something and writes it somewhere; your job is to see where.
How to approach it
- List
/etc/cron.d/and read the entry for the next user. - Open the script it runs and trace, line by line, what it reads and where it writes.
- Go and look at the output location.
Why it matters
Cron is a favourite place for misconfigurations that expose data or allow privilege escalation, and attackers also use it for persistence.