A program is running periodically from cron. Check /etc/cron.d/ for the configuration and see what command is being executed. This time, the script uses a more complex way to name the output file.
Similar to the last level, I checked the cron configuration:
$ cat /etc/cron.d/cronjob_bandit23
This led me to a script: /usr/bin/cronjob_bandit23.sh. When I looked at the contents of that script, things got interesting:
#!/bin/bash
myname=$(whoami)
mytarget=$(echo I am user $myname | md5sum | cut -d ' ' -f 1)
echo "Copying passwordfile /etc/bandit_pass/$myname to /tmp/$mytarget"
cat /etc/bandit_pass/$myname > /tmp/$mytarget
The script doesn’t use a fixed filename. Instead, it calculates a hash (a unique fingerprint) based on the username.
"I am user bandit23".md5sum to create a hash./tmp.To find the password, I had to replicate that calculation myself for the user bandit23 to figure out where the script hid the file:
$ echo I am user bandit23 | md5sum | cut -d ' ' -f 1
This gave me a specific hexadecimal string (the hash). I then simply cated that file from the /tmp directory:
$ cat /tmp/[THE_HASH_I_FOUND]
[SPOILER]
$myname to perform actions dynamically.