Overthewire write Up bandit level 2 to 309 Feb 2021 #OverTheWire #Bandit
This is a write-up for the Over The Wire wargame Bandit level 2 to level 3
The password for the next level is stored in a file called spaces in this filename located in the home directory
The hostname is
Commands used for this level:
cat - used to view contents of a file.
ls - List information about the FILE’s (the current directory by default).
After logging in type
You will see a file named spaces in this filename
Linux does not handle spaces in filenames well so if you do type
cat spaces in this filename,
cat will think you are trying to view the contents of file spaces, file
this, and file
filename and those separate files do not exist.
One of the reasons Linux does not handle spaces in filenames is that bash scripting uses spaces as a NULL terminator to break a script at a certain point. It is considered a best practice to not use spaces in filenames in Linux, underscores (_) are generally used in place of spaces. spaces_in_this_filename would be a better way to name this file if you were to create it.
To get around this we need to “hide” the spaces from
cat, just like in Level 1. To do this we simply type a backslash () in the filename before each space.
cat spaces\ in\ this\ filename.
The contents of the file have the password for level 3 in it.