Overview
Same word-search page as Level 9, but with a filter added. The “View sourcecode” link shows what’s changed.
Hints
Hint 1 — What does the filter block?
Hint 1 — What does the filter block?
The source adds a The characters
preg_match check:;, |, and & are blocked. These were used in the Level 9 solution. Are they the only characters that act as command separators in bash?Hint 2 — What else separates bash commands?
Hint 2 — What else separates bash commands?
In bash, a newline character acts as a command terminator — exactly like
;. The newline character (\n) URL-encoded is %0a. The filter above doesn’t check for it. Try injecting %0a between your grep arguments and a cat command.Solution
Full walkthrough
Full walkthrough
1
Understand what's blocked
The filter catches
;, |, and & in the submitted value. The Level 9 payload (&& cat ...) would be caught.2
Use newline as a separator
A URL-encoded newline (The shell receives:
%0a) is not in the blocklist. Send the payload via the URL directly:3
Read the output
The page renders the
grep results followed by the contents of the password file.Character blacklists are inherently fragile. Newlines, null bytes, and other metacharacters are easy to overlook. The correct fix is to use
escapeshellarg() — which safely quotes the entire argument — or to avoid shell execution entirely. Allowlists (only permit alphanumerics) are more robust than blocklists.