tutorial · bandit

Bandit Level 1 → 2

Read a file whose name looks like a command option.

By

banditfilenamesoptions
Optional narration
Marks this level complete in your browser.

Goal

Read the password from a file named a single hyphen in the home directory.

Why this matters

A leading hyphen can be parsed as an option. Explicit paths and end-of-options markers prevent that ambiguity.

Progressive hints

  1. Hint 1

    A filename and an option can have the same characters.

  2. Hint 2

    Prefix the name with its directory.

  3. Hint 3

    Alternatively, tell the command that option parsing is finished.

Method

Run only the lines that match the evidence you observe.

ls -la
cat ./-
cat -- -

Expected non-secret observation

Either explicit form reads the same one-line file without treating its name as stdin or an option.

Explanation

./- is a pathname, while -- is the conventional end-of-options delimiter.

Troubleshooting

  • Use pwd to confirm you are in the home directory.
  • Do not type cat - by itself; that waits for standard input.

Safety and cleanup

  • Use only the OverTheWire game host and your own local practice directory.
  • Do not paste a level password into this site, screenshots, notes, or submissions. Baitaphish never asks for credentials.
  • Treat commands as learning prompts: inspect paths and flags before running them.

Completion and next step

Use the recovered credential only in the official Level 2 login. Then mark this transition complete and continue.