Skip to content

Bandit 2 → 3

OverTheWire Linux Progressive

Goal: read the password from a file whose name contains spaces.

bandit2@bandit
bandit2@bandit:~$ ls
--spaces in this filename--
bandit2@bandit:~$ cat "./--spaces in this filename--"
The password you are looking for is: <password>
PasswordMNk8KNH3Usiio41PRUEoDFPqfxLPlSmx

The shell splits a command line into words on whitespace, meaning an unquoted name with spaces arrives as several separate arguments. Quoting the whole path (or escaping each space, or tab completing) passes it as one. The leading dashes also need the ./ prefix so the name is not read as an option.