tooling: static script analysis across powershell, jscript, and batch
the script lane grew cumulatively: powershell on day 1, windows script host jscript on day 2, and batch on day 3. we kept one behavioral model while adding a language-specific recovery layer for each source format.
powershell descriptors
the powershell specimens included an inline base64 literal passed to FromBase64String. decoding it yielded json. values are flattened and classified by shape—url, wallet, global mutex, user agent, file, extension, or recovery note—rather than by unstable json key positions.
lane identity supplies the scenario and att&ck mapping:
| lane | scenario | att&ck |
|---|---|---|
| resource | resource_hijacking |
[redacted] |
| collection | synthetic_collection |
[redacted] |
| impact | synthetic_impact |
[redacted] |
no powershell is executed.
sandboxed jscript recovery
jscript specimens used many encodings but deliberately exposed a pure inspect_* or recover_* function. rather than duplicating every obfuscator, we load source into node's vm.createContext({}). the empty context lacks WScript, activex, require, and host process apis. only the inspection function is invoked, with a two-second execution timeout, and its return value is json-serialized.
a persistent node child accepts one json-encoded source string per line. this turns repeated process startup—too expensive under a seven-second clock—into a single startup per solve.
the descriptor's ordered steps determine role: each graded step list maps to one role ([redacted]), and any graph ending in one particular final step is one more role.
role maps to att&ck, with interpreter roles using a language-specific sub-technique: powershell .001, batch .003, vbscript .005, python .006, and jscript .007.
jscript source-style scanner
some answers describe syntax rather than recovered data. a small lexical scan removes comments and marks string/template-literal positions. that prevents decoy braces, .call( text, or property names inside strings from influencing classification.
the scanner isolates the balanced inspect_* function body and labels:
- function form:
[redacted], anonymous expression, or named expression; - recovery invocation: direct,
.call, or.apply; - descriptor access: dot, bracket literal, or mixed.
this is not a complete javascript parser; it is a bounded parser for the exact syntax family, with strings and comments handled explicitly.
batch fragment reconstruction
batch descriptors are split among numbered variables before a known separator. the parser collects every variable family, unescapes caret-escaped characters, sorts indices, joins values, and selects a result that parses as v=1|steps=...|adapter=.... when multiple candidates validate, references in the reconstruction tail identify the live family.
an embedded material comment provides a fallback. wrappers include base64, reversed text, decimal bytes, and hex pairs; searched transforms include reverse, byte rotations, and every single-byte xor key. a candidate must begin with the descriptor version marker before it is accepted.
the source tail also yields exact syntax labels:
if errorlevel -> [redacted]
if defined -> [redacted]
call :label -> [redacted]
goto :HUNTRESS_DISPATCH -> [redacted]
otherwise -> direct
the expansion label follows the fragment family, not the syntax: any call set that reads the h0..h3 family grades as [redacted], looped or flat (the flat form only appeared in a day-4 mastery); any other for ... do call set loop is [redacted]; everything else is [redacted].
output normalization
descriptor values become answer fields by converting underscores to hyphens, with explicit aliases where the grader shortened a name: campaign_id becomes campaign, host_id becomes host-id, and jscript file_path becomes path. this normalization is centralized so daily solvers do not each encode slightly different vocabulary.
day 4 additions
vbscript and language-agnostic material
the vbscript specimens store their payload in a Material_<id> constant and name the encoding in Codec_<id> = "representation|transform|key". those two labels were graded verbatim. decoding with them yields the same v=1|steps=... descriptor family as batch and jscript, so roles, att&ck mapping and field normalization were reused unchanged.
the code is a cross-check, not ignored: the Split separator and index reversal in Load_ give the representation, and the arithmetic in Decode_ (Xor previous, Xor keyBytes(i Mod n), (x + k) Mod 256, (x - k + 256) Mod 256, reversed indexing) gives the transform. a header that does not decode loses to the codec the code implements.
control flow is read with a block stack over Recover_: openers (Select Case, Do, While, For x = 0 To 0, On Error Resume Next) push a label, closers pop, block If pushes a neutral frame, one-line If is ignored, and the innermost labeled frame at the Decode_ call wins.
the material/codec reader accepts the assignment syntax of several languages (Const, var/let/const, $name =, python with annotations, batch set "...", object literals), so a new specimen language that keeps the convention needs only its new labels.
control flow in a new language
vbscript's control labels come from an exact block-stack reader. for a specimen language we have not seen, a language-agnostic reader finds the decode call and walks back to the nearest unclosed block: try or On Error Resume Next -> [redacted], switch/select/match -> [redacted], do -> [redacted], while -> [redacted], a loop that runs once (for x = 0 to 0, range(1)) -> [redacted], nothing -> [redacted]. closers (end, }, loop, wend, next, done) are counted so a block that already ended does not count, and a decoy if (true) wrapper is ignored because if is not an opener. it is a best guess with the vocabulary graded so far, not a parser; a specimen without a decode call leaves the field open.
day 5 additions
python specimens hid the same material/codec pair as vbscript, but the language-agnostic path written on day 4 rejected all of them, for two reasons. it read only quoted string values, and it accepted only a version-1 descriptor. both assumptions are gone:
- any literal. the value after
MATERIAL_<id> =(orConst,$x,local x,x <-) is read to the end of its statement, across lines inside brackets and string runs. a few rewrites map other languages' literals to python syntax (&H1Fhex,Array(...),@(...),"a" & "b"), andast.literal_evalparses the result without executing anything: a string, a list or tuple of integers, or a bytes literal. - list-shaped data. the loader accepts integer sequences and bytes directly, alongside the string representations.
- any descriptor version. a decode counts if it starts with
v=<digits>|and has astepsentry. - multi-byte keys. header keys may be comma-separated hex.
- lying headers. if the declared codec does not decode, the search tries every representation and transform, deriving single-byte keys from the known first byte
v.
field ids can carry multi-word file stems, so the solver places a field by the longest stem it starts with and reads the longest answer suffix. with the python-specific module switched off, the generic path alone answers every day-5 field. a new descriptor-hiding language should only need roles for step graphs it has never seen.
finding the descriptor in a language we have not seen
every script day so far added one language, and each language hid the same kind of descriptor in a different carrier: jscript computed it inside an inspect_* function, batch split it over numbered set lines, vbscript and python stored it in a Material_ constant next to a codec header. the "language-agnostic" path from days 4 and 5 only knew the last of those carriers. to measure that honestly we treated each graded language in turn as unseen, routed its specimens through the generic path instead of their own module, and scored every field against our saved runs:
| language treated as unseen | generic path before | after |
|---|---|---|
| jscript | 0 of 936 fields | 585, the rest are its syntax-style labels |
| batch | 0 of 864 | 648, the rest are its expansion and control labels |
| vbscript | 504 of 576 | 573, 3 control guesses wrong |
| python | 504 of 504 | 504 |
the fields still missing are labels that only exist for that language (how a jscript function is declared, how batch expands its variables). they cannot come from the descriptor, so a new language will always leave a few of them open. everything the descriptor carries now comes out on the first run.
three ways to find it
the finder tries cheap, specific readers first and a brute search last:
- the material convention. a
Material_/Codec_pair in any language's assignment syntax, read with the literal reader described above. - plaintext fragments. a line whose assigned value contains
v=<digits>|starts a run; the values of the following assignment lines are appended until a line is not an assignment. batch caret escapes and backslash escapes are undone first. this is the batch layout without any batch-specific code. - every literal under every codec. candidate blobs are quoted strings, strings continued across lines (
"ab" +newline"cd", python's implicit concatenation in parentheses), long bare tokens such as comment headers, number lists separated by commas or blanks (m=(118 61 ...)), two neighbouring lists joined (firstPart.concat(secondPart)), and char-code runs ([char]118+[char]61,chr(118),string.char(118)). each blob is loaded under every representation (hex, decimal, octal, base64 and its variants, ...), forwards and reversed.
the key comes from the plaintext
the descriptor always starts with a known prefix: v=1|steps= (or another version digit) for the pipe form and {"steps":[" for the json form jscript used. that is enough known plaintext to recover the key of every transform we have seen, so the search never loops over key values:
def decoders(data, prefix):
d0, p0 = data[0], prefix[0]
yield 0, identity
yield 1, xor_with(d0 ^ p0) # single-byte xor
yield 1, add(p0 - d0) # add / subtract mod 256
yield 2, rolling_xor_from(d0 ^ p0)
for n in range(1, 8):
yield 2, rotate_left(n)
for size in range(2, min(8, len(prefix) - 2) + 1):
key = [data[i] ^ prefix[i] for i in range(size)]
yield 10 + size, repeating_xor(key) # key length up to 8
a candidate is decoded only when its first len(prefix) bytes reproduce the prefix, so most of the search costs a few byte operations. a full scan of every specimen in a day-5 bundle takes about a millisecond per file.
choosing between decodes
a wrong guess can still decode to something that parses. two traps showed up in testing:
- a wrong version digit. with the prefix
v=1|steps=and an 8-byte repeating key, av=2descriptor yields a self-consistent key that garbles one byte in every eight. the text is printable and still parses. - one line of a split string. a base64 run cut at a line break decodes to a truncated but valid descriptor.
so every literal is decoded and the candidates are ranked: most descriptor fields first (a truncated decode has fewer), then the simplest codec (identity before xor before an 8-byte key), then the number of step-name words that belong to the step vocabulary seen so far, which separates a real step name from the same name with one byte garbled per key period. a decode is only a candidate when it is printable and its steps value is a comma list of lowercase identifiers. both descriptor forms flatten to the same field map, and descriptor keys are emitted under every alias the grader has used, so the solver's suffix lookup finds whichever name the question asks for.
out-of-sample checks
the finder was tuned on the four carriers above, which makes the table above an in-sample score. we therefore wrote the descriptor into eleven carrier shapes no specimen had used: a bash integer array with a 3-byte key, an octal printf string, a jscript string split over three lines, a python parenthesised run, a powershell -join array, powershell and lua char-code runs, an 8-byte repeating key, a rolling xor stored as reversed hex, spaced hex, and an add-encoded json descriptor. the first version missed three of them and picked the wrong decode for three more (the two traps above); all eleven now come out byte for byte, and they run as regression tests. a carrier outside these shapes can still be missed, and then the solver fails loudly with no descriptor found instead of guessing.
roles for a step graph we have not seen
the role comes from the ordered steps, and a new language has so far brought new step graphs with it. an unknown graph used to raise, which took every field of that specimen down with it, including the descriptor values that are copied verbatim. now an unknown graph gets a role guessed from its verbs: a fixed priority list maps words that signal recovery notes, uploads, multi-stage fetch-and-run chains, next-stage hand-offs and in-memory execution to a role ([redacted]), then falls back on remote-fetch, write and dispatch words. the rules reproduce every graph graded so far, but they were written after seeing those graphs, so they are a consistency check rather than a held-out result. the att&ck field is derived from the role, so a wrong guess costs two fields per specimen, and the solver prints the guess so that it gets checked first.
day 6 additions
bash specimens went through the language-agnostic descriptor finder with no bash-specific parser. its literal reader already joined neighbouring quoted runs, which covers shell concatenation ('abc''def' is one literal). two step graphs joined the role table ([redacted]), and bash got its own interpreter sub-technique ([redacted]).
the new graph field is answered in the question's own separator: every ordered_tokens answer is re-joined with the separator its answer format names ([redacted] on day 6), at one place for every mode, and the offline check lists each value it re-joined.
day 6 also taught the generic control-flow guess statement-level guards. On Error Resume Next placed on the line before the decode call covers it without a block, until On Error GoTo 0 (or set +e until set -e in shell); a guard outside an inner block still loses to the innermost block. with that, the leave-one-out score for vbscript went from 858 to 864 of 864 fields.
day 7 additions
placing a field by the file its question names
field ids are <language>-<tag>-<field>, and the solver used tables of known tags and file stems to find the specimen. a new tag (persistence) with no table entry crashed every field of its specimen. a field is now treated as a specimen field whenever its question names a file in the bundle (evidence.zip -> node-schedule-descriptor.mjs), and the named file is used directly.
roles from the question, history as a fallback
the role question is an enum. for a step graph the role table has never seen, the solver takes the one enum value that shares a word with the steps, and recomputes the att&ck id from that role; a tie is never guessed. graded roles are kept as a history, newest first, so a role the organizers rename falls back to an earlier accepted value if the enum still offers it, then to the word match. the role tables themselves are plain data rows, one per graph, kept append-only.
labels read both ways
a reversal label ([redacted]) meant "the decoded bytes are in reverse order" on day 4 and "the text is reversed" on day 7. every reversal label is now tried both ways, and the reading that yields a valid descriptor wins.
an empty transform is identity, and the fallback search also anchors on a bare v=N| prefix, for descriptors that do not start with their steps.
the whole label space as a test
labels compose a byte representation, a layout, an optional reversal and a transform ([redacted]). a test builds all 1008 combinations with every transform and checks that each decodes from its header. the first run decoded 348; the fixes were the two reversal readings, loaders for percent and escape representations, fixed-width digits with no separator (8 bits, or 3 octal or decimal digits), and keeping the richer of the plain and reversed-text searches.
joining split literals outside the strings
"a" & "b", "a" + "b" and "a" .. "b" are joined into one literal before decoding. the join was a regex over the whole expression, so a base64 chunk ending in + lost that character. literals are now joined only when the text between two string literals is operators, whitespace and line continuations.
compiled carriers
a specimen that is not text is turned into text before the finder runs, without executing anything: compiled applescript through osadecompile, lua bytecode through luac -p -l -l (its constant listing), compiled autoit (.exe or .a3x, after upx -d when packed) through an autoit decompiler, and anything else as its printable strings, each also tried without its first character, since length-prefixed constant pools glue a length byte onto the string.
day 8 additions
analysis headers
day 8's script-host and php specimens carry a comment header <marker>:<codec>-<payload> whose payload decodes to a version-3 descriptor. the finder reads it before any other path. four codecs were graded ([redacted]), and base32 and base85 are registered too. an unknown codec name tries every decoder on the payload and on its reverse, and a payload glued to its comment's closing characters (*/, ', ;, >) is trimmed.
stated values win
a version-3 descriptor states the role, attack, adapter, host profile, obfuscation profile, stage profile, next language and stage count. when it does, those values are the answers verbatim: the role is not derived from the step graph and the attack is not mapped from the language ([redacted]).
day 9 additions
relations by field grammar
a field is a relationship (previous-language, child-stage, parent-count, previous-stage-count, a bare parent) only when a relation word (previous, prior, parent, upstream, next, child, downstream, ...) sits right before its kind at the end of the id; kinds are member words (stage, file, name, ...), language and count. a tag that merely contains a relation word (child-loader) is no relation. descriptor keys parse with the same grammar once next_stage, nextStage and next-stage are normalised, so direction never comes from question wording, and the suffix lookup that maps a field to a descriptor key never walks past a relation word: previous-language used to fall through to the specimen's own language.
a stage graph from descriptor claims
the stage graph maps every bundle member with a descriptor to that descriptor. stage claims compare by file name, and none claims nothing (an explicit root or leaf). a relation the descriptor does not state is read off the graph: forward from the member's own claims, backward from its own parent claim, else from the members whose next-stage claim names it:
def _parents(g, member):
own = claims(g.get(member, {})).get(("before", "stage"))
if own:
return own # a stated parent claim wins
return sorted(
m for m, d in g.items()
if m != member and member in claims(d).get(("after", "stage"), [])
)
a count is the length of that list, and a language comes from the related member's descriptor, else from its file extension. no evidence still raises.
an impossible family tree
impossible() weighs every member's claims against the bundle: 3 for a cycle, a parent later in its own chain, or a claim the other side contradicts; 2 for a parent nobody ships or a claimed language the related stage does not speak; 1 for each root of a tree with several, once any stage claims a parent. a child the bundle does not ship is normal. members rank by worst weight, then total. fields whose last word is impossible, inconsistent, orphan, contradict… or conflict… (optionally followed by a kind) are answered bundle-wide with the member, its language or the count; when every claim holds, the field raises. seven synthetic bundles, one per rule, and one consistent tree that must raise pin the behaviour.
ranked candidate labels
a label the specimen does not state (a style, an expansion or control label, the role of an unknown step graph, an attack that follows from a guessed role) comes back as an ordered candidate list instead of one guess: the question's enum when it has one, else every value accepted earlier for the field's suffix, ordered by the number of words each shares with the specimen's decoded values, ties in their original order.
tables that follow their files
the role, att&ck and interpreter tables are re-read when one of their files changes (one stat per call), and the label vocabulary is re-checked at most every two seconds. a long-running solver process answers from the current tables, not from the copy it read at import.
rows need evidence
a table row becomes a default answer only when an accepted answer backs it: the row cites a challenge field, and is refused unless that field's confirmed value equals the row's; the newest confirmed row per key wins. a row without evidence is a candidate ranked after every confirmed value, never a default. the interpreter rows seeded from the att&ck matrix became unconfirmed: in those languages an interpreter role answers [redacted] first and the matrix's seed only as a candidate. a technique the descriptor states still wins over every row.
day 10 additions
wmi subscriptions
day 10's specimens were mof files whose only content was the descriptor, but the prompt described wmi persistence: filters, consumers, bindings, and the subscription that survives a reboot. hlib.wmi builds one model of those objects from every way a script can create them:
- a mof: namespace pragmas (absolute, relative and
\\serverforms),instance of __EventFilter/ the five standard*EventConsumerclasses /__FilterToConsumerBinding, aliases ($Filter), object paths,#pragma deleteinstanceand redeclaration. - powershell:
Set-WmiInstanceandNew-CimInstancewith argument and property hashtables and variables,[wmiclass]instances with property assignments and.Put(), fetched instances used in a binding, removals. wmic ... PATH <class> CREATE k=v,....- batch files that
echoa mof together line by line, followed per target file (>truncates,>>appends), with whether amofcompran on it.
each binding gets a verdict with its reasons: it resolves when its filter and consumer references name live instances in its own namespace, and it persists when it also sits in root\subscription or root\default, its consumer class has a provider (a standard class or one a provider registration names) and its filter has a wql query. Register-WmiEvent subscriptions resolve but end with the session, so they are grouped with the decoys. anything that depends on a value we cannot resolve from literals is reported as unresolved, never guessed. the persistence rule is our inference from how windows handles permanent subscriptions; no grader has confirmed it yet.
carriers
the descriptor finder also reads a mof with no analysis header (the descriptor in a hex Descriptor property, base64 spread over adjacent string literals among decoy objects, or the header inside a block comment), unseen two-part languages (ps_xml, reg_file, inf_section and an xsl host), and bash material inside a heredoc, a here-string or an array of percent-encoded chunks. a field is matched to its member's own file stem first, so a tag that spells a qualifier reads its own fields.
day 11 additions
escaped bash material
advanced bash specimens can keep their material escaped (\xNN sequences, or an ansi-c $'...' literal). the material decoder now handles both states: text that still contains backslashes is unescaped, with the $'...' wrapper removed first, and text whose escapes the literal reader already undid is read as code points directly. two failure modes this closed:
- plain text was accepted as percent-encoding even when it held no
%at all. that reading is the identity minus whitespace, so a material whose escapes were already undone lost its tab characters and decoded to a wrong value. a percent reading now needs at least one escape. - digit runs were parsed as python integer literals, and a fixed-width run such as
01100111or065is not one, so one such value crashed the whole material scan. numbers are now decimal unless they start with0xor&H.
one more known prefix
the known-plaintext key recovery (a repeating key recovered from a prefix the descriptor must start with) gained the advanced-bash descriptor's own prefix, v=1|feature=. it is longer than v=1|, so it recovers a five-byte key when a material has lost the variable that names its codec.
day 12 additions
fields from the other lanes
a specimen's descriptor answers the analysis fields; a question about the artifact itself (a header field of the file a stage ships in) has no descriptor key. such a field now goes to cross-lane field resolution over the bytes of the member it names, with the member's stem taken off the field first:
def _cross_lane(files, field, art, miss):
stem = _art_stem(art)
name = field.removeprefix(f"{stem}-") if field.startswith(f"{stem}-") else field
try:
return crosslane.resolve(name, archive.named(files, art), art, skip="script")
except KeyError as cross:
raise KeyError(f"{miss.args[0]}; {cross.args[0]}") from None
the descriptor still answers first. the resolver is tried only after the script readers have missed, and a field neither side answers keeps both errors in its crash line.
day 13 additions
batch material shifted by a constant
batch material declares its codec in a header. day 13 brought an additive transform ([redacted]): every byte of the decoded material moved up by a constant. the transform search tries every additive shift in both directions, each also reversed, the same way it tries every xor key and rotation, and keeps the reading that starts with a descriptor prefix:
for n in range(1, 256):
for x in (
bytes((c - n) & 0xFF for c in raw),
bytes((c + n) & 0xFF for c in raw),
):
out += [x, x[::-1]]
the expansion label read from the statement
the batch -expansion field asks "classify only the expansion form used by the descriptor reconstruction statement". day 13's later variants called for a second reading of the reconstruction ([redacted]); the solver answers both, in order.
day 14 additions
more material transforms, and a header without its comment
the material decoder for vbscript-style specimens learned index-based transforms (each byte xor'd with, added to or subtracted from its position), bit rotations left and right, a bitwise not, a nibble swap, and the two-step add-then-xor and xor-then-add, each keyed and confirmed by the known v= start of the decoded material. the descriptor finder now also accepts a typed constant that carries the encoded descriptor with no analysis comment beside it, in any carrier and under any of the header codecs: a carrier that drops the comment still answers.
the day's new carrier, an msbuild project, needed none of it: its comment carried the header as before (trust the process).
day 15 additions
day 15's bash specimens declared their codec in two parts on one line, <op>_<rep>|<key>: an operation and a representation joined by _, then a one-byte key in hex after a |. the header reader split it the way older headers are written (a representation, then a transform name), found no transform called <key>, and the material fell through to the codec search, which still decoded it by trying every representation and key. the short form is now read as the codec its two parts name:
def short_header(head):
if head is None or head.key or not SHORT_KEY.fullmatch(head.transform):
return None
op, _, rep = head.representation.partition("_")
if rep not in SEARCH_REPS:
return None
key = [int(k, 16) for k in head.transform.split(",")]
named = transform_for(op, len(key))
return Codec(rep, named, key) if named in TRANSFORMS else None
transform_for looks the operation word up in the same word table the codec search uses; a key longer than one byte turns a single-byte operation into its repeating-key form.
the decode is tried before the search, and the labels the specimen reports are kept exactly as its header writes them. a two-part header that does not decode its material still falls to the search.
day 19 additions
an analysis header inside a string literal
day 19's aspx host carried its c# script inside a string literal (sharp practice), so the header's line ended in the two characters \n and the payload ran into the next statement; a slower literal search read the descriptor instead. the header reader now ends the payload at an escape sequence and takes a hex payload's hex run.
day 23 additions
a layered analysis header
day 23's timed bundles carried a new header codec (press start to decode): HUNTRESS_ANALYSIS_V1:LYR-<layers>-<payload>, where <layers> is one to three of b64, b32, hex, rev and frag joined by _ in the order they were applied. the reader undoes them last to first. every step maps text to text, and the byte layers decode to latin-1 text, so a layer whose output is not utf-8 survives into the next one; a chain counts only when its result parses as a descriptor, and the written order is tried second in case a chain was listed in decode order. base32 layers had dropped their = padding, so padding is restored before decoding.
def layered(raw):
names, _, payload = raw.partition("-")
steps = layer_steps(names) # unknown name -> UnknownLayer
for order in (steps[::-1], steps):
for text in peel(payload, order): # keyed layers fan out
if parse(text) is not None:
return text.encode("latin-1")
raise ValueError(f"header layers {names!r} do not decode the payload")
the layer table also takes the other header codecs, the compression layers (zlib, gzip, raw deflate, bz2, xz), any transform name the decoding engine knows, and keyed xor, add, sub and caesar layers with the key in the name or recovered over every value; any of _ + > , | may join the names. a name the table does not know raises an error that names it, never a guess.
specimens named by a random stem
the time trial renamed every sample to six random hex digits (9a6714.js) and named its fields <language>-<stem>-<field>. the lane's field placement now recognizes that shape and routes each field to the member whose stem it carries, before any role-word matching.
composite answers
new fields asked for several labels at once, each spelled out in its question, so each is a small function over values the descriptor and the existing readers already produce:
campaign-token: the campaign id after its first hyphen;indicator: the first indicator present in the order the question lists;carrierandobfuscation(python): two profiles joined by|;style: three labels joined by|, per language (jscript's function, invocation and property-access styles; vbscript's representation, transform and control wrapper; batch's topology, control wrapper and expansion form), each read by the reader of the standalone field;- powershell
url,secondary,tertiary: the secondary and tertiary indicators by the sample's scenario (resource hijacking, collection, impact).
the reader takes the label order and the joiner from the question's words ("as three labels joined by | in that order").
batch's expansion form as code
the batch style composite's third label is the reconstruction statement's variable-expansion form, read from the statement's own code. the day 23 question grades it by a different rule than the older standalone -expansion question ([redacted]), so the reader keeps both rules and the question picks one.
day 28 additions
bare runs as a last-resort carrier
the descriptor finder looks for the family's analysis header first, and for a specimen with no header it falls back to the encoded constants it finds in string literals. a probe set of forty-eight headerless specimens built on day 28 had four it could not read: their only material was a long run outside any quotes, glued to the code around it (a sed expression's / delimiters stuck to a base64 run, for example). such runs are now a last resort: every unquoted token of 24 or more encoded characters is split at its slashes, unwrapped from a delimiter pair, and searched for hex or base64 runs of 32 characters or more, each piece a candidate carrier only when nothing else was found.
LONG_TOKEN = re.compile(r"[A-Za-z0-9+/=_\-:,|.%]{24,}")
CODEC_RUN = re.compile(r"[0-9A-Fa-f.]{32,}|[A-Za-z0-9+/]{32,}={0,2}")
def bare_runs(src: str):
seen = set()
for m in LONG_TOKEN.finditer(src):
token = m.group()
inner = token[1:-1] if token[0] == token[-1] == "/" else token
for piece in (*token.split("/"), inner, *CODEC_RUN.findall(token)):
piece = piece.strip(":,|.-")
if len(piece) >= MIN_BLOB and piece not in seen:
seen.add(piece)
yield piece
the probe set reads forty-eight of forty-eight with it.
day 30 additions
a guessed label goes out unsure
day 30's specimens were beanshell inside a jsp string literal (spill the beans). the day's solver, which the next day's solver starts from, returned a label it had to guess (a field the descriptor does not state, read through the unanswered or the impossible reading) as one confident value whenever it had a single candidate, so a wrong guess went out in the same group as the fields the descriptor states. every guessed field is now a runner.Unsure: its own group, so a miss never takes the set's other fields with it. the 1802 fields of the day-30 single and all three day-30 fixtures reproduce.
three readers of the descriptor graph
the day-30 prompt audit read every script prompt of days 1 to 30 against the corpora. three hints named a comparison the descriptor graph can answer, though no corpus states it in prose: an adapter that names a network primitive no remote step of its own backs (day 11), a claimed next stage absent from the bundle's files (day 15; shipped means present among the files, not claimed by a descriptor, and stages written at run time recur, so these are ranked candidates) and a shipped member claimed as next by a stage whose own steps fetch it (day 13). each is now a reader, routed by the field's words; a field that names none keeps its own path:
def hinted(field, g, shipped=()):
toks = _dashed(field).split("-")
if "unsupported" in toks:
return unsupported(g)
if {"missing", "absent"} & set(toks) or {"never", "there"} <= set(toks):
return dangling(g, shipped or set(g))
if "delivered" in toks:
return fetched(g)
return None
on the real day-11 corpus the unsupported list is empty, as it should be. the other 19 script hints the audit found are prose with nothing in the bytes to read.
changelog
- day 1: powershell base64-json descriptors, shape-based value classification.
- day 2: sandboxed jscript recovery in a persistent node worker, behavior-graph roles, the source-style scanner.
- day 3: batch fragment reconstruction with a material fallback, batch syntax labels, language-specific att&ck sub-techniques.
- day 4: vbscript material/codec decoding with a code cross-check, a language-agnostic control-flow guess, the control-flow block stack, language-agnostic material reading, and the corrected expansion rule above.
- day 5: python specimens; literal reading for any value form, list-shaped data, any descriptor version, multi-word stems; specimen code is never run; a descriptor finder for an unseen language (material convention, plaintext fragments, every literal under every codec with the key recovered from the known prefix, json descriptors), candidate ranking, verb-based roles for unknown step graphs, and a leave-one-out score per language with eleven out-of-sample carrier tests.
- day 6: bash specimens through the generic finder, two new step graphs,
ordered_tokensanswers re-joined with the question's separator; statement-level guards in the generic control guess. - day 7: fields placed by the question's named file; roles from the question's enum with earlier accepted roles as fallback; reversal labels read both ways, percent / escape / fixed-width loaders and a 1008-case label grid; split literals joined outside strings; compiled applescript, lua and autoit carriers.
- day 8: analysis comment headers under any codec (the four seen on day 8,
[redacted], plus base32, base85, unknown names and reversed payloads); version-3 descriptor values used verbatim for role and attack. - day 9: relation fields and descriptor keys read by grammar; a stage graph from descriptor claims for relations a specimen does not state; an impossible-family-tree check that refuses when every claim holds; ranked candidate labels from the question's enum or earlier accepted values; label tables re-read when their files change; table rows that become defaults only with an accepted answer behind them.
- day 10: mof files as descriptor carriers, with or without the analysis header; a wmi subscription model from mof, powershell, wmic and batch echo builders with a resolve and persist verdict per binding; two-part languages; bash heredoc, here-string and array material; fields matched to the member's own stem first.
- day 11: escaped bash material (
\xNN,$'...') decoded escaped or already unescaped; a percent reading needs an escape; fixed-width digit runs read as decimal instead of crashing the material scan; thev=1|feature=prefix for known-plaintext key recovery. - day 12: a field the specimen's descriptor does not answer is tried against the other lanes' readers by exact name over the artifact's bytes.
- day 13: an additive byte shift for batch material; a second reading of the expansion label.
- day 14: index-keyed, bit and two-step material transforms; a descriptor constant read with no analysis comment beside it.
- day 15: the two-part
<op>_<rep>|<key>codec header read as the codec it names, before the codec search. - day 19: an analysis header inside a host's string literal: the payload ends at an escape sequence.
- day 23: the layered
LYRheader codec (named layers undone in reverse, compression, transform and keyed layers, a named error for an unknown one); fields placed by a random hex stem; composite answers from the question's own label list; batch's expansion form read by the style question's own rule. - day 28: long unquoted encoded runs (split at slashes, unwrapped from a delimiter pair, hex and base64 runs inside) as a last-resort carrier for headerless specimens.
- day 30: guessed label fields returned as unsure; descriptor-graph readers for an unsupported adapter, a dangling next stage and a shipped member its stage fetches, routed by the field's words.
{generated by a clanker}