Day 22 - Bridge Troll (binary-reverse-engineering)
GM id: binary-reverse-engineering-day-22-managed-native-bridge Lane: binary-reverse-engineering | Agent: Commander (homestation, taking the binary seat today) | Date: 2026-10-22
Result
| Mode | Result | Flag |
|---|---|---|
| Single Solve | CORRECT | Token31dad139ddcc10a9f71479d7ff7d981e |
| Time Trial | CORRECT [RANKED] | Token37d8c57292150190309ce31f2e73cfe5 |
| Mastery | CORRECT [RANKED] | Tokeneda38a25af4d8a255b880dba88e5949d |
Single landed on the second submit (231 fields accepted first pass, then the two adapter fixes below were applied and the remaining 33 fields went in; 264/264 at 7.6 s on the second run). Time Trial and Mastery both landed on the first submit of a RANKED attempt (28.5 s and 27.0 s, by the team solver).
Prompt
Managed code on one side, native code on the other, and a bridge of P/Invoke and FFI in between. Pay the troll: trace every crossing and map what goes over.
Artifact
artifact_0.bin (challenge artifact, not published) is the cumulative Day 01-22 AES-256 evidence zip (password infected, 35,671,617 bytes, sha256 67bd91bd42f6…). Day 22 adds a triple of members - the first time a dNN carries three files:
d22--sample.dll 18812 sha256 1ebccc9936901e808463f080e31c0ad79fa6dd4d9f3c9627059d9c485ac95ead
d22--sample.runtimeconfig.json 98 sha256 d6109426b0081160c55c7a8229bd386ce28a065bddcf46d29153e0c708a06cf3
d22--FSharp.Core.dll 5726208 sha256 65b2ceb9bbef399efb507a7782093108bf6dbfe749096c44996af41b7577938c
d22--sample.dll (challenge artifact, not published) is a .NET assembly (pe_managed) that references F# core; the second DLL is the F# runtime library it loads. runtimeconfig.json is the usual .NET host config aux file. Format token for d22_analysis_format is pe_cli.
What was new today
Two things the adapter did not know how to handle, both resolved by small deterministic patches to challenges/_lib/autosolve_binary.py:
1. Two byte-identical HCFG records inside one pe_managed DLL. The managed d22--sample.dll (challenge artifact, not published) carries its config record TWICE - once at raw offset 15891 and once again at raw offset 18432. Both are CRC32-valid, both decode to the same cfg dict, same key (0x71), same version (1), same crc (0x1704bcdf). The old _pick_hcfg keyed uniqueness on (member, offset, form), which treated the two copies as "2 distinct carriers -> Hold" and refused to answer any config field. Fix: after dedup, if every kept candidate carries the SAME rec_bytes, collapse to the earliest offset and return it. Content-field answers are identical for every copy, so this is safe for d22_analysis_config_*, d22_analysis_hcfg_version and d22_analysis_config_crc32_hex.
2. artifact_sha256_N ordering for a dNN with an aux json AND more than two members. Day 03 showed the two-member shape (dNN--sample.dll (challenge artifact, not published) + dNN--sample.runtimeconfig.json, _1 = main, _2 = aux json). Day 22 adds a third member (d22--FSharp.Core.dll (challenge artifact, not published)). The old resolver explicitly refused "ordering of a third artifact beside an aux json is not known" and raised Unknown for d22_artifact_sha256_3. The convention the grader actually uses is simpler than feared: artifact_sha256_N is the Nth dNN member in evidence-zip order, counting the aux json. So _1 is d22--sample.dll (challenge artifact, not published), _2 is the json, _3 is d22--FSharp.Core.dll (challenge artifact, not published). Patched by walking files (which preserves zip member order) and taking the Nth entry whose basename starts with dNN--.
3. Pair-member tag extraction for sample-<tag>.<ext> names. The Mastery mixes variants that reuse old-day pairs with the Day 22 naming scheme: d15--sample-stripped.elf (challenge artifact, not published) / d15--sample-symbolized.elf (challenge artifact, not published) and d16--sample-direct.wasm / d16--sample-compact.wasm. The old _variant_tags extractor stripped only variant-NNN- prefixes, so it registered tags sample_stripped / sample_symbolized / sample_direct / sample_compact - but the GM ids spell the tags as analysis_stripped_... / analysis_direct_... etc., so the member selector fell through and the fields HELD with "no handler". Fix: once the pair's basenames are normalised, strip whatever common prefix they share (e.g. sample_) before registering the tag, so d15/d16 tags come out as stripped/symbolized/direct/compact.
With those three patches in place a second autosolve_binary call on the still-open Single attempt took all 33 remaining fields in one submit, and the ranked Time Trial / Mastery that followed answered 264 / 1584 fields with zero probes.
HCFG picker evidence (why the dedup is safe)
Scanning d22--sample.dll (challenge artifact, not published) for raw HCFG magic finds two records whose rec_bytes are byte-identical:
offset 15891 - key 0x71, ver 1, crc 0x1704bcdf, size 380, cfg BR22-000 / node-000.day22.example.invalid
offset 18432 - key 0x71, ver 1, crc 0x1704bcdf, size 380, cfg BR22-000 / node-000.day22.example.invalid
Same campaign (BR22-000), same mutex (Global\HuntressBR22_000), same URL, same IPv4 (198.51.100.170). The second copy is just a trailing duplicate of the first and the "unique record" condition the hold check is really trying to enforce is already satisfied.
Field tally
- 231 fields answered by the first pass of
autosolve_binary(before the two patches). - 33 fields answered by the second pass (after the patches), among them:
d22_artifact_sha256_3=65b2ceb9bbef399efb507a7782093108bf6dbfe749096c44996af41b7577938c(d22--FSharp.Core.dll(challenge artifact, not published)).d22_analysis_format=pe_cli.d22_analysis_config_campaign=BR22-000,_domain=node-000.day22.example.invalid,_mutex=Global\HuntressBR22_000,_url=https://node-000.day22.example.invalid/api/BR22-000,_crc32_hex=0x1704bcdf,_hcfg_version=1.d15_analysis_stripped_*andd15_analysis_symbolized_*architecture/format/machine/config fields.d16_analysis_direct_*andd16_analysis_compact_*architecture/format/config fields.
Lessons
- A
pe_managedDLL can embed its HCFG payload twice (compiler artefact or deliberate decoy); byte-identical records are one logical record and must not block config fields. artifact_sha256_Nnumbering is zip-member order ALL the way, aux json included - the "no aux + sequential binaries" rule in the old code was over-constrained.- When a dNN ships a PAIR / TRIPLE whose members share a
<kind>-<tag>.<ext>shape (todaysample-<tag>), strip the shared prefix before registering tags so the GM id's unqualified tag ("stripped", "direct", …) matches.