Name Game — BreachLab Ghost Level 1 → 2
Platform: BreachLab
Track: Ghost
Level: 1 → 2
Challenge Name: Name Game
Category: Linux Basics / Shell Quoting
Points: 12 points + 3 First Blood Bonus
Date Completed: 2026-12-06
Challenge Description
KAEL was paranoid.
He named his files in ways that make the shell fight you.
Read the MANIFEST.
Then figure out how.
Goal: Retrieve the password for ghost2
Connect: ssh ghost1@204.168.229.209 -p 2222
Topics to read before: cat, ls, man
Walkthrough
We have a blank screen in front of us. Running pwd confirms we're sitting in the home directory of user ghost1.
As instructed, we start by reading the MANIFEST file:
cat MANIFEST
NOTES — KAEL
------------------------------------------------------------------------------------------------
I named my files to watch careless analysts give up before they even read them.
Most people who poke around this directory will quit before they open the first one.
-KAEL.
KAEL is telling us, indirectly, that he's made the files difficult to open on purpose — by choosing filenames that break the normal way the shell interprets a command. So each file in this directory is going to need its own quoting trick.
First, let's see what we're dealing with:
ls
- --help MANIFEST 'filename'
Four entries. MANIFEST is a normal name — we already opened it without issue, which is the control case here: it proves the shell itself isn't broken, only these three specific names are built to exploit how it parses input.
File 1: -
Try the obvious thing first:
cat -
This hangs — the terminal just sits there with a blank line, stuck. That's because - on its own is a well-known convention many Unix tools use to mean "read from standard input" instead of a file. The shell isn't seeing a filename; cat is seeing an instruction to wait for us to type something.
To force cat to treat - as an actual filename, we need to give it a path that doesn't start with a bare -:
cat './-'
Here ./ means "the current directory," so ./- unambiguously points at a file named - sitting right here, instead of looking like an option flag. That breaks the standard-input trap, and we get:
a1e7c9d4f2b8
File 2: --help
Same family of problem, different flavor:
cat --help
This doesn't hang — it prints cat's own help page, because --help is a recognized option flag for almost every GNU command-line tool. The shell happily hands it to cat as a flag, not a filename.
Same fix as before:
cat './--help'
The ./ prefix tells the shell "this is a path, not an option," so cat opens the actual file instead of printing its usage text:
9c02b47fa6d1
File 3: filename (with a space in it)
ls shows this one as 'filename' — the quotes in the ls output are a hint that the real filename contains a space (it's literally named file name), which ls wraps in quotes so we can see where the word boundary actually is.
My first instinct was to assume it needed the same ./ treatment as the other two, so I tried:
cat './'file name''
That fails, and it's worth seeing exactly why: the shell reads this as several separate chunks stitched together — a quoted ./, then two bare unquoted words file and name, then an empty quoted string ''. Concatenated, that's ./file and name as two arguments, neither of which exists. The quoting didn't wrap the space; it sat on either side of it.
The actual fix is simpler than the other two files: this filename isn't being misread as a flag or a special token at all — it's a plain name that happens to contain a space, and the shell's default behavior is to split unquoted text on whitespace into separate arguments. ./ solves "this looks like a flag," not "this has a space in it." So the fix is to quote the whole name as one unbroken unit:
cat 'file name'
Wrapping it in single quotes tells the shell "this entire string, space included, is one argument." That finally opens the file and gives us the password for Ghost2.
Flag / Answer
ghost2 password: [stored locally]
Concepts Used
| Concept | What It Is | Why It Mattered Here |
|---|---|---|
pwd |
Prints the current working directory | Confirmed we were in ghost1's home before doing anything else |
ls |
Lists files and directories | Revealed four oddly-named entries, one shown in quotes by ls itself to flag a space in its name |
cat |
Displays file contents | The tool we were fighting to point correctly at each file |
- as a CLI convention |
Many Unix tools treat a bare - as "read from stdin" |
Caused cat - to hang instead of opening the file literally named -
|
| Leading-dash option parsing | Tools interpret unquoted leading dashes (--help, --whatever) as flags, not filenames |
Caused cat --help to print help text instead of opening the file named --help
|
./ path prefix |
Anchors a name to "this directory," overriding the shell's instinct to read a leading - as a flag or special token |
The correct fix for both the - file and the --help file |
| Shell word-splitting | Unquoted whitespace splits one string into multiple arguments | Why file name, typed bare, is read as two arguments instead of one filename |
Quoting ('...') |
Groups a string — spaces included — into a single argument | The correct fix for the file literally named file name; ./ alone wouldn't have helped here |
| Quote-nesting pitfalls | Partially quoting a string ('./'file name'') only protects the quoted parts, leaving the rest exposed to normal parsing |
Why the first attempt at file name failed outright |
man |
Manual pages for command syntax and options | Reference for confirming how cat and the shell actually interpret dashes and arguments |
What I Learned
This level wasn't really about cat — it was about the shell itself, and the gap between what I typed and what the shell decided I meant. Three filenames, three different parsing rules exploited: a bare - reads as a stdin redirect, a leading -- reads as an option flag, and an unquoted space reads as a word boundary. None of that is cat being clever or hostile — it's the shell's normal parsing, with the filenames deliberately chosen to land on different edge cases in it.
The fix in each case came down to being explicit about intent — ./ says "this is a path, not a flag," quotes say "this is one string, not several" — and picking the right one depended on correctly diagnosing which rule was actually firing, not just reaching for ./ by habit (the 'file name' dead end is exactly what happens when you guess instead of diagnose). That same gap — between what a developer assumes the shell will do with input and what it actually does — is the mechanism behind path traversal payloads and shell injection attacks in the real world. Spotting it on a toy challenge is the same muscle as spotting it in a vulnerable script.
Top comments (0)