Wargame Walkthrough: Bandit Levels 2 and 3

This is a walkthrough to the bandit wargame made by OverTheWire. It can be found on their website at https://overthewire.org/wargames/bandit

Level 2

Goals: find the password for the next level and log in as the next user
Given information: Password is in the “spaces in this filename” file

After logging in (see Bandit level 1), we can view all files and directories in the root directory with ‘ls -la’. If you don’t know already, the ‘l’ argument shows file permissions and the ‘a’ argument shows hidden files.

When this is done we see a file named “spaces in this filename”. Looks like we found our target. Now we need to see what is in it. We can do this by using the ‘cat’ command and using quotation marks, single or double, to signify that the words all belong to the same file. This prints our password out nicely in the terminal.

Now if we want we can move right on to the next level, but if you are following along with me as I post these, I would suggest starting to save your passwords in a file, so that you can come back later and not have to play through all the levels again. This can be done easily by going to the home directory on your machine (not the bandit one) and using ‘nano’ or ‘gedit’ to make a new text file. For more on that please watch my video, Command Line For Dummies, to watch a walkthrough of basic terminal interaction.

Level 3

Goals: find the password for the next level and log in as the next user
Given information: Password is in a hidden file in the “inhere” directory

If you feel like more you can move right on to the next level. After logging in we can ‘ls’ and see that there is a directory labeled “inhere”. When we navigate into it and ‘ls -la’ we can see the target file: “.hidden”. Any file with a name beginning with a dot is automatically hidden in Linux, so it is a good practice to always add the ‘-a’ argument every time you use ‘ls’.

Now we can print out the file to see our password right there.

From here we can copy it and put it in our passwords file and move right on to the next level!

This wargame can be found on https://overthewire.org/wargames/bandit
Check them out for more wargames and the rest of the levels.

One Reply to “Wargame Walkthrough: Bandit Levels 2 and 3”

  1. Melody Jones says: Reply

    that is awesome!

Leave a Reply