press start to decode: an analysis header built in layers

huntress ctf 2026, day 23 · script analysis · all three modes

tools used: script analysis, decoding search engine and timed-attempt pipeline.

"a gdscript resource loader builds its strings in layers, one power-up at a time. undo the construction, recover the exact indicators, and correlate its stage relationships with the rest of the corpus to find the level that doesn't belong." the day's carrier was godot's gdscript, beside every earlier day's samples. the single was familiar; the timed modes changed three things at once: the analysis header gained a layered codec, every sample was renamed to a random hex stem, and new fields asked for several labels joined into one answer.

the key insight: the layer list is written in the order the layers were applied. undo it from the last name to the first, carry every step as text that can hold any byte, and accept a reading only when it parses as a descriptor.

challenge shape

single        1461 fields   every earlier sample's descriptors plus the
                            day's polyglot-gdscript-<role>-<field> family
time trial    1495 fields   157 samples renamed <6 hex>.<ext>; fields
                            <language>-<stem>-<field>, composite labels
mastery      10465 fields   the same over seven bundles

artifact anatomy

a gdscript carrier is a class script (extends RefCounted) whose first line is a comment header, # HUNTRESS_ANALYSIS_V1:<CODEC>-<payload>, and whose body repeats the payload as a string constant. decoded, the payload is the descriptor the questions ask about: v=3|language=...|role=...| followed by the attack technique, adapter, host and stage profiles, the obfuscation profile, the next language, the stage count, the ordered steps, the campaign id and the url or file path.

the single's headers used codecs we had read since day 8: HEX, B64, HB64 and FRAG, one per gdscript specimen. the time trial's used a new one:

HUNTRESS_ANALYSIS_V1:LYR-<layers>-<payload>
<layers>  one to three of b64, b32, hex, rev, frag, joined by "_"
          in the order they were applied

rev reverses the text and frag splits it into dotted fragments. the base64 and base32 layers kept their = padding in the bundles we saw; the undo pads each layer anyway, so a variant that strips it decodes the same. a chain such as b64_hex_rev means base64 first, then hex, then reverse, so the decode is reverse, unhex, then base64. the winning time-trial bundle held 75 such headers using 50 different layer chains, across php, lua, applescript, autohotkey, groovy, typescript and the other carriers the event has used.

the samples themselves were renamed: 3bad9c.ps1, 9a6714.js, 34c1d9.cmd, and the field ids carry the same stem (jscript-9a6714-style), so a field reaches its file through the stem, not through a role word as on earlier days.

extraction method

a layer chain is undone last to first. each layer's undo maps text to text: the byte layers (base64, base32, hex) decode to bytes that are then read as latin-1, so a layer whose output is not utf-8 (a compressed stream, a raw key) survives intact into the next undo. the chain is accepted only if its final text parses as a descriptor; otherwise the stated order is tried as written, in case a chain was written in decode order.

LAYERS = {
    "b64": lambda t: latin(b64decode(padded(t, 4))),
    "b32": lambda t: latin(b32decode(padded(t, 8), casefold=True)),
    "hex": lambda t: latin(bytes.fromhex(t)),
    "rev": lambda t: t[::-1],
    "frag": lambda t: t.replace(".", ""),
}

def layered(raw):
    names, _, payload = raw.partition("-")
    steps = [LAYERS[n] for n in re.split(r"[_+>,|]", names.lower()) if n]
    for order in (steps[::-1], steps):
        text = payload
        try:
            for undo in order:
                text = undo(text)
        except ValueError:
            continue
        if specimen.parse(text):        # a v=N| record with steps
            return text
    raise ValueError(f"header layers {names!r} do not decode the payload")

a layer name the table does not know raises a named error instead of being guessed around; the table also accepts the warmups lane's transform names, the compression layers and keyed xor or shift layers, which the same day's hints made likely next.

the composite fields are spelled out in their questions, so each is a small function over values the descriptor already gives:

validation and answer formatting

a composite answer is only as good as its weakest label, so each label comes from the same reader and vocabulary as its standalone field. the one that differed was batch's variable-expansion form. on earlier days, the -expansion field graded a reconstruction statement guarded by if defined X as percent, whatever its own form. the day 23 -style question grades the guarded statement's own code form instead: a guarded call set over doubled percent references is call_double, a guarded set over !name! references is delayed, and a guarded set over %name% references stays percent (the grader rejected delayed for five such statements in the time trial). other values seen in the third slot: for_indirect for a for ... do call set loop. the labels are lowercase; the uppercase forms were rejected. the reader now keeps both rules, one per question.

failed approaches and pivots

the solver stopped at the first field it could not read. the time trial had three such fields, one after another (no reader for the layered header; no reader for the jscript style composite; then an error in the first draft of the composite reader), and each attempt revealed one of them. reading every field of a failed set independently would have shown the first two in the first attempt.

automation across modes

the same reader answers the single, the 1495 time-trial fields and the 10465 mastery fields; the mastery's 7 bundles parse in a few seconds.

lessons

solve times

public scoreboard · day 23 finish: 1st

  • 0:03.4singlefirst blood, +0.19 s
  • 6:41.0time trialfirst blood, +38.1 s
  • 8:58.5mastery#4 of 151 solvers
  • #1team day finishof 140 teams that cleared it, in 8:58.5
  • #3single 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. attempts are server attempts: the time trial's three took six solver runs, the mastery's one took two.

mode work to flag attempts wrong submits
single 1.4s 1 0
time trial 396.4s 3 17
mastery 136.0s 1 51

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 50.0s 47.9s 2.1s
mastery 230.0s 136.0s 94.0s

the time trial's winning attempt is the third one: two runs on it crashed before the corrected solver answered with 2.1s left. the mastery's corrected answers also went in on its first attempt.

where we got stuck

flags: single, time trial, and mastery [redacted].

{generated by a clanker}