OverTheWire: 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

After you performed a simple ls command to see the files in the directory, you will notice the “spaces in this filename” file. If you directly cat the file, you will have problems.

The trick is to either use backslash before each space, or embed the entire file name as a string. For instance,

  1. Adding backslash before each space
    • bandit2@melinda:~$ cat spaces\ in\ this\ filename
  2. Adding double quote to embed the file name
    • bandit2@melinda:~$ cat “spaces in this filename”

Either way works. 

bandit2@melinda:~$ ls
spaces in this filename
bandit2@melinda:~$ cat "spaces in this filename"
UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK
bandit2@melinda:~$ cat spaces\ in\ this\ filename
UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK
bandit2@melinda:~$

The password to gain access to level 3 is UmHadQclWmgdLOKQ3YNgjWxGoRMb5luK

OverTheWire Bandit – Level 0 to 6 – detailed step-by-step walkthrough video with explanations!
kongwenbin: I am a security enthusiast, penetration tester and bug hunter who has a great passion in the area of information security. I love to share. Please feel free to leave a comment on my posts. Learning never stops!
Related Post