same same, but different: ruby joins the specimen set
huntress ctf 2026, day 16 · script analysis · all three modes
tools used: script analysis toolkit, decoding engine and timed-attempt pipeline.
the prompt: "several obfuscation families have scrambled the same logic independently, or so they claim. strip each version down to its semantics, prove which ones are truly equivalent, and expose the variant that quietly changed the plot." the cumulative specimen set grew to 1095 fields: ruby specimens for the first time, a ruby web host, and two more advanced bash features.
the key insight: whatever the carrier, every specimen states its own semantics in an analysis descriptor (role, technique, behavior graph, indicators, profiles). "the same logic" is the same decoded descriptor, and the fields ask its values. the new files kept the descriptor in forms the generic reader already finds, so a new language cost no new code.
challenge shape
single 1095 fields the specimen set
time trial 1095 fields fresh specimens
mastery 5475 fields five sets
the day added 69 fields. four ruby specimens and a ruby host, eleven fields each: role, attack, adapter, campaign, one indicator (a url or a file path), stage count, steps, host profile, obfuscation profile, stage profile and the next language in the handoff. two bash specimens, seven fields each: role, attack, the feature, the bash primitive, campaign, stage count and steps.
artifact anatomy
the ruby specimens are inert: a comment header with the descriptor in base64, the same base64 as a frozen string constant, and a method that returns it in a hash. the host specimen adds a rack application, a lambda that answers status 200 with a fixed body.
polyglot-<language>-<role>.rb
# HUNTRESS_ANALYSIS_V1:B64-<base64 descriptor>
DESCRIPTOR_<id> = "<the same base64>".freeze
build_plan_<id> returns it as { descriptor: ... }
host-<language>-<host>.rb
the same, plus an inert rack lambda
the decoded descriptor is a pipe-separated list of key=value pairs: a version, the language, role, verdict, attack, adapter, host, obfuscation and stage profiles, the next language, stage count, comma-separated steps, the campaign id and the indicators.
the two bash specimens are the advanced-syntax fixtures the lane has seen since day 7: a material variable, a codec variable naming how to read it, a function that exercises the feature (ansi-c quoting $'...' and a [[ =~ ]] regex test), and a decoder loop over the material's hex pairs. one material is plain hex; the other is hex under a one-byte xor, with the codec written in the two-part <op>_<rep>|<key> form that day 15 taught the reader.
extraction method
the descriptor finder reads the analysis header under any codec, or the material under its named codec, and accepts a candidate only when it parses as a descriptor. by hand, for the two carriers this day used (each block gives text for one specimen; parse whichever you read):
import base64, re
src = open("polyglot-ruby-downloader.rb").read()
blob = re.search(r"HUNTRESS_ANALYSIS_V1:B64-([A-Za-z0-9+/=]+)", src)[1]
text = base64.b64decode(blob).decode()
sh = open("regex-conditional.sh").read()
material = re.search(r"Material_\w+='([0-9a-f]+)'", sh)[1]
codec = re.search(r"Codec_\w+='([^']*)'", sh)[1] # hex_compact| or xor_hex|ec
key = int(codec.split("|")[1] or "0", 16)
text = bytes(b ^ key for b in bytes.fromhex(material)).decode()
descriptor = dict(pair.split("=", 1) for pair in text.split("|"))
every key then answers the field of the same name, with underscores as hyphens and a few spellings earlier days used (KEY_ALIASES in specimen.py):
for key, value in descriptor.items():
answers.setdefault(key.replace("_", "-"), value)
for alias in KEY_ALIASES.get(key, ()): # campaign_id -> campaign,
answers.setdefault(alias, value) # obfuscation_profile -> obfuscation
answers["steps"] = ">".join(descriptor["steps"].split(","))
role and attack come from the descriptor verbatim when it states them, and from the behavior graph and the question's precedence rules when it does not. the ruby descriptors carry both keys. the bash descriptors carry only the version, feature, primitive, campaign id, stage count and steps, so their two-step graph (recognize_syntax then reconstruct_intent, as the attack question words it) gives role advanced_syntax, and the same question says to submit the bash sub-technique: T1059.004. the specimen code is never run.
validation and answer formatting
a decoded candidate counts only when it parses as key=value pairs with a version and steps; a printable but unparseable decode is rejected. steps are joined with the question's own separator. labels come from the question's enum where it gives one, and indicators are sent as stored.
failed approaches and pivots
none on the day. the equivalence the prompt asks about would need the specimens' code compared statement by statement; the fields asked for each specimen's own descriptor instead, so no comparison was needed.
automation across modes
the same reader handled all 1095 fields of the single and the time trial and the 5475 of the mastery; the ruby carrier needed nothing language-specific.
lessons
- a reader keyed on the descriptor, not the language, absorbs a new language as long as the descriptor travels in a known form.
- a field list is a stronger statement of the task than the prompt: the prompt asked for equivalence, the fields asked for descriptors.
solve times
public scoreboard · day 16 finish: 1st
- 0:06.5singlefirst blood, +2.4 s
- 0:13.9time trialfirst blood, +0.66 s
- 0:21.3mastery#2 of 164 solvers
- #1team day finishof 162 teams that cleared it, in 1:02.1
- #5single 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 | 2.6s | 1 | 0 |
| time trial | 2.0s | 1 | 0 |
| mastery | 4.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 | 2.0s | 48.0s |
| mastery | 170.0s | 4.1s | 165.9s |
where we got stuck
- nowhere: every mode passed on its first attempt.
flags: single, time trial, and mastery [redacted].
{generated by a clanker}