CSCTF 2026 · Web · 318 pts
Operation Dawn: The Dispatch Console.
A sanitizer that only re-checks input after decoding a literal quote lets a percent-encoded payload store clean and detonate later, in a different endpoint entirely.
| Event | CSCTF 2026, Operation Dawn (online jeopardy) |
|---|---|
| Category | Web |
| Points | 318 |
| Status | Solved during the event |
| Target | Assigned live container |
TL;DR. `/post`'s input sanitizer blocks SQL keywords in the raw body, but only re-checks the *decoded* value when a literal quote is already present — so percent-encoding both the quote and the keywords slips past validation while storing a live payload. That stored value later executes as a second-order SQL injection in a completely different endpoint, `/digest`, whose dumped data unlocks a third endpoint with a format-string template-injection vulnerability.
Challenge
Recover the WARDEN command token's protected report from a dispatch console whose stored dispatches feed a separate digest and report pipeline.
Solution — step 1, storing a live payload
/post stores a dispatch body after a sanitizer blocks the substrings union, select and --. Crucially, it only URL-decodes and re-checks the body if a literal single quote is already present in the raw input — if there's no literal quote, the raw (encoded) value passes untouched and gets stored decoded. Percent-encoding the quote itself (%27) along with the blocked keywords (%55%4E%49%4F%4E, %53%45%4C%45%43%54, %2D%2D) means the raw body the sanitizer sees has no literal quote or keyword at all, while the decoded value stored in the database is a live SQL injection payload.
Step 2 — second-order SQLi
/digest is where that stored payload actually executes: for each stored callsign it runs SELECT body FROM dispatches WHERE callsign='<stored value>' against SQLite. A dispatch group appears in the digest only if its subquery runs and returns rows — a straightforward boolean oracle — and a single-column UNION SELECT dumps arbitrary table data through it. The schema exposes two tables: dispatches(id, callsign, body) and operators(id, callsign, token, role), and the dump reveals a WARDEN-role operator's command token.
Step 3 — format-string SSTI
/report?token=<command token>&fmt=... renders a report by running the fmt parameter through Python's str.format against a live Dispatch object — a format-string template injection. fmt={dispatch.__class__.__init__.__globals__[FLAG]} reaches into the module's globals and leaks the flag directly. (Neither /dispatches nor the /report token lookup itself is injectable — only the /digest path, which is reached only through the stored second-order payload, is.)
Flag
CSCTF{8rqT3g3TxKJr2WrUyueoWvRI}What I took from it
- A sanitizer that re-validates a decoded value only when it already sees a reason to (here, a literal quote) can be bypassed entirely by encoding that one trigger character along with everything else — and the resulting stored payload may only ever fire in a completely different endpoint than the one it was submitted to.