shell we begin: bash specimens and an answer format written in the question
huntress ctf 2026, day 6 · script analysis · all three modes
tools used: script-analysis toolkit and timed-attempt pipeline.
the evidence zip carried the cumulative script set (powershell, jscript, batch, vbscript and python from days 1-5) plus six new bash specimens. 399 fields per set; 42 were new bash-* fields: role, att&ck id, adapter, campaign, stage count, indicators (host id, file path, url, cron path), and one new kind of field, the ordered behavior graph itself.
the key insight: the descriptor finder built on day 5 read every bash descriptor on the first run, and every field came out right except one family. the graph field asked for the steps joined by >, the descriptor stores them joined by ,, and the question said so in its answer format.
challenge shape
six specimens, one per role: host-context.sh, memory-stage.sh, embedded-write.sh, remote-write.sh, local-dispatch.sh and staged-chain.sh. tags map to file stems as on earlier days (bash-chain-* -> staged-chain.sh).
each specimen has seven fields, bash-<tag>-role, -attack, -adapter, -campaign, -stage-count, -steps and one indicator (-host-id, -file-path, -url or -cron-path). role is the usual enum, attack takes T####[.###] or none, stage count is an integer ("base-10 integer with no explanatory text"), steps is the new ordered_tokens kind, and the rest are verbatim exact_text.
artifact anatomy
the bash carrier follows the material/codec convention of the vbscript and python days, written as shell:
readonly Material_<id>='<chunk>''<chunk>''<chunk>'
readonly Codec_<id>='<representation>|<transform>|<key hex>'
Load_<id>() { ... base64 --decode | od -An -v -tu1 ... } # material -> bytes
Decode_<id>() { ... d[n-1-i]="$((e[i] ^ <key>))" ... } # undo the transform
Recover_<id>() { ... printf '%03o' ... printf '%b' ... } # bytes -> text
two shell details matter for a static reader:
- adjacent quoted strings concatenate in bash, so
'abc''def'is one literal. the literal reader joins neighbouring quoted runs before decoding. - recovery turns each byte into text through an octal escape (
printf '%03o', thenprintf '%b'). nothing needs to run: the decoded bytes are the text.
across the six specimens of the single the codecs combined base64_literal, base64_chunks, decimal_space, reversed_decimal and percent_hex (%76%3d...) with identity, add_modulo_256, single_byte_xor and reverse_then_xor. as on day 5 the header key is hex while the shell arithmetic writes it in decimal ((x - <key> + 256) % 256). the decoded descriptor is the usual v=1|steps=...|adapter=...|campaign_id=...|....
extraction method
bash was a language the solver had never seen, so its fields went through the language-agnostic descriptor finder: decode each Material_ constant with its declared codec, and accept the result only if it parses as a descriptor; if the header does not decode, search every representation and transform with the key recovered from the known v=1|steps= prefix. descriptor values are copied verbatim (campaign_id -> campaign, host_id -> host-id, cron_path -> cron-path).
roles come from the ordered steps. four graphs were already known:
decode_configuration, return_configuration-> benign_utilitydecode_embedded, write_file-> dropperacquire_remote, write_file-> downloaderlocate_local, dispatch_process-> launcher
two were new: acquire_remote, dispatch_pipe and profile_host, acquire_remote, write_file, change_mode, dispatch_process. for an unseen graph the solver guesses the role from its verbs (dispatch after acquire_remote, nothing written: stager; a profile-acquire-write-dispatch sequence: staged_chain), and both guesses held. the att&ck id follows the role: the interpreter roles take bash's sub-technique T1059.004, stager and downloader T1105, dropper T1140, benign none.
validation and answer formatting
the graph field's question reads "recover the ordered behavior graph using > separators", and its answer format is ordered_tokens, "exact tokens joined by
with no surrounding spaces or explanatory text". the descriptor's own
spelling is not the answer format: steps=step_a,step_b in the material is step_a>step_b on the wire. runner.conform now applies the question's separator to every ordered_tokens answer, whatever the parser produced (the separator comes from answerfmt.parse(syntax).separator, which also understands words such as "joined by commas"):
TOKEN_SPLIT = re.compile(r"\s*(?:->|[,;|>])\s*")
TOKEN = re.compile(r"[A-Za-z0-9_.-]+")
def conform(q, value):
fmt = q.get("answer_format") or {}
if fmt.get("kind") != "ordered_tokens":
return value # integer / json / pattern kinds have their own rules
sep = answerfmt.parse(fmt["syntax"]).separator # ">" here
tokens = TOKEN_SPLIT.split(value.strip())
if sep is None or len(tokens) < 2 or not all(TOKEN.fullmatch(t) for t in tokens):
return value # not a clean token list: leave it
return sep.join(tokens)
only a clean list of identifier-like tokens is rewritten, so free text that happens to contain a comma is untouched. the offline check flags any value whose tokens are not joined by the question's separator, so a parser emitting the wrong one stays visible. the solver also compares every question's answer-format kind with the kinds it has handled on earlier days, and surfaces an unseen kind together with its syntax text, so a new format is read before anything is submitted.
failed approaches and pivots
the first full submission carried the descriptor's comma-joined graphs for all six specimens and lost on those fields only; every other bash field was right. re-reading the question's answer format, not the artifact, fixed it.
automation across modes
the solver places each field by the longest file stem its id starts with and dispatches by extension: earlier languages to their parsers, an unknown one (.sh) to the generic finder. the time trial and mastery (two sets of 399 fields) ran the same function in about 0.1 seconds per set.
lessons
- read
answer_format.syntaxbefore the first submission. it is data, and it can contradict the artifact's own spelling. - put answer formatting where the question is known, once, instead of in each parser: the next separator change costs nothing.
- a descriptor finder that does not care about the language turned a new language into one formatting fix.
solve times
public scoreboard · day 6 finish: 1st
- 1:27.0singlefirst blood, +44.8 s
- 1:31.1time trialfirst blood, +1:19
- 1:34.1masteryfirst blood, +1:28
- #1team day finishof 182 teams that cleared it, in 1:45.7
- #4single 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 | 1m27s | 1 | 28 |
| time trial | 4s | 1 | 0 |
| mastery | 3s | 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 | 7.0s | 1.1s | 5.9s |
| mastery | 7.0s | 1.2s | 5.8s |
where we got stuck
- the graph field's separator: 28 wrong submits on the single, every one of them traced to the graph fields, before the question's answer format was read. once the join was fixed the single, time trial and mastery fell in about eight seconds.
- the two unseen graphs needed their role confirmed before the timed tiers; the verb-based guesses were right on the first try.
flags: single, time trial, and mastery [redacted].
{generated by a clanker}