query me this: closing the parenthesized search
huntress ctf 2026, day 19 web track · web exploitation · all three modes
tools used: live web target capture and timed-attempt pipeline.
the target exposed a small record-search form. normal queries returned public rows, while a boolean sql injection exposed a restricted row containing the requested value.
the key insight was syntactic: a quote and boolean expression were not enough. the input also had to close a surrounding parenthesis before adding the always-true condition and commenting out the remainder.
challenge shape
the single and time trial each assigned one search target. mastery combined an earlier backup-exposure target with a search target. variants changed the search route, so the solver parsed the actual form rather than assuming a fixed path.
artifact anatomy
the home page contained a get search form whose action was a lookup- or search-like route. the text field also used a search-like name. ordinary input returned matching records. several malformed or incompletely balanced inputs returned no restricted row rather than a useful database error.
the successful url-decoded input had this structure:
%') OR 1=1--
the wildcard extends the original match, the quote closes its string, the right parenthesis closes the grouped expression, the boolean condition widens the result set, and the comment marker discards the remaining query text. the server source was unavailable, so that query shape is an inference from the observed responses rather than a source-level claim.
extraction method
forms were ranked by their action and input names. hidden inputs were retained, while the best non-hidden field received the payload through the form's own method:
fields = [i for i in form.inputs if i.type not in {"hidden", "submit", "file"}]
parameter = rank_search_names(fields)[0]
values = {i.name: i.value for i in form.inputs if i.type == "hidden"}
values[parameter] = "%') OR 1=1--"
request(form.method, form.action, values)
if the page linked directly to a lookup or search route, that same target-local route was a fallback. no unrelated path probing was needed.
validation and answer formatting
the solver treated the appearance of exactly one requested value as success. returning ordinary records alone did not count. as with the other web recipes, the request could not leave the assigned origin and the response was saved before answer extraction.
the submitted result in every mode was [redacted].
failed approaches and pivots
- a lone quote and conventional quote-plus-boolean forms returned no restricted record. they did not balance the surrounding query syntax.
- adding only a wildcard still left the grouped expression open. the closing parenthesis was the decisive change.
- hard-coding one route would have failed when another variant renamed it; parsing the form kept the method, path and parameter coupled.
automation across modes
the page itself selected the sql-injection recipe through its form and search vocabulary. heterogeneous mastery targets were captured concurrently, and the offline answer step mapped each capture back to its own question.
lessons
- payload construction is syntax repair: infer which delimiters the application adds around the input.
- a missing error message does not make the endpoint non-injectable; compare result-set behavior under balanced inputs.
- discover the form action and parameter from each target instead of binding the exploit to one route.
solve times
public scoreboard · day 19 finish: top 3
- 2:31.9singlefirst blood, +57.4 s
- 3:32.2time trialfirst blood, +1:10
- 17:56.2mastery#4 of 167 solvers
- #3team day finishof 153 teams that cleared it, in 17:56.2
- #8single orderof the day's 8, by our flag time
from the public scoreboard: 09:00 et release to our flag; the table below counts from our attempt's start.
from when we started working on the mode to its flag.
| mode | work to flag | attempts | wrong submits |
|---|---|---|---|
| single | 2m31s | 1 | 0 |
| time trial | 9s | 1 | 0 |
| mastery | 18s | 1 | 0 |
the clock
server timer of the winning attempt; used is attempt start to flag, left is what remained on the clock. the accepted mastery run was untimed.
| mode | time available | time used | time left |
|---|---|---|---|
| time trial | 120s | 9s | 111s |
where we got stuck
- several familiar boolean payloads failed because they did not close the application's grouped expression. adding the missing right parenthesis made the restricted row appear.
flags: single, time trial, and mastery [redacted].
{generated by a clanker}