Skip to content

Bandit 1 → 2

OverTheWire Linux Progressive

Goal: read the password from a file whose entire name is a single dash.

bandit1@bandit
bandit1@bandit:~$ ls
-
bandit1@bandit:~$ cat ./-
The password you are looking for is: <password>
Password263JGJPfgU6LtdEvgfWU1XP5yac29mFx

cat reads its filename as an argument, and any token starting with a dash is parsed as an option before it is ever treated as a path. Prefixing the file as ./- (or feeding it through stdin) forces it to be read as a file, not a flag.