all the world's a stager: a stage graph from descriptor claims, and a family-tree check that can say "none"
huntress ctf 2026, day 9 · script analysis · all three modes
tools used: script-analysis toolkit and timed-attempt pipeline.
the prompt: "every stager claims to know who came before it and who comes next. build the relationship graph from final-byte evidence alone, and expose the stage whose claimed family tree is impossible." the bundle was day 8's specimens plus four lua polyglots, an openresty lua handler, a windows script component scriptlet saved as .js, and two new bash advanced-syntax fixtures.
the key insight: the relationship graph is already written down. the version-3 descriptors state their next language, and the chain and relay specimens (jscript, batch, vbscript, python) name their next stage file, so the day-8 solver answered all 695 fields on its first submit in every mode. the backward half of the prompt and the impossible family tree had no field; we built both on day 9 from the same claims, and the check finds nothing impossible in this bundle.
challenge shape
695 answer fields, 80 more than day 8. polyglot-<language>-<role>-<field> (lua, four roles), host-lua-openresty-lua-<field> and host-sct-scriptlet-jscript-<field> each ask the eleven day-8 descriptor fields, from role and attack to next language. bash-advanced-recursive-walk and bash-advanced-trap-handler ask role, attack, feature, primitive, campaign, stage count and steps. the role enum is day 8's eleven labels; the attack syntax is "t#### or t####.###", with none allowed.
the relationship graph showed up as 18 -next-language and 9 -next-stage fields. no field asked for a previous stage, a parent, or the impossible stage. the mastery delivered five evidence bundles in one zip: 3,475 fields under one clock.
artifact anatomy
a lua polyglot is the day-8 php polyglot translated: the comment header, the encoded descriptor in a local with a random hex suffix, and a build_plan function that returns it. the openresty carrier puts an inert request handler in front of the same lines. the scriptlet is xml in a .js file, with names and payloads elided:
<?xml version="1.0"?><scriptlet><registration progid="..." classid="{...}"/>
<script language="JScript"><![CDATA[
// <MARKER>:<CODEC>-<payload>
var descriptor_<hex> = "<payload>";
function buildPlan_<hex>() { return { descriptor: descriptor_<hex> }; }
]]></script></scriptlet>
all six use day-8 header codecs and decode to day 8's version-3 descriptor. the bash fixtures keep the older material convention: a readonly material_<hex>='...' constant beside a codec_<hex> label naming the codec, xor_hex|<key> (hex pairs, each xored with a one-byte key written in hex) or base64_literal| in our bundle; the file's own Decode function spells the arithmetic out. the material decodes to a version-1 descriptor v=1|feature=...|primitive=...|campaign_id=...|stage_count=...|steps=....
79 of 83 members carry a descriptor the generic finder reads; the other four are powershell files (three day-1 samples with their own reader, one that no field asks about). 27 carry a next_language key (20 name a language, seven say none) and 10 a next_stage. eight of the ten next stages name files in the bundle: five members with a descriptor of their own, and three pointing at one of the day-1 powershell samples, which ships but has no generic descriptor. the other two, from the batch chain and relay, name stage-<hex> files the bundle does not ship. no descriptor claims a parent.
extraction method
the solver looks for the analysis marker before it dispatches on the file extension. that order kept the scriptlet off the jscript path, which runs a specimen's own inspect function in an empty node context: xml does not parse as javascript. with the marker present, every field comes from the descriptor as on day 8.
relations are read by grammar, not by keyword: a field id or descriptor key is a relation only when a relation word sits right before its kind at the end.
BEFORE = {"previous", "prior", "parent", "upstream", "caller", ...}
AFTER = {"next", "child", "children", "following", "downstream", ...}
KINDS = {"stage", "file", "name", "member", "script", "language", "count", ...}
def relation(field: str) -> Relation | None:
toks = field.split("-")
if toks[-1] in BEFORE | AFTER: # a bare `parent`
at, kind = len(toks) - 1, "stage"
elif toks[-1] in KINDS and len(toks) > 1: # `previous-language`
at, kind = len(toks) - 2, toks[-1]
if toks[-1] in ("count", "name") and at > 0 and toks[at] in KINDS:
at -= 1 # `previous-stage-count`
else:
return None
way = "before" if toks[at] in BEFORE else "after" if toks[at] in AFTER else None
return Relation(way, kind, at) if way else None
descriptor keys use the same function once next_stage and nextStage become next-stage; a value of none marks an explicit root or leaf.
the stage graph maps every member to its descriptor, and its edges are the claims. a forward question is the member's own claim. a backward one uses the member's own parent claim if it states one, else inverts the graph: the parents are the members whose next-stage claim names this file, compared by file name so a claim written as a path still matches. on day 9's fields the graph was never needed: every relation asked was stated by the specimen's own descriptor.
validation and answer formatting
stated values win, as on day 8: a next language or next stage in the descriptor is the answer as written, the graph answers only what the descriptor leaves out, and with no evidence at all the solver raises rather than guessing. the six new header specimens graded day 8's labels: attack by role (T1059 for launcher and staged chain, T1105 for the downloader, none for the benign utility), obfuscation by header codec (FRAG fragmented_hex, HB64 hex_base64, HEX plain_hex, B64 base64), and host profiles copied from host_profile (the four lua polyglots share day 8's standalone profile).
the two bash fixtures' version-1 descriptor states no role and no attack. their two-step graph (recognize the syntax, reconstruct the intent) maps to the graded role advanced_syntax, and the question asks for "the bash interpreter att&ck technique", graded T1059.004; both come from the graded role and interpreter tables that day 7's advanced bash filled. feature and primitive are the descriptor's values as written.
the family-tree check scores every member's claims against the bundle:
| weight | finding |
|---|---|
| 3 | a cycle over child claims, a parent later in its own chain, a claim the other side contradicts |
| 2 | a parent nobody ships, a claimed language the related stage does not speak |
| 1 | two roots in one tree, once any stage claims a parent |
languages compare by interpreter family (a javascript claim holds for .js and .mjs), and a child the bundle does not ship is normal: chains and relays name files they would write. members rank by worst finding, then by the sum; with no finding the check refuses rather than naming the least suspicious stage. on day 9 it found nothing: ten forward claims, no parent claims, no cycle, and both members that state a next stage and a next language agree with that stage's extension.
failed approaches and pivots
the challenge itself had no rejected value; the pivot came from testing the backward relations. the field-to-key lookup tried ever-shorter suffixes of the field id until one named a descriptor key. for <language>-<tag>-previous-language it found no previous-language key and went on to language: the specimen's own language, returned with full confidence and no crash. a synthetic bundle with made-up languages, a relay whose parent is written in another language, caught it.
the first fix stopped the walk at any relation word, which crashed a child-loader specimen's adapter field. the walk now stops only where the grammar finds a relation:
rel = specimen.relation(field)
stop = rel.at if rel is not None else len(field)
toks = field.split("-")
for i in range(1, min(stop, len(toks) - 1) + 1):
key = "-".join(toks[i:]) # never past the relation word
if key in answers:
return key
raise KeyError(f"no {language} answer for {field!r}")
automation across modes
the same solver answered all three modes; the stage graph is built at most once per answer set, and only when a field needs it. the other day-9 changes (ranked candidate labels, label tables that follow their files, table rows that need an accepted answer before they become defaults) are in the toolkit article.
lessons
- a suffix lookup that drops leading words changes meaning silently:
previous-languageis notlanguage. parse relations by grammar and test ids nobody has asked yet. - answer a backward question by inverting forward claims, but let a stated claim win.
- an anomaly check must be able to say "none".
- dispatch on content markers before extensions: a
.jsfile can be xml.
solve times
public scoreboard · day 9 finish: top 10
- 0:05.8single#3 of 187 solvers
- 0:08.1time trialfirst blood, +0.03 s
- 0:12.9masteryfirst blood, +1.2 s
- #7team day finishof 173 teams that cleared it, in 4:18.7
- #3single orderof the day's 5, 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 | 2.3s | 1 | 0 |
| time trial | 2.9s | 1 | 0 |
| mastery | 6.7s | 1 | 0 |
the clock
server timer of the winning attempt; used is attempt start to flag, left is what remained on the clock.
| mode | time available | time used | time left |
|---|---|---|---|
| time trial | 11.0s | 1.1s | 9.9s |
| mastery | 30.0s | 2.8s | 27.2s |
where we got stuck
- the challenge: nowhere. the new carriers decoded through the day-8 header reader, and every mode was correct on its first submit.
- testing the backward relations:
previous-languagesilently answered with the specimen's own language, and the first fix crashed on achild-loadertag. reading relations by grammar fixed both.
flags: single, time trial, and mastery [redacted].
{generated by a clanker}