Day 20 - Resourceful (binary-reverse-engineering)
GM id: binary-reverse-engineering-day-20-resources-and-overlays Lane: binary-reverse-engineering | Agent: agent-2 | Solver name: the team solver
Result - all three modes CORRECT
| Mode | Result | Flag | Notes |
|---|---|---|---|
| Single Solve | CORRECT | Tokena124e62e531036df8a4eb5a2cb891143 | 240/240 fields, untimed |
| Time Trial | CORRECT (RANKED) | Tokendc6ab539a6a3032226fb3ba3f4c18621 | 240 fields in 3.2 s inside a 79 s window; hall_of_fame_eligible |
| Mastery | CORRECT (RANKED) | Token9dbddffb135535fda341804421dbc434 | 1200 fields (5 sets) in 15.3 s inside a 324 s window; hall_of_fame_eligible |
Every mode answered 100% SURE: 240 sure, 0 probe, 0 unknown, then 1200 sure, 0 probe, 0 unknown.
Prompt
Binaries have attics: resources, overlays, bytes past the end of the sections. Rummage through this one's hidden storage and map every boundary.
Artifact
artifact_0.bin (challenge artifact, not published) - a 33,207,971-byte AES-encrypted ZIP (password infected), 23 members, the cumulative day-prefixed evidence bundle: d01--variant-000.elf (challenge artifact, not published) ... d20--variant-000.elf (challenge artifact, not published) plus the d03 .NET DLL + runtimeconfig, two JARs (d06, d07), the d15 symbolized/stripped ELF pair and the d16 direct/compact .wasm pair. 238 of the 240 fields were already covered by the banked autosolve_binary spine; only the day's new layer needed building.
The day's new layer
AUTOSOLVE HELD the Single with 238 accepted, 2 remaining. The residue named exactly two ids:
d20_analysis_overlay_offset- "Locate the final overlay magic named by this unit (PK19 for Day 19 or RS20 for Day 20) and submit its zero-based byte offset in the member."d20_analysis_hcfg_resource_size- "In the final RS20 resource overlay, read the little-endian HCFG resource size field and submit it in base 10."
The first id is shared with Day 19, which it already answered for the d19 member - so the Day 19 parser was being handed a Day 20 member whose overlay has a different shape. Day 19 (Jack in the Box) appended a packed stub: magic(4) | +5 k1 | +6 k2 | +8 u32le packed length | +12 sha256(unpacked) | +44 packed bytes, where the record always ends exactly at EOF. On d20--variant-000.elf no offset satisfied off + 44 + len == EOF, so _overlay() correctly returned None rather than guessing.
Finding the RS20 record
Scanning the member for the magic put it at the tail:
RS20 at 1200888, 463 bytes from EOF (member length 1,201,351)
52533230 01000000 7c010000 23000000 90209a4c...bab 48434647 0151 7001 cedd0d57 ...
^RS20 ^ver=1 ^380 ^35 ^32-byte sha256 ^HCFG ...
Day 20's overlay is a resource header that declares the boundaries of what it stores - which is the literal reading of "map every boundary":
| Offset | Size | Field | Value on variant-000 |
|---|---|---|---|
| +0 | 4 | magic | RS20 |
| +4 | 4 | u32le version | 1 |
| +8 | 4 | u32le HCFG resource size | 380 |
| +12 | 4 | u32le trailer size | 35 |
| +16 | 32 | SHA-256 of the trailer bytes | 90209a4c...81bab |
| +48 | 380 | the HCFG record | HCFG + version 1 + XOR key 0x51 + u32le len 368 + CRC32 + payload |
| +428 | 35 | trailer text | private-scratch:BR20-000:inert-only |
Three facts confirm the field is the HCFG resource size and not something else, so the evidence is SURE, not inferred:
48 + 380 + 35 == 1201351, the member length exactly - the two declared sizes account for every remaining byte.- The 380-byte resource begins with the
HCFGmagic and parses as a complete HCFG record: its own u32le payload length is 368, and12 + 368 == 380. The declared resource size is the whole HCFG record, header included. sha256(trailer) == the 32 bytes at +16- verified, not assumed. A random four-byte magic match cannot pass this.
The recovered config (XOR key 0x51) is the familiar HCFG JSON, which is why the other d20 config fields were already accepted:
{"campaign":"BR20-000","domain":"node-000.day20.example.invalid","ipv4":"198.51.100.130",
"url":"https://node-000.day20.example.invalid/api/BR20-000","mutex":"Global\\HuntressBR20_000",
"windows_path":"C:\\ProgramData\\HuntressLab\\day20\\BR20-000.dat",
"linux_path":"/var/tmp/huntress-lab/day20/BR20-000.dat","service":"HuntressLab-Day20-000",
"host_model":"workstation"}
Answers
| id | Single | Time Trial | Mastery set1..set5 |
|---|---|---|---|
d20_analysis_overlay_offset | 1200888 | 1200888 | 1200888 (all sets) |
d20_analysis_hcfg_resource_size | 380 | 380 | 380 (all sets) |
d19_analysis_overlay_offset | 10808 | 10808 | 10808 (all sets) |
d19_analysis_overlay_size | 424 | 424 | 424 (all sets) |
The timed variants mutate the config contents (BR20-000 -> BR20-004 for the Time Trial, BR20-005, -006, -007, -000, -001 across the five Mastery sets) while the overlay geometry stays fixed. The extractor reads both from the bytes either way, so nothing was hardcoded.
Fix applied to the adapter
challenges/_lib/autosolve_binary.py - the spine was not rebuilt, only extended:
_resource_overlay_at(data, off)parses the Day 20 header and returnsNoneunless all three checks above pass. Sizes are bounds-checked before any slice, repeating the Day 19 lesson (a multi-MB member matches the[A-Z]{2}[0-9]{2}magic regex ~100k times; slicing first cost 133 s per member)._resource_overlay(data)scans backwards from EOF (last MiB first, then a full scan) and returns the last match that verifies - "the final overlay magic". The magic is read out of the bytes, so a futureXX21needs no code change._any_overlay(data)returns whichever banked form verifies - Day 19's packed stub or Day 20's resource overlay - and on the (unseen) case of both, the later offset wins.analysis_overlay_offset/analysis_overlay_sizenow go through_any_overlay; a newanalysis_hcfg_resource_sizebranch returns the u32le at +8.
Cross-checked against both members with no contamination: d19 resolves only as packed (off 10808), d20 only as resource (off 1200888).
Evidence rating
SURE for both new fields. Not a pattern guess: the overlay's two declared sizes close the member to the byte, the resource is a self-describing HCFG record whose own length matches the declared size, and the embedded SHA-256 of the trailer verifies. All three modes then graded CORRECT on the GM's own ground truth.
Scripts
Saved under challenges/Day 20/Resourceful/scripts/:
probe_d20.py- extracts thed20member and locates theRS20/HCFGmagics in its tail.probe_rs20.py- proves the field layout: sizes closing to EOF, the HCFG record length, the trailer SHA-256, and the Day 19 packed stub for contrast.check_patch.py- regression check of the patched adapter over thed19+d20members.