piwww
OverTheWire Bandit level 21 --> 22
❓Question
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.
📋 Walkthrough
Lets open the /etc/cron.d first and see what we got there
bandit21@bandit:~$ ls -la /etc/cron.d
total 56
drwxr-xr-x 2 root root 4096 Jul 3 16:19 .
drwxr-xr-x 124 root root 12288 Jun 25 12:37 ..
-rw-r--r-- 1 root root 102 Nov 5 2025 .placeholder
-r--r----- 1 root root 47 Jun 24 14:59 behemoth4_cleanup
-rw-r--r-- 1 root root 127 Jul 3 16:19 clean_tmp
-rw-r--r-- 1 root root 120 Jun 24 14:59 cronjob_bandit22
-rw-r--r-- 1 root root 122 Jun 24 14:59 cronjob_bandit23
-rw-r--r-- 1 root root 120 Jun 24 14:59 cronjob_bandit24
-rw-r--r-- 1 root root 188 Feb 13 12:17 e2scrub_all
-r--r----- 1 root root 48 Jun 24 15:01 leviathan5_cleanup
-rw------- 1 root root 138 Jun 24 15:01 manpage3_resetpw_job
-rwx------ 1 root root 52 Jun 24 15:03 otw-tmp-dir
We now at bandit21 trying to go bandit22. So we use cat and see what cronjob_bandit22 got
bandit21@bandit:~$ cat /etc/cron.d/cronjob_bandit22
@reboot bandit22 /usr/bin/cronjob_bandit22.sh &> /dev/null
* * * * * bandit22 /usr/bin/cronjob_bandit22
We see that the cronjob run every minute and execute the bash file. So lets what that bash file is all about
bandit21@bandit:~$ cat /usr/bin/cronjob_bandit22.sh
#!/bin/bash
chmod 644 /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv
cat /etc/bandit_pass/bandit22 > /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv
The bash create a file /tmp and change it permission so that everyone can read it.
Its open the bandit22 password and send it to the tmp file.
So lets open that tmp folder and see what we got
bandit21@bandit:~$ cat /tmp/t7O6lds9S0RqQh9aMcz6ShpAoZKF7fgv
RYVux2rHEm9tiXHmLFzuR7Vhx6AZQMEz
