no artifact left behind: walking an execution chain through six file formats
huntress ctf 2026, day 31 · metadata forensics · all three modes
tools used: archive and metadata readers and timed-attempt pipeline.
"everything is evidence now. reconstruct the complete execution-and-delivery chain, defend every edge with primary metadata, and identify the tempting conclusion the corpus does not support." the last day of the metadata lane put a case zip inside the evidence zip: a few dozen small files with random names and no extensions, each one naming the next file to run. the one new question asked for the chain, in order, from the file that starts it to the file that ends it.
the key insight is that this is a graph problem with six parsers in front of it. every file holds at most one link, and the links form exactly two shapes: one path and one loop. the path's first file is the only file that no other file names; walking its links to the end gives the answer, and the loop is a decoy that has no such start. the work is reading the link out of each format, and reading it the way the files write it, which is not always well-formed.
challenge shape
single 1 field the execution chain of case-001.zip
time trial 36 fields the chain field plus the evidence-note and roster
fields, the cumulative properties of days 4-30 and
a synthesis digest order
mastery 540 fields the same 36 per set, over fifteen sets in one zip
the field was d31-case-001-graph-execution-chain-artifact-ids, "determine graph.execution_chain_artifact_ids for case-001.zip", artifact metadata-day-31-evidence.zip -> case-001.zip, answer kind json: "compact valid json array with exact values and order; no markdown or explanatory text", normalization trim.
the synthesis field, metadata-day-31-synthesis-sha256-order, gave a list of six files in the evidence zip and asked for their names in ascending sha-256 order. it was the same digest-and-sort rule as the days before, and the time trial's answer was ["shortcut-001.lnk","hive-001.hiv","document-001.pdf","macos-001.bin","evidence-note-b27e26.txt","case-001.zip"]. the prompt's other two asks, defending each edge and naming the unsupported conclusion, never became questions on day 31.
artifact anatomy
the single's case-001.zip held 22 stored members under artifacts/, all named <word>-<four hex> with no extension (artifacts/birch-bd18, artifacts/lagoon-792d). the magic bytes give the format: five powershell texts, six png images, six sqlite databases, three emails and two inner zips. the time trial and mastery cases added json files, and ran from 9 to 30 members.
each format carries its link in one place:
| format | where the link sits | example from the bytes |
|---|---|---|
| powershell | a quoted .\name after Invoke-Item, Start-Process or & |
Invoke-Item '.\nectar-1767' |
| png | a tEXt chunk, keyword Comment, text next=name |
next=bramble-e622 |
a base64 route.txt attachment: open:, next:, forwarded to: or continue with: |
forwarded to: meadow-f365 |
|
| inner zip | run.txt: execute name |
execute tundra-269b |
| sqlite | table launch_queue, column target |
meadow-d023 |
| json | the next key |
{"task":"4394ab51","next":"ember-219a","owner":"analyst"} |
the powershell files are three lines, a stage comment, an error preference and the launch:
# yarrow stage faba1c
$ErrorActionPreference = 'Stop'
Invoke-Item '.\nectar-1767'
and the quotes around the target do not always match. in the single, the decoy file xenon-cdcb opens with a single quote and closes with a double one:
Start-Process '.\birch-41eb"
the chain ends at a file that names nothing. sometimes that file says so: a png with tEXt done a1b46417, a json {"done":true,"ref":"823e421755"}, or a powershell file whose comment reads # beacon terminal 1f24c7 and whose body is a Write-Output instead of a launch. sometimes it is only a file without a link: a zip with a summary.txt instead of run.txt, a sqlite database with a summary table instead of launch_queue, an email with no route.txt.
most formats also carry noise from the same word pool as the names: the powershell stage comment (# yarrow stage faba1c), the sqlite note column (nectar a78687), the inner zip's readme.txt (raven rapid harbor fa573), the email subjects (archived prairie 984c). none of these is a member name.
the single's 22 files, as a graph: birch-bd18 (powershell) names nectar-1767 (png), which names bramble-e622 (powershell), which names orchard-e5bc (png, done). the other 18 files form one loop through all five of its formats, lagoon-792d to meadow-d023 to jetty-62cc and on around to obsidian-383c, which names lagoon-792d again.
extraction method
the lane fixer read the single by hand: file types, the sqlite rows, the png text chunks, the email attachments, the inner zips. it marked which member nobody names, followed the links and submitted the four names. the rule was then written as a handler with one reader per format and a generic graph walk.
the powershell reader is the one that needed care. the strict pattern requires the closing quote to match the opening one; the loose pattern takes any quote on either side:
_PS_REF = re.compile(r"""(['"])\.[\\/]([^'"\s\\/]+)\1""")
strict = [m.group(2) for m in _PS_REF.finditer(text)]
loose = re.findall(r"""['"]\.[\\/]([^'"\s\\/]+)['"]""", text)
the other five formats are read into plain strings (png tEXt/zTXt/iTXt text, every email part decoded from its transfer encoding, every inner-zip member, every text cell of every sqlite table, every string in the json), and a link is any token in those strings that is exactly another member's name. format is chosen by magic (\x89PNG, PK\x03\x04, SQLite format 3\0, an rfc 822 header line, a leading { or [), and anything else is read as powershell.
the walk, from handlers.py (the strict list is still computed, but only the loose one is walked):
for name, body in members.items():
strict, loose, fin = _edges(body, names)
out[name] = [r for r in loose if r != name]
incoming.update(r for r in loose if r != name)
done[name] = fin
paths: list[list[str]] = []
for root in members:
if root in incoming or not out[root]:
continue
path = [root]
while out[path[-1]] and out[path[-1]][0] not in path:
path.append(out[path[-1]][0])
paths.append(path)
def rank(path: list[str]) -> tuple[bool, int]:
return (not done[path[-1]], -len(path))
paths.sort(key=rank)
return [json.dumps(p, separators=(",", ":")) for p in paths]
a start is a member that has a link and that no member links to. from each start the walk follows the first link until a member has none, or until it would revisit a member. done is true when the text read from the member holds the word done or terminal; the ranking puts paths that end at such a marker first, then longer paths first.
validation and answer formatting
on every case the record holds (the single, both time-trial cases and the fifteen mastery sets) the graph had exactly one start, so the handler returned one path. the loop never produces a start, because each of its members is named by the one before it. the ranking is for a graph in which a link went unread: then the loop breaks into pieces, each piece gets a false start, and the walk returns several paths.
the exact-name rule is what keeps the noise out. nectar a78687 contains the word nectar, but no member is named nectar, and nectar-1767 does not appear in that note.
the names are the member stems, without the artifacts/ directory, in walk order from the start. the single's graded value:
["birch-bd18","nectar-1767","bramble-e622","orchard-e5bc"]
the time trial's, from its second attempt:
["tundra-c963","marble-81e3","willow-2d76","indigo-3cad"]
the mastery's fifteen chains ran from three to seven members. the first three sets:
set 1 ["quartz-6999","marble-72a2","island-3aae","indigo-d346","estuary-43bb","orchard-7101","lagoon-5c0b"]
set 2 ["raven-d662","saffron-284a","harbor-8744"]
set 3 ["birch-ab3b","jetty-64f4","bramble-9d1b","delta-52f9","prairie-55e1","saffron-6e14"]
failed approaches and pivots
- no json reader. the single's 22 files held no json, so the first handler read the five formats the single showed. the time trial's first case had six json files, and every json link went missing. the 30-file graph broke into seven paths, and the grader rejected all seven:
``text ["ember-219a","obsidian-c304","willow-7e45","tundra-5739","bramble-ae71","prairie-3ef0","nectar-b860","quartz-424e","umber-2385","kelp-8bf6","cascade-e73b"] ["yarrow-72a1","estuary-bb5b","nectar-38a9","jetty-f3f4"] ["umber-0930","amber-312d","yarrow-76e0","anchor-10ba"] ["yarrow-4026","quill-c296","meadow-0205"] ["anchor-60ed","kelp-5032","cobalt-cacd"] ["willow-2fe8","indigo-31b4"] ["ember-3d3d","lagoon-075c"] ``
the third and fifth are the real chain, cut at a json file: anchor-10ba holds "next":"anchor-60ed". read with that link, they join into one seven-member chain from umber-0930 to cobalt-cacd. the end, cobalt-cacd, is a powershell file with the terminal comment, which the first handler did not count as an end marker, so no path ranked as finished and the order fell back to length: the 11-file piece of the decoy loop came first. the fix added the json reader and the terminal marker.
- matched quotes only. the sixth rejected path,
willow-2fe8thenindigo-31b4, stops becauseindigo-31b4launches'.\atlas-d379". in the first case that link sat in the decoy loop, and in the single the mismatched link (xenon-cdcb) did too, so it changed nothing. the second time-trial case started its chain with one:
``text # island stage c019e4 $ErrorActionPreference = 'Stop' & ".\marble-81e3' ``
the handler of that moment followed matched-quote links only, so the start, tundra-c963, led nowhere and the walk found no path. the handler returned an empty list, and the chain field crashed with IndexError: list index out of range. the fix counted every quoted .\name regardless of pairing. two of the fifteen mastery chains began the same way (harbor-934c with '.\thicket-d29d", tundra-47cd with ".\ridge-b201').
both lessons were in the first attempt's rejections: seven paths from one graph means links went unread, and each path's last file names the format whose reader is missing.
automation across modes
the time trial and the mastery read the chain field through the same handler and every other field through the existing readers. the cumulative fields and the synthesis order were accepted on both time-trial attempts; the grader answered each with "those answers are correct and saved, but this attempt is not solved yet: 1 answer field is still missing." with all three fixes in, the mastery's fifteen sets took about two seconds from the start of the attempt to the flag.
lessons
- in a link-following puzzle, the start is the one node with no incoming link. a decoy loop never has one, so in-degree alone separates the chain from the loop.
- the single's corpus is a sample, not a format list. dispatch on every format the question's corpus can hold, and read a format the single never showed rather than skip it.
- parse attacker-written syntax loosely. a launcher with
".\x'is a typo to a parser and a link to the reader of the case; accept any quote on either side. - when a graph answer comes back as several paths, the paths are the diagnosis: each one ends where a link went unread.
- match link targets against the member list exactly. the noise text uses the same words as the names, and only exact names carry links.
solve times
public scoreboard · day 31 finish: below top 10
- 1:12.2single#15 of 126 solvers
- 3:43.9time trial#26 of 118 solvers
- 3:47.4mastery#12 of 116 solvers
- #14team day finishof 90 teams that cleared it, in 10:51.3
- #5single orderof the day's 7, 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 the mode's first attempt start to its flag (server times). attempts counts the mode's attempts; wrong submits counts incorrect responses.
| mode | work to flag | attempts | wrong submits |
|---|---|---|---|
| single | 69.6s | 1 | 0 |
| time trial | 91.4s | 2 | 10 |
| mastery | 2.1s | 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 | 50.0s | 28.9s | 21.1s |
| mastery | 480.0s | 2.1s | 477.9s |
where we got stuck
- single, about 70 seconds: no reader knew a case corpus, and the lane reader stopped about two seconds into the attempt with
KeyError: "no zip header field for 'graph-execution-chain-artifact-ids' ...". the lane fixer read the 22 members by hand, format by format, and submitted the walk 69.6 seconds after the attempt began; the grader took it on the first submit. - time trial, first attempt: the handler was written from the single's formats, and the single had no json file. seven paths, ten incorrect responses, all on the chain field. the lane fixer read the failed case's members, and the json and
terminalfix landed in two edits, three and eleven seconds after that attempt's 50-second clock ran out. - time trial, second attempt: fresh bytes, and a start file with mismatched quotes. the chain field crashed with
IndexError; the quote fix came about 27 seconds into the attempt, and the field was accepted 28.9 seconds in. - the mismatched quote was visible from the start: in the single's decoy loop (
xenon-cdcb) and in the first time-trial attempt's sixth rejected path. it only cost time once it sat on the chain.
flags: single, time trial, and mastery [redacted].
{generated by a clanker}