Challenge
- Event: Huntress CTF 2026, Day 02
- Game Master id:
day02-single(from the zip commenthuntress:day02-single) - Category: Malware / reverse engineering - encoded config recovery, with a C vs. C++ name-mangling theme.
- Flag format: not supplied in the artifact. Day-02 challenges are dynamic: the recovered value is submitted to the Game Master, which validates and returns/auto-completes the real CourseStack flag.
- Challenge text: not provided to this session (handoff was truncated). Solve derived entirely from the artifact.
Artifacts
| File | Size | SHA-256 |
|---|---|---|
mangled.zip (challenge artifact, not published) | 5481 | (container) |
day01-c.elf (challenge artifact, not published) | 15616 | a0d3aeddb90dccf579e0262704dc7d7c2828121d8cc988f085de169601737b9b |
day02-cpp.elf (challenge artifact, not published) | 16640 | e9ca3054b0689f60a9c41a758781fae1406e127e5bfcc866c51f78748fdfd0d7 |
mangled.zip (challenge artifact, not published) is WinZip AES-256 encrypted (compression method 99, AES extra field 0x9901, AE-2, strength 0x03). Zip comment: huntress:day02-single.
Triage
- RULE 2 (file type):
.zip-> carving/crypto.zipinfo -vshowed AES encryption, so a password was needed before anything else. - RULE 3 (theme): "Mangled" = C++ name mangling. The two members
day01-c.elf(challenge artifact, not published) (C) /day02-cpp.elf(challenge artifact, not published) (C++) make the theme explicit; the C++ binary carries mangled symbols (_ZN15DiscoveryEngine...), the C binary does not. - Primary specialist domain:
malware_re(solved inline - small, static, deterministic). - Hypotheses: (H1) flag hidden in a binary section/string; (H2) flag produced by running with the right input; (H3) recover an encoded malware config and submit a field to the GM. H3 proved correct.
Investigation
- Password.
unziprefused ("need PK compat v5.1" = AES). Tried a short thematic wordlist with7z t -p<pw>;infected(the classic malware-zip password) worked:7z t -pinfected mangled.zip # Everything is Ok 7z x -pinfected -y mangled.zip - Identify. Both are
ELF 64-bit LSB executable, x86-64, not stripped.day01-c.elf(challenge artifact, not published): functionrecover_code(returns0x1fa4= 8100), custom section.huntress=BR01-CATALOG-000. A minimal C "catalog" counterpart.day02-cpp.elf(challenge artifact, not published): C++ classDiscoveryEnginewithscore(const char*) const,family() const; RTTI type-name string15DiscoveryEngine; aprintfemitting ahuntress.binary.dynamic_trace.v1JSON.
- Dynamic trace (run). Running
day02-cpp.elf(challenge artifact, not published) prints:{"schema":"huntress.binary.dynamic_trace.v1","branch":"success","event_count":6, "campaign":"BR02-000","family":"system_information_discovery","rtti":"15DiscoveryEngine"}mainreads envHUNTRESS_HOST_MODEL;DiscoveryEngine::scorereturns 6 forworkstation, 3 foranalysis(-> branchdecoy), 1 otherwise (->failure).family=system_information_discoverymaps to MITRE ATT&CK T1082. No flag in the trace. - The mangled config (key step).
readelf -Srevealed a non-standard section.hcfginday02-cpp.elf(challenge artifact, not published) (the "HCFG" magic also shows instrings). Dumping it showed an encoded blob with0x13used as a field separator and repeatedsc 01 03 1c...groups - classic single-byte XOR.- Header:
48 43 46 47 | 01 | 31 | ...= magicHCFG, version01, XOR key0x31(self-describing, byte offset 5). - Confirm by known plaintext:
0x13^0x31 = 0x22 ("),0x0b^0x31 = 0x3a (:),73 63 01 03 1c -> "BR02-". - XOR the section with
0x31:
{"campaign":"BR02-000","domain":"node-000.day02.example.invalid","ipv4":"198.51.100.40", "url":"https://node-000.day02.example.invalid/api/BR02-000","mutex":"Global\\HuntressBR02_000", "windows_path":"C:\\ProgramData\\HuntressLab\\day02\\BR02-000.dat", "linux_path":"/var/tmp/huntress-lab/day02/BR02-000.dat","service":"HuntressLab-Day02-000", "host_model":"workstation"}This is the sample's hidden campaign/IOC config - "mangled" twice over: C++ mangled symbols + an XOR-mangled config section.
- Header:
- Flag search (negative, important). Exhaustive
strings/section sweep of both binaries (.rodata,.hcfg,.huntress,.comment, symtab, overlay) found noflag{}/huntress{}token.day01-c.elf(challenge artifact, not published) has no.hcfg. Conclusion: there is no offline flag; the recovered config (or a specific field) is the value to submit to the Game Master - the same dynamic model confirmed on "Half a Turn".
Flag Recovery
- Source: the
.hcfgsection of the assignedday02-cpp.elf(challenge artifact, not published). - Transform: single-byte XOR; key is header byte 5 (
0x31for this copy) - or, attempt-independently, the unique byte that makes the blob decode to JSON whose first key iscampaign. - Verification:
scripts/solve_mangled.pyparses the ELF section table directly (no external tools), brute-forces the XOR key by validating the decoded JSON, and reprints the config. Re-running reproducesxor_key: 0x31and the config above - deterministic and reproducible.
Per-attempt note: the Game Master serves dynamic bytes, so the numbering (
BR02-NNN,node-NNN, the IPv4) will differ from this static copy. The solver is written to be attempt-independent; run it on the downloaded attempt binary and submit the field the GM asks for.
Flag / Live results (2026-10-02)
This is a 3-mode compounding challenge scored by the Game Master inside the Homebase VM (no offline flag{} exists in the artifact). Live outcome:
- Single Solve (2 pts): CORRECT (accepted before this session). CourseStack completion token: Token0fb4a08ae90803a93c21f451e7e5f42e.
- Time Trial (3 pts): CORRECT - solved live via GPT-6 Luna in the Homebase VM. CourseStack completion token: Token11eedb570a15da45275f39da25bd2783. Luna independently reconstructed the exact mechanic (AES zip with the attempt's assigned password ->
day02-cppbinary ->.hcfgblob =HCFGmagic + short header + single-byte-XOR JSON, brute all 256 keys, CRC-validate) and mapped each of the 17answer_ids to its decoded config field by name, submitting in one deterministic sub-5s run. - Mastery Mode (5 pts): CORRECT - landed 2026-10-02 via SSH-direct, token-free (no Luna), using
scripts/solve_mangled_mastery_v2.py+scripts/mangled_iter.pyon the reusablechallenges/_lib/ctf_gm.pyclient. CourseStack completion token: Token1f0310b59f82d2899ea9f1a2cce3e7c0. The GM returns 34 answer_ids = the full 17-field inventory for EACH of two deliveries. Key discovery: Mastery MIXES a Windows PE and an ELF C++ binary ("cpp-and-PE-orientation"); the PE is MinGW-compiled so it carries the SAME Itanium_Zsymbols as the ELF (_ZNK15DiscoveryEngine5scoreEPKc,_ZTV15DiscoveryEngine)- NOT MSVC
??..@@. Grader fields are libmagic (file -b) derived (cpp_formatshort family;c_machine=x86-64), with per-binaryc_has_symtab, decimalc_recover_code, and the HCFG single-byte-XOR config. One open item: the PEcpp_formatexact string stays UNVALIDATED (pe32+andpeboth returned incorrect on mixed attempts); we won on an all-ELF attempt draw (Mastery needs only one CORRECT attempt), so it is moot but recorded for a PE-only variant.
- NOT MSVC
Score for Mangled: 15 / 15 (Single + Time Trial + Mastery). The day reached 32/32; VM powered OFF after.
SUPERSEDED (confirmed live): the GM does not score a single field - it returns the full field set as named
answer_ids (17 for Time Trial, 34 for Mastery across its two binaries), so submit EVERY decoded config field under its same-namedanswer_id. The ranking below is retained only as the original pre-live hypothesis.
Candidate value(s) to feed the Game Master for day02-single (status GM_INPUT, not a final flag), ranked by likelihood. Discriminator: the dynamic trace already prints campaign/family/rtti for free, so the GM almost certainly asks for a hidden-only config field (one you can only get by defeating the XOR) - that is the "mangled" content the challenge is about:
- The full decoded
.hcfgJSON of the assigned binary ("recover the config"). - A single hidden IOC, most likely in this order:
url(https://node-000.day02.example.invalid/api/BR02-000),domain(node-000.day02.example.invalid),ipv4(198.51.100.40), ormutex(Global\HuntressBR02_000). - Low likelihood (visible from a plain run, no decode needed):
campaignBR02-000,familysystem_information_discovery(MITRE T1082),rttiDiscoveryEngine.
Note: the sibling "evidence-note" heuristic (Day-02 answer = first-16-bytes-hex of the assigned file) does NOT apply here - the first 16 bytes are the generic ELF header, identical across all variants, so they cannot be the per-attempt answer. For Mangled the per-attempt discriminator is the decoded
.hcfgcontent.
Minimal Reproduction
7z x -pinfected -y mangled.zip # password: infected
python3 scripts/solve_mangled.py day02-cpp.elf # -> xor_key: 0x31 + decoded JSON config
# (optional) observe the dynamic trace:
./day02-cpp.elf # family=system_information_discovery (T1082), rtti=15DiscoveryEngine
Then (in the Homebase VM, via the Game Master): start day02-single -> download the assigned binary -> run the solver on it -> submit the requested field/config under its answer_id.
Lessons Learned
- What mattered:
readelf -Sto spot the non-standard.hcfgsection; recognizing single-byte XOR from the regular0x13separators; and reading the XOR key straight out of the section header instead of guessing. - "infected" remains the go-to password for AES-encrypted malware-lab zips.
- Theme was literal: "Mangled" = both C++ symbol mangling and an XOR-mangled config. The C++ mangled names (
DiscoveryEngine, RTTI15DiscoveryEngine) are thematic signposts, not the flag. - What would have wasted time: deep-reversing the C++ vtable/
scorelogic or the runtime boilerplate - the payload was the data section, not the code (2025 heuristic: inspect suspicious data/strings/sections before reversing runtime init). - Negative result is a result: confirming no offline flag exists is what establishes this as a GM-submission challenge, so no fabricated flag is printed.
- Reusable tool:
scripts/solve_mangled.pyauto-detects the XOR key and parses the ELF without external tools, so it survives per-attempt variants and timed modes.