Tactical LogHuntress CTF 2026 // team archive

Days / Day 26 / Script Analysis / Mixed Signals

DAY 26//LANE: SCRIPT ANALYSIS//STATUS: CORRECT x3

Mixed Signals

Script Analysis SSTTMM Modes reported CORRECT in this write-up

Mixed Signals — Day 26 (script-analysis)

  • Challenge id: script-analysis-day-26-beam-message-flow
  • Lane: script-analysis (homestation-owned)
  • Prompt: "An Erlang escript passes messages between processes, and some of its indicators look suspiciously familiar. Trace the message flow, and separate the true cross-language indicators from deterministic collision decoys planted to look like old friends."
  • Flags (all three modes CORRECT):
    • Single Solve: Token6878320ea80b7bb2719c1fe33c2ce5e8
    • Time Trial: Tokena801e376278276793fe7255507a6cc1f
    • Mastery: Tokenb31436e7ebe6f08b633f610df7b2f152 (solved 2026-10-26T13:49Z, by the team solver)

What the challenge actually is

A scaled-up version of the Day-22 "installer-script-chain" script-triage family. Each mode is a batch of answer ids, each id derived from a script fixture inside an evidence archive. The theme ("Erlang escript / message flow / collision decoys") is flavour; mechanically every fixture is a single-file descriptor carrier.

Modeanswer idsshape
Single Solve1615scenario ids (resource-*, collection-*, impact-*)
Time Trial1677one "set" of carrier ids
Mastery1677010 sets × 1677, outer zip of evidence-01.zip … evidence-10.zip (setK ↔ evidence-0K)

Each evidence-0K.zip (challenge artifact, not published) holds ~170 fixtures across 25+ carriers: PowerShell, Python, JScript/JavaScript/node, VBScript, batch, bash, and the polyglot carriers PHP, Lua, Perl, Ruby, TypeScript, AppleScript, AutoIt, AutoHotkey, C# script, Google Apps Script, Groovy, GitHub Actions YAML, MSBuild XML, NSIS, WMI MOF, JSP, GDScript, Erlang escript, Elixir. Every fixture embeds a layered-encoded key=value descriptor (e.g. LYR-hex_b64_rev, b32_b64_rev, b64_b32_b64, …). 21 field classes per set: campaign, campaign-token, role, steps, attack, obfuscation, url, url-host, stage-count, stage-profile, next-language, file-path, path-leaf, indicator, style, feature, primitive, carrier, secondary, tertiary, handoff-id.

The banked extractor (autosolve_script + solve_node_by_node) already resolves 19 of 21 classes with zero changes — including the attack precedence graph, campaign reconstruction, roles, steps, obfuscation profiles. Single and Time Trial landed CORRECT automatically at 09:00. Mastery did not.

Why Mastery failed at 09:00 — three root causes (all proven)

BUG 1 — set/blob misalignment at ≥10 sets (the big one)

autosolve_script.solve_fields_ext splits the outer zip into per-set blobs and aligns them to sets by index after sorted({set-prefix strings}). Lexicographically that is ['set1','set10','set2','set3',…,'set9'], while the inner archives sort numerically ['evidence-01'…'evidence-10']. So set10→evidence-02, set2→evidence-03, … — 9 of 10 sets read the wrong evidence archive. Because every set reuses the same file names with different bytes (the "collision decoy" theme), the mis-read produces confident, plausible, wrong answers rather than a crash.

Measured on the real Mastery bytes (verify_sortbug.py):

stock solve_fields_ext on full blob: answered=16770/16770  match_known_good=2506  mismatched=14264
mismatches per set: set2:1603 set3:1604 set4:1575 set5:1580 set6:1576 set7:1573 set8:1579 set9:1588 set10:1586

85% of answers wrong. Day 11 had only 2 sets (lexical order == numeric) so the bug was dormant until a double-digit set count appeared. The geometry_flags even warned: mastery_sets 2 -> 10 (was Day 11).

BUG 2 — sequential solve overruns the window

The 10 sets are analysed one-after-another (~15–18 s each ⇒ 150–180 s for extraction alone; the offline stock run exceeded a 120 s timeout). Add download + a 16770-answer submit and it does not fit the ~5-min Mastery deadline. The 09:00 worker was torn down by the daily manager mid-solve — no autosolve/submit event was ever logged.

BUG 3 — descriptor decode spill (1 field)

One csharp_script fixture in set8 decoded with trailing non-printable bytes after the real value: …/.7e2d2dd8d2ed7742.stage\x00<garbage>. exact_text is graded literally, so that single field fails the whole all-or-nothing batch even when the other 16,769 are right.

The "collision decoys" in the prompt turned out to be a red herring for debugging: the decoy file_path values are the correct answers (verified single-field: the descriptor value /tmp/huntress-php/.<16hex>.stage is ACCEPTED). The only genuinely wrong field was the BUG-3 decode spill. Time was lost chasing a decoy-reconstruction rule that did not exist.

How Mastery was finished (this session)

A standalone Commander solver (now promoted to challenges/_lib/script_multiset.py):

  1. A.start(gm, …/mastery, for_time=True) — fresh variant via the sanctioned timed-start override (HUNTRESS_TIMED_START=commander-override; 31 variants remained, HOF off so it was an untimed scored attempt — still earns the flag + points).
  2. Expand the outer zip; map setK → evidence-0K explicitly from each question's own artifact field (fixes BUG 1).
  3. Solve the 10 sets in parallel (fork pool, 32 cores) — each set a single-set mini-start so its internal sort is unambiguous (fixes BUG 2): 18.3 s for all 16,770.
  4. Sanitise path fields (trim at .stage, drop trailing garbage) — fixes BUG 3.
  5. One submit → result: CORRECT.

Diagnosis used the untimed attempt's partial grading (accepted = all-right subset vs incorrect) to localise the wrong class by field-type and then by field — 19/21 classes cleared immediately; file-path/path-leaf narrowed to the one csharp field. Validated offline: script_multiset.solve reproduces 16770/16770 GM-correct answers in 18.8 s.

Next time this lane goes 100× better — recognition + determinism

Recognise instantly (from the prebrief geometry, no bytes needed): answer ids namespaced set1. … setN. with N ≥ 2 and mastery_sets > 2, carriers including the polyglot set, descriptors tagged HUNTRESS_ANALYSIS_V1:LYR-<layers>. script_multiset.recognize(start) returns this in O(ids).

Deterministic path (script_multiset.py, offline-tested, not yet wired into production — operator freeze; stage for the post-freeze deploy per the D27 plan):

  • explicit setK→evidence-0K mapping (never index order),
  • parallel per-set extraction (18 s, not 180 s),
  • path/url field sanitiser (BUG-3 guard),
  • falls back to the stock single-set path for legacy 1-set shapes.

Production fix to fold into autosolve_script.solve_fields_ext (one-line correctness fix for BUG 1 even without the parallel rewrite):

# was: sets = sorted({ setprefix })          # lexical => set10 < set2
# fix: sets = sorted({ setprefix }, key=lambda s: int(re.sub(r'\D','',s) or 0))
#      and map each set's blob by matching the question `artifact` evidence name,
#      not by positional index.

Plus the path sanitiser in the generic builder, and (speed) dispatch sets to a fork pool.

See also: kb/commander_script_analysis_fastpath.md (updated), lessons lessons.py, and the engineering note in docs/COMMANDER_CORE.md engineering state.

Artifacts / reproducibility