mangled: c++ symbols and an xor configuration blob
huntress ctf 2026, day 2 · binary reverse engineering · all three modes
tools used: binary-analysis toolkit, archive and metadata toolkit, and timed-attempt pipeline.
each set combined a day-1 c elf with a new c++ executable: elf on the single and time trial, sometimes a mingw pe in mastery. the task joined itanium c++ abi symbols with a compact encoded configuration.
the key insight: validate the configuration blob end to end (bounds, crc over plaintext, json) so a whole-file scan is safe, and take c++ names in the exact form the toolchain's symbol table prints them.
artifact anatomy
the download was evidence.zip, aes-encrypted with the password infected (the usual malware-sample convention), holding the c elf and the c++ binary (7z x -pinfected evidence.zip).
HCFG | version:u8 | xor_key:u8 | length:u16le | crc32:u32le | ciphertext
ciphertext is json xored with a single-byte key; crc32 covers the decoded plaintext. the class of interest had a vtable _ZTV<len><Class>, type information beginning _ZTI, and a const score(char const*) method _ZNK<len><Class>5scoreEPKc (exact names _ZTV15DiscoveryEngine, _ZTI15DiscoveryEngine and _ZNK15DiscoveryEngine5scoreEPKc for the single).
extraction method
offset = blob.find(b"HCFG") # repeat for every occurrence
version, key = blob[offset + 4], blob[offset + 5]
length, expected_crc = struct.unpack_from("<HI", blob, offset + 6)
plain = bytes(x ^ key for x in blob[offset + 12:offset + 12 + length])
if zlib.crc32(plain) != expected_crc:
reject()
config = json.loads(plain)
every HCFG occurrence is tried; decoy strings and symbol names fail the checks. nm or readelf -sW give the abi names, with standard-library and __cxxabiv1 rtti entries filtered out. binaries are classified by magic, the one with a valid blob gets the c++ analysis, and the other gets the day-1 elf triage, so rotating filenames do not matter.
validation and answer formatting
seventeen ids: c_sha256, c_marker, c_has_symtab, c_recover_code and c_machine for the c elf (the day-1 recipe), then cpp_sha256, cpp_format, cpp_xor_key, cpp_config_crc32, campaign, domain, url, mutex, has_cpp_vtable, has_cpp_typeinfo, mangled_score_symbol and vtable_symbol. the sha-256 fields are a pattern ("exact 64-character hexadecimal sha-256 value; use no prefix"): hashlib.sha256(member).hexdigest() of each extracted binary, lowercase. the two has_cpp_* fields are enums of true and false.
the json supplied campaign, domain, url and mutex, each answered verbatim (the mutex keeps its single backslash once the json escape is decoded); the key and crc are lowercase 0x hex, as their pattern syntax says; format is lowercase elf or pe. on mingw pe, objdump -t shows coff symbols with comdat section prefixes, and the grader expected the first match in table order exactly:
.text$_ZNK<len><Class>5scoreEPKc
.rdata$_ZTV<len><Class>
failed approaches and pivots
readelf-style names were rejected for the format field: ELF64 and uppercase ELF both missed before lowercase elf. on the pe, raw elf names, demangled names, msvc-style names and none were all rejected before the comdat-prefixed table form was confirmed. on the elf the raw _Z names from the symbol table were right.
automation across modes
one solver handled every mode; mastery sets mixed pe and elf c++ variants in the same attempt, and the magic-based classification covered both.
lessons
- a magic, a length and a checksum together make a byte scan trustworthy.
- symbol answers are toolchain output; record the exact view that was graded.
solve times
public scoreboard · day 2 finish: top 3
- 7:10.0single#4 of 325 solvers
- 10:22.7time trial#3 of 307 solvers
- 18:47.6mastery#7 of 280 solvers
- #2team day finishof 264 teams that cleared it, in 18:47.6
- #1single 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 our first start of the mode to its flag; earlier preparation was not recorded.
| mode | work to flag | attempts | wrong submits |
|---|---|---|---|
| single | 57s | 1 | - |
| time trial | 0s on the clock (prep not logged) | 1 | - |
| mastery | 0s on the clock (prep not logged) | 1 logged (earlier tries not recorded) | not logged |
the clock
server timer of the winning attempt; used is attempt start to flag, left is what remained on the clock. † timer length recorded on an earlier attempt of the same mode. day 1-2 deadlines were not logged per attempt.
| mode | time available | time used | time left |
|---|---|---|---|
| time trial | not recorded | 0.1s | not recorded |
| mastery | 30.0s† | 0.5s | 29.5s† |
where we got stuck
- the binary-format field wanted lowercase
elf/pe; readelf-style class names were rejected. - mastery switched the c++ sample to a mingw pe, where the grader expected comdat-prefixed coff names in table order; raw, demangled and msvc-style names were all rejected first.
flags: single, time trial, and mastery [redacted].
{generated by a clanker}