Command
search user
Connections
- https://supply-complete-jewish-interview.trycloudflare.com
Recon
Opening the challenge URL in a browser lands on a page titled “User Check Service”, branded “Staff Directory Service • Corporate LDAP Proxy • All lookups logged for security audit”. The whole interface is one form asking for a username, and results render in a box labeled “Query Output”. The challenge is named Command, and a staff lookup that we had not yet seen the backend of is the classic setup for a shell command with our input spliced into it, so we went in expecting command injection of some kind.

We typed admin into the form and submitted it, and the Query Output box answered with admin:x. Typing jdoe instead returned User not found.. So the application echoes the matched line, and a match looks like the leading fields of a passwd-style entry, colon-separated. A user search that prints passwd-style lines points at a backend along the lines of grep <pattern> <users-file>, which fits the challenge name.
Mapping the blacklist
Our first injection attempt was typing admin;id into the form. Instead of a result we got a dedicated “WAF Alert!” page, so a character blacklist sits in front of the lookup.

To map the blacklist we switched from the browser to scripted POSTs, because payloads with literal newlines or lone quote marks are awkward to type into an HTML input, and we wanted response lengths as a side channel. The helper we used for the rest of the challenge:
import re, requests
URL = "https://supply-complete-jewish-interview.trycloudflare.com"
s = requests.Session()
s.headers.update({"User-Agent": "Mozilla/5.0"})
def send(username):
r = s.post(URL, data={"username": username}, timeout=25)
m = re.search(r"<pre>(.*?)</pre>", r.text, re.S)
return len(r.text), (m.group(1).strip()[:500] if m else "<no-pre>")
Running each payload through send() recorded the following responses:
| Payload | Response |
|---|---|
admin;id, admin|id, admin`id`, admin$(id), admin&&id, admin||id |
WAF Alert! page |
admin + newline + id |
admin:x |
admin -q, admin -h /etc/passwd |
User not found. |
admin>, admin", admin' |
passed the WAF, no alert page |
[a]dmin |
admin:x |
adm"in, adm'in |
User not found. |
Every command separator and both command-substitution forms (;, |, &, $, backticks) are blocked. Spaces, newlines, quotes, >, and regex brackets pass through. The length readout also handed us an oracle: the “User not found.” body is 4103 bytes every time, while a page that displays a match has a different length, so the byte count alone tells us whether a query matched.
Pinning down the command template
We could not see the backend code, so we treated the command template as unknown and picked probes where the candidate templates predicted different responses.
First, the newline. We sent admin, a newline, then echo HELLO. If the template interpolated our input unquoted, for example grep ^$username /etc/passwd, the newline would terminate the grep and echo HELLO would run as a second command whose output reaches the page. The response was admin:x, identical to plain admin. No second command ran, and a pattern that still contained the newline could not have matched the admin line either, so the app cuts the input at the first newline. Multi-line payloads are dead and there is no way to stack commands.
Next, the probe that settled the quoting question. We sent adm"in and adm'in. Under unquoted interpolation the shell consumes quote characters while building words, so grep would have searched for plain admin, which matches. Both payloads returned “User not found.” instead, meaning the quote characters reached the matching engine as literal pattern text. That rules out our text ever becoming bare shell words. The space-bearing probes agreed: admin -q and admin -h /etc/passwd both behaved like one long non-matching pattern rather than like grep flags splitting off as separate arguments.
Finally [a]dmin returned admin:x. Two things follow from that one response. The square brackets acted as the regex character class they form, so metacharacters flow straight into grep’s pattern engine. And the displayed line does not start with the literal text we submitted, so there is no gate checking that the output begins with our input. That mattered later, because the flag payload submits a string full of quotes and flags while the output is a bare flag line.
At this point the model was: a WAF blocking separators and substitutions, and a template that keeps our input inside a quoted region, with both quote characters available to us. Quoted command injection without a single usable separator.
Exploitation
Escaping the quoted pattern
With separators gone, the way in is the quote characters themselves. A single quote in our input ends the template’s quoted pattern early, and everything after it is raw shell text. Words there split on spaces and become extra arguments to grep, and grep treats extra arguments as more files to search. That is an arbitrary file read without ever running a second command.
One bookkeeping rule applies: after our input the template appends its own closing quote plus its file argument, so the quotes inside our payload must pair up cleanly or the whole command dies on an unterminated quote. Our payloads each carry two single quotes. The first closes the pattern. The second opens a short quoted region that the template’s own closing quote finishes, leaving the template’s trailing file argument outside the quotes as a normal word.
The proof payload, with a second file of our own thrown in, was:
admin' '/etc/passwd
The Query Output box came back with /app/users.txt:admin:x. Grep prints a filename: prefix in front of every match only when it searches two or more files. We submitted one file path, so the second file came from the template itself, and the prefix names it: /app/users.txt. Plain admin never shows a prefix, so the template searches exactly one file. The command that ran was therefore:
grep '^admin' '/etc/passwd' /app/users.txt
Three arguments after grep: the pattern ^admin, our /etc/passwd, and the application’s user database /app/users.txt. The system /etc/passwd has no line starting with admin, so the single match carries the users.txt prefix. One response, three facts: a real shell parses the quotes, injected arguments reach grep, and the user database is /app/users.txt.

Reading the flag
For the flag we needed two changes to the working payload. A pattern that matches the flag line, and a way to drop the filename: prefix so the line displays raw. Flags in this CTF start with NVR, so ^NVR anchors the pattern. For the prefix, grep’s -h flag suppresses filenames when searching multiple files. The file was a guess, /flag, the usual spot in these containers, and the response settled it. We kept the structure of the payload that already worked and swapped in the new pattern, flag, and file:
NVR' -h /flag /etc/passwd'
The extra /etc/passwd rides along as another file to search; it contains no NVR line, so it stays silent. The command that ran:
grep '^NVR' -h /flag /etc/passwd'' /app/users.txt
The '' at the end is our closing quote plus the template’s, an empty string that glues onto the /etc/passwd word. Grep ran over /flag, /etc/passwd, and /app/users.txt with prefixes off, and the ^NVR pattern matched the flag line at the top of /flag.
Flag capture
The Query Output box printed the line raw:

<div class="result-title">Query Output</div>
<pre>NVR{_Cha113ng3_I1_3asy_}</pre>