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
NOTE: Looking at shell scripts written by other people is a very useful skill. The script for this level is intentionally made easy to read. If you are having problems understanding what it does, try executing it to see the debug information it prints.
cron, crontab, crontab(5) (use "man 5 crontab" to access this)Solution:
- [Comment] Using SSH to connect the server
- sp@simple-plan:~|=> ssh bandit22@bandit.labs.overthewire.org
...
bandit22@bandit.labs.overthewire.org's password: Yk7owGAcWjwMVRwrTesJEwB7WVOiILLI - [Comment] Using cd command to change the shell working directory
- bandit22@melinda:~$ cd /etc/cron.d/
- [Comment] Using ls command to list directory contents
- bandit22@melinda:/etc/cron.d$ ls
boobiesbot-check cronjob_bandit24 manpage3_resetpw_job natas26_cleanup semtex0-ppc semtex6 vortex0 cron-apt eloi0 natas-session-toucher php5 semtex10 semtex8 vortex20 cronjob_bandit22 eloi1 natas-stats semtex0-32 semtex12 semtex9 vulnbot0-check cronjob_bandit23 hintbot-check natas25_cleanup semtex0-64 semtex5 sysstat vulnbot1-check - [Comment] Using cat command to output file's contents
- bandit22@melinda:/etc/cron.d$ cat cronjob_bandit23
* * * * * bandit23 /usr/bin/cronjob_bandit23.sh &> /dev/null - [Comment] Using cat command to check the script content
- bandit22@melinda:/etc/cron.d$ cat /usr/bin/cronjob_bandit23.sh
#!/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
- [Comment] Try to execute the script to see the information it prints
- bandit22@melinda:/etc/cron.d$ /usr/bin/cronjob_bandit23.sh
Copying passwordfile /etc/bandit_pass/bandit22 to /tmp/8169b67bd894ddbb4412f91573b38db3 - [Comment] What we need to do is to find out which file would be used to store the password for next level
- [Comment] Forge username for generating appropriate filename
- bandit22@melinda:/etc/cron.d$ echo I am user bandit23 | md5sum | cut -d ' ' -f 1
8ca319486bfbbc3663ea0fbe81326349 - [Comment] Using cat command to fetch out the password
- bandit22@melinda:/etc/cron.d$ cat /tmp/8ca319486bfbbc3663ea0fbe81326349
jc1udXuA1tiHqjIsL8yaapX5XIAI6i0n - [Comment] Using exit command to disconnect connection to server
- bandit22@melinda:/etc/cron.d$ exit
logout
Connection to bandit.labs.overthewire.org closed. - [Comment] It's done! Saving the password for next level.
No comments:
Post a Comment