pascal's wager: a free pascal elf, and a configuration blob back in raw form
huntress ctf 2026, day 12 · binary reverse engineering · all three modes
tools used: binary-analysis toolkit and timed-attempt pipeline.
the prompt: "pascal is betting you won't read its record layouts. take the wager: unpack the archive stager's structures and read the configuration straight from memory's own filing cabinet." the new tag, d12, was a free pascal build: an x86-64 elf in every delivery, carrying the lane's hcfg configuration blob.
the key insight: every d12 field was a field the lane had asked before, so the generic producers answered the new runtime without a line of pascal-specific code. the blob was the raw form this time (the HCFG magic in .data), not day 11's base64 text, and the offset rule followed it.
challenge shape
the single asked 120 fields, ten per tag for d01 to d12, over one evidence zip; the time trial asked the same 120 of a fresh zip, the mastery 360 over three. the ten d12 fields:
d12_artifact_sha256_1 exact text sha-256 of the delivered member
d12_analysis_architecture pattern a name, a tool label or the machine code
d12_analysis_format exact text
d12_analysis_machine pattern a label or the machine code
d12_analysis_config_campaign exact text } from the hcfg blob
d12_analysis_config_domain exact text }
d12_analysis_config_mutex exact text }
d12_analysis_config_url exact text }
d12_analysis_config_crc32_hex pattern }
d12_analysis_hcfg_offset integer base 10
artifact anatomy
the d12 member (d12--variant-NNN.elf) is a statically linked free pascal program, about 100 kb, stripped: no .symtab, and only seven sections (.note.ABI-tag, .text, .rodata, .data, .fpcdata, .bss, .shstrtab). the runtime shows in the section table and one string:
.fpcdata a section only the free pascal compiler emits
FPC 3.2.2 [2021/05/16] the compiler's version string, inside .fpcdata
an unstripped build would also carry fpc_initializeunits and free pascal's UNIT_$$_NAME mangling (SYSTEM_$$_...); our runtime check accepts any of the three markers, and in these stripped deliveries only the version string was there.
the hcfg blob sits in .data: the HCFG magic, a version byte, a one-byte xor key, a length, a crc32 of the plaintext, and the xor-encoded json, the layout the toolkit article describes.
extraction method
the binary lane answers by field name: a registry maps each name to a producer over the tag's main member. format, architecture and machine come from the elf header; the config fields from the blob, found by its magic and accepted only when the decoded json's crc32 matches the header; the offset from where that blob starts.
a magic match alone is not trusted: decoys with the right magic and the wrong checksum have appeared on earlier days, so every candidate is decoded and checked before it counts. by hand, on the extracted member:
import json, struct, zlib
b = open("d12--variant-000.elf", "rb").read()
at = b.find(b"HCFG") # the offset field, base 10
key = b[at + 5]
length, crc = struct.unpack_from("<HI", b, at + 6)
plain = bytes(x ^ key for x in b[at + 12 : at + 12 + length])
assert zlib.crc32(plain) == crc
config = json.loads(plain) # campaign, domain, mutex, url
print(at, f"0x{crc:08x}", config)
validation and answer formatting
the config values are the json's values verbatim, and the crc32 field is the header's value in the form the question's pattern asks (lowercase, 0x, eight digits). the labels were elf for the format and x86-64 for both the architecture and the machine. the machine answered as the architecture label this time: the question's pattern accepts a label, a tool's symbolic name, or the code in decimal or hex, and the solver sends the form the lane's grader has accepted before. the offset is the file offset of the blob's first byte in the elf as extracted.
failed approaches and pivots
none on the day. the prompt's "filing cabinet" points at where the blob loads in memory (its section and virtual address); the reader for that was prepared on day 11 and is still unasked.
automation across modes
the same cumulative solver answered every mode: one producer call per field, the digests computed while the analyzers read, mastery's three sets in about 0.7 seconds.
lessons
- a new runtime is mostly new strings. the fields stay the format's, so a registry of producers per field name outlives the runtime.
- an offset rule belongs to the carrier, not the day: raw magic, raw offset; base64 text, the text's offset.
solve times
public scoreboard · day 12 finish: 1st
- 0:06.5singlefirst blood, +0.21 s
- 0:10.0time trialfirst blood, +1.5 s
- 0:13.8masteryfirst blood, +4.8 s
- #1team day finishof 166 teams that cleared it, in 1:06.5
- #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 | 5.3s | 1 | 0 |
| time trial | 3.7s | 1 | 0 |
| mastery | 6.7s | 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 | 30.0s | 2.9s | 27.1s |
| mastery | 30.0s | 3.0s | 27.0s |
both timed attempts were unranked: the organizer's ranked pool was empty that day, so the flags count but carry no hall-of-fame time.
where we got stuck
- nowhere. the downloads (under two seconds per timed mode) were the largest share of each attempt.
flags: single, time trial, and mastery [redacted].
{generated by a clanker}