zip code: applescript as one more carrier, and bash read by its syntax

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

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

the prompt: "a delivery archive nests scripts inside containers inside more containers. trace each member's role and handoff without executing a single one, and identify the link in the chain that was never supposed to be delivered." the delivery was the cumulative specimen bundle, every script language seen so far, with two new groups: four applescript specimens and two bash specimens written in advanced shell syntax.

the key insight: the story asked nothing the bundle had not asked before. the archive was flat (105 members, no nested container), every member encrypted with zip aes-256 under the same password as on day 12 (infected; 7z x -pinfected, since stock macos unzip cannot open aes entries); the "containers inside containers" and the undelivered link were narrative. the new members carried the same analysis descriptor every specimen carries, in carriers the generic reader already searched: a marker comment and a property literal in applescript, encoded material in bash.

challenge shape

single        913 fields   105 members, one per specimen
time trial    913 fields   the same bundle, other values
mastery      1826 fields   two bundles

the applescript members (polyglot-applescript-<tag>.applescript, tags benign-utility, downloader, launcher, staged-chain) ask eleven fields each: role, attack, adapter, campaign (APPLESCRIPT-<8 hex>), a url or file path, stage count, steps, host profile, obfuscation, stage profile and the next language. the two bash members (process-substitution.sh, subshell-pipeline.sh) ask seven: role, attack, campaign (BASHX-<8 hex>, upper-case hex where the applescript ids are lower case), feature, primitive, stage count and steps.

the question text does part of the work. role is the same eleven-value enum as on day 12, and for the bash pair the question names the answer: "for an advanced bash specimen whose decoded analysis graph is recognize_syntax then reconstruct_intent, classify the script interpreter itself", so role is advanced_syntax, attack the bash interpreter sub-technique (T1059.004, with the parent T1059 and none "also accepted"), and steps the question's own two tokens in that order. stage count is a base-10 integer, steps are tokens joined by > with no spaces, the rest exact text.

artifact anatomy

every specimen hides one descriptor, a key=value|key=value record that answers the analysis fields. the applescript members store it twice: after the analysis marker in a comment, and as the value of a property, the same payload byte for byte:

-- HUNTRESS_ANALYSIS_V1:<CODEC>-<payload>
property descriptor_<id> : "<payload>"
on build_plan_<id>()
  return {descriptor:descriptor_<id>}
end build_plan_<id>

the codec is one of the four from day 8 on (B64, HEX, HB64 = hex of base64, FRAG = dot-separated hex fragments), a different one per member, and the descriptor's obfuscation_profile names it (base64, plain_hex, hex_base64, fragmented_hex). the v=3 record decodes to the same keys the other languages' descriptors carry.

the bash pair stores a v=1 record as material under a declared codec, with a Decode() function that shows the arithmetic:

readonly Material_<id>='<hex>'
readonly Codec_<id>='xor_hex|<key>'      # or 'hex_compact|'
Decode() { ... value=$((16#${raw:index:2} ^ 16#<key>)) ... }

one member xors each hex byte with a single key byte (written in hex after the |), the other is plain compact hex. the record reads v=1|feature=…|primitive=…|campaign_id=…|stage_count=…|steps=….

the two bash specimens are about syntax, not behavior: process substitution (<(...)) and a pipeline into a subshell. their role is the advanced-syntax role and their steps say to recognize the syntax and reconstruct the intent.

extraction method

the reader looks for the descriptor in every carrier it knows, in any language: marker comments with a declared representation, long string literals, numbered fragment variables, number lists, character-code runs, encoded material behind a codec header. a candidate counts only when it decodes to a record that begins the way every descriptor version begins:

PREFIXES = (
    b"v=1|steps=",
    b"v=2|steps=",
    b"v=3|steps=",
    b'{"steps":["',
    b"v=1|feature=",
    b"v=1|",
    b"v=2|",
    b"v=3|",
)

the long prefixes double as known plaintext: a short repeating xor key is recovered from them when the material's codec header is missing.

a language the reader has no module for still goes through this generic path, which is how applescript was read on its first appearance. labels the descriptor does not state are derived the way they are for every language: the role from the steps, the attack technique from the language and role. the bash v=1 records state neither, so both come from that rule.

the bash material by hand:

import re

def bash_record(src: str) -> str:
    material = re.search(r"Material_\w+='([^']*)'", src).group(1)
    codec = re.search(r"Codec_\w+='([^']*)'", src).group(1)
    raw = bytes.fromhex(material)
    name, _, key = codec.partition("|")
    if name == "xor_hex":
        raw = bytes(b ^ int(key, 16) for b in raw)
    return raw.decode()

our reader did not parse the two-part xor_hex|<key> header on the day: it took xor_hex for the representation and the key for the transform, decoded nothing, and the fallback search over transforms and keys recovered the single-byte key from the known prefix instead. the result was the same record; the header now decodes directly (vbscript.short_header).

validation and answer formatting

the two applescript carriers decode to the same record, which cross-checks the header reading. bash material, from its declared codec or from the search, counts only when it decodes to a valid record. the steps field joins the descriptor's steps with >, as it has since day 6.

answer the descriptor's stated role and attack, not what the steps suggest. on this day the applescript records' steps, stage profile and obfuscation were dealt out independently of the role: the benign utility carried a download-and-run graph, yet its stated attack=none was graded correct, where the question's precedence applied to those steps would have said ingress transfer. the launcher and staged chain state the parent T1059, which the question accepts in place of the language-specific sub-technique.

failed approaches and pivots

none. the new carriers matched patterns the generic reader already had.

automation across modes

each mode serves the full bundle again with new descriptor values; the same reader answered all 913 fields of a bundle and both bundles of the mastery.

lessons

solve times

public scoreboard · day 13 finish: top 10

  • 0:03.9single#3 of 176 solvers
  • 0:06.4time trialfirst blood, +0.03 s
  • 0:09.2mastery#2 of 167 solvers
  • #4team day finishof 165 teams that cleared it, in 1:55.2
  • #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 1.8s 1 0
time trial 1.3s 1 0
mastery 1.9s 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 1.3s 48.7s
mastery 80.0s 1.9s 78.1s

where we got stuck

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

{generated by a clanker}