Day 15 - Crumb Trail (script-analysis)
| field | value |
|---|---|
| GM id | script-analysis-day-15-credential-store-clues |
| lane | script-analysis (family script_inventory) |
| artifact | artifact_0.bin (challenge artifact, not published) - WinZip-AES zip, 108133 bytes, sha256 3f603de468657d5f..., 116 inert script members, password infected |
| fields | 1026 per attempt (Single / Time Trial), 5130 for Mastery (5 sets x 1026) |
| agent | agent-1 (Opus 5 / high) |
Flags (GM-accepted)
| mode | flag |
|---|---|
| single_solve | Token8c55fe59e7b771474601e04f89118407 |
| time_trial | Tokenfa59f8441588bc9dc7f61e28c502c2e6 |
| mastery | Tokenb0d33e864242a07679a268842209a505 |
The challenge
Some credential-access-shaped code keeps rummaging through the browser's cupboards, and synthetic store artifacts are sitting there waiting. Connect each code path to the artifact it targets, and find the reference that points at a store that was never there.
The prompt is flavour: the zip holds only inert script fixtures (no store files), and the credential-store theme shows up as the descriptor content of collection-sample.ps1, whose base64 JSON lists ["update-<id>.dat", "Login Data", "Cookies"] and whose one ATT&CK question is pinned to browser credential-store access (T1555.003, with T1005 also accepted).
Every fixture self-describes, as it has since Day 06: a HUNTRESS-MATERIAL / HUNTRESS-CODEC comment (or a Material_<id> / Codec_<id> pair) carries the descriptor, the :HUNTRESS_INSPECT body reconstructs it from fragments, and the decoded text is a v=1|k=v|... record holding steps, adapter, stage_count, graph, next_language, campaign_id and the IOC strings. Nothing is ever executed.
Today's new layer: Perl. 55 new question keys (polyglot-perl-* x4 fixtures plus host-perl-cgi-perl-*), answered with the parent interpreter technique T1059 because ATT&CK has no Perl sub-technique. The banked adapter already covered it through the generic Material_/Codec_ path and the .pl row of autosolve_script.LANGS, so the new language cost nothing: Single Solve was CORRECT on first touch, 1026/1026, in 3.8 s.
The real work: an all-or-nothing timed submit that said only "incorrect"
The first Time Trial attempt submitted all 1026 locally derived answers 2.1 s after the start and came back
{"result": "incorrect", "unique_attempts_remaining": 32}
with no accepted list and no remaining count. One wrong field out of 1026 looks exactly like 1026 wrong fields, and the next variant would have failed the same way.
Making the spent attempt talk
Three properties of the spent attempt made it a free oracle:
- its start response carried
deadline: null- there was no window left to lose; op=startreconnects to the same attempt (onlyop=retryspends one of the 32 variants), so every further call cost nothing;- a partial submit is graded on its own: all-correct answers come back
acceptedwith a fallingremainingcount and the GM banks them, while any wrong answer in the subset returnsincorrect.
So subset submits on that attempt localize the defect and make progress at the same time. Implemented inside autosolve_script.run() (explicit opt-in HUNTRESS_TT_BISECT=1, only for a timed route whose start carries no deadline) rather than as an ad-hoc script, so it stays available tomorrow:
- a one-field canary (
jscript-benign-campaign) proved the attempt still accepts answers -accepted,remaining=1025; - a halving search over the id list narrowed the defect to a 40-id window, all
batch-*; - an explicit group probe (
HUNTRESS_TT_GROUPS, one submit per field family) named it exactly:
group batch-expansion 9 field(s) -> incorrect
group batch-control 9 field(s) -> accepted (remaining=928)
group batch-graph 9 field(s) -> accepted (remaining=919)
group batch-adapter 9 field(s) -> accepted (remaining=910)
group batch-rest 36 field(s) -> accepted (remaining=876)
group vbscript 72 field(s) -> accepted (remaining=804)
group python 126 field(s) -> accepted (remaining=678)
group bash 140 field(s) -> accepted (remaining=538)
group nodejs 56 field(s) -> accepted (remaining=482)
group host 77 field(s) -> accepted (remaining=405)
group polyglot 396 field(s) -> accepted (remaining=9)
remaining = 9: the nine batch-*-expansion labels were the only wrong answers in the attempt.
The defect
solve_script_inventory.expform() was an empirical rule from the early days of the lane:
cs = re.search(r'call\s+set', r)
if cs and re.search(r'%%h(\d|%%G)', r): return 'call_double'
if cs and re.search(r'(?im)^\s*(if\s+defined\s+\w+\s+)?for\s+%%', r): return 'for_indirect'
return 'delayed'
It keyed call_double off the fragment variable happening to be named h, and answered delayed for everything else - including every %var% reconstruction. Days 02-07 were graded CORRECT with that, because delayed was accepted there. This attempt's draw used none of the forms the rule recognised, so it labelled all nine fixtures delayed, and the Day 15 grader rejects that.
The GM's own question text is the spec:
Classify only the expansion form used by the descriptor reconstruction statement. Ignore output, echo, host-envelope, and separator-noise lines that may use a different expansion form. Submit one of percent, delayed, call_double (the CALL-double form), or for_indirect (the FOR-indirect form).
So the label is a property of the reconstruction statement, which is identified by the variable the fixture echoes at the end (echo(!cfg! -> the line assigning cfg), never the fragment, primer or neutral set lines. The replacement rule:
| reconstruction statement | label |
|---|---|
for %%G in (0 1 2 3) do call set "cfg=%%cfg%%%%frag%%G%%" | for_indirect |
call set "cfg=%%h0%%%%h1%%%%h2%%%%h3%%" | call_double |
set "cfg=!v_a0!!v_a1!!v_a2!!v_a3!" | delayed |
set "cfg=%h0%%h1%%h2%%h3%" | percent |
The attempt's nine fixtures (percent x4, call_double x4, delayed x1) were submitted in one batch and the GM answered CORRECT - mode landed, 32 variants still unspent.
Mastery then ran as a single considered submit: 5130/5130 fields across 5 sets, CORRECT in 18.1 s.
Worked example - the same fixture in two draws
host-context.cmd (answer-id prefix batch-benign, confirmed through its own campaign_id):
Single Solve draw - if_guard wrapper, %FrAg% reconstruction:
set "HUNTRESS_READY=1"
if defined HUNTRESS_READY set "ReCoVeReD=%FrAg0%%FrAg1%%FrAg2%%FrAg3%"
echo(!ReCoVeReD!
Time Trial draw - one-item for /l invoking a subroutine, %h% reconstruction:
for /l %%Q in (1,1,1) do call :HUNTRESS_RECOVER
goto :HUNTRESS_EMIT
:HUNTRESS_RECOVER
set "cfg=%h0%%h1%%h2%%h3%"
exit /b 0
:HUNTRESS_EMIT
echo(!cfg!
Both reconstruct v=1|steps=decode_configuration,return_configuration|adapter=call|stage_count=1|graph=same_language|next_language=none|campaign_id=campaign-d5ce9c6497|host_id=host-d5ce9c6497, so every descriptor-read field is stable across draws; only the rendering - and therefore the expansion label - is re-randomised. That is why the defect could hide behind a CORRECT Single Solve.
Note on control: the Day 15 question text says a one-item FOR loop invoking a subroutine should be for_once rather than call_subroutine, yet bctl()'s call_subroutine for that form was accepted 9/9 in the live group probe, so the grader takes both there. It was left alone - only the proven defect was changed.
Changes made
Lane solver:
challenges/_lib/solve_script_inventory.py-expform()rewritten as the form-derived rule above; it now also takes the full fixture text so it can find the echoed reconstruction variable. Call sites insolve_node_by_node.pyandsolve_shell_we_begin.pypass it.
Diagnostics (new, opt-in, timed-safe - they refuse to run on a route whose start carries a deadline):
autosolve_script.run()-HUNTRESS_TT_BISECT=1halving search (_localize),HUNTRESS_TT_GROUPS=<json>one-submit-per-family probe,HUNTRESS_TT_PROBE=<json>enum-candidate probe. All of them canary the attempt first and stop with a clear hold if it no longer accepts answers.autosolve_script.start()- registers the attempt ingm._ctx()(it callsgm._post(op='start')directly, soGM.start's bookkeeping never ran and the timed corpus could not be written at all), and honoursHUNTRESS_NO_RETRY=1so a diagnostic reconnect can never fall through to a variant-spendingop=retry.
Framework:
ctf_gm.GM.submit- the timed corpus is now saved for any result, not only CORRECT. An incorrect timed attempt used to throw its bytes away, which is the one case where they are needed;blob_0.bin(challenge artifact, not published) of this attempt is what made the offline diagnosis possible.ctf_gm._guard_submitbookkeeping - a GMacceptedresult is no longer filed as a wrong batch. It used to be (onlycorrectwas exempt), so a banked partial probe poisoned[credential store]and the next run refused its own correct submit.
Tests: _test_autosolve_script.py passes. The Day 15 Time Trial real bytes were added as a strict case against the GM-accepted answer set (scripts/tt_accepted_answers.json), and the Day 06/07 references, whose batch-*-expansion values are all delayed, carry a documented allowance - delayed is an accepted value on those attempts, the form-derived label is what Day 15 requires.
Reusable method
- Solve locally, submit once. If a timed batch comes back
incorrectwith no counts, do not re-analyse and do not start a fresh variant. - Check the spent attempt's start response for
deadline: null. If it is null, the attempt is a free oracle: reconnect (never retry), canary one field, then submit one subset per field family. remainingfalling by exactly the subset size means the whole family is right and banked. The family that returnsincorrectis the broken extractor.- Fix the extractor from the GM's own question text, not from an old empirical rule, and re-verify offline against both the Single bytes and the saved timed bytes before touching the GM again.
Files
scripts/offline_check.py- re-runs the adapter on the Single or the saved Time Trial bytes and diffs against the answers the GM graded (single-> 4 known-lenient expansion diffs,tt-> 0).scripts/batch_table.py- maps each batch fixture to its answer-id prefix through its owncampaign_idand prints its reconstruction statement beside the graded label.scripts/dump_batch.py- prints the:HUNTRESS_INSPECTbody of every batch fixture.scripts/make_groups.py,scripts/make_probe.py- the probe plans used above.scripts/save_tt_ref.py,scripts/tt_accepted_answers.json- the frozen GM-accepted Time Trial answer set.scripts/fix_autosolve_record.py,scripts/unpoison.py- board/wrong-store repairs, both reading their values back out of the GM transcript.