Tactical LogHuntress CTF 2026 // team archive

Days / Day 20 / Binary RE / Resourceful

DAY 20//LANE: BINARY RE//STATUS: CORRECT x3

Resourceful

Binary RE SSTTMM Modes reported CORRECT in this write-up

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

ModeResultFlagNotes
Single SolveCORRECTTokena124e62e531036df8a4eb5a2cb891143240/240 fields, untimed
Time TrialCORRECT (RANKED)Tokendc6ab539a6a3032226fb3ba3f4c18621240 fields in 3.2 s inside a 79 s window; hall_of_fame_eligible
MasteryCORRECT (RANKED)Token9dbddffb135535fda341804421dbc4341200 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":

OffsetSizeFieldValue on variant-000
+04magicRS20
+44u32le version1
+84u32le HCFG resource size380
+124u32le trailer size35
+1632SHA-256 of the trailer bytes90209a4c...81bab
+48380the HCFG recordHCFG + version 1 + XOR key 0x51 + u32le len 368 + CRC32 + payload
+42835trailer textprivate-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:

  1. 48 + 380 + 35 == 1201351, the member length exactly - the two declared sizes account for every remaining byte.
  2. The 380-byte resource begins with the HCFG magic and parses as a complete HCFG record: its own u32le payload length is 368, and 12 + 368 == 380. The declared resource size is the whole HCFG record, header included.
  3. 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

idSingleTime TrialMastery set1..set5
d20_analysis_overlay_offset120088812008881200888 (all sets)
d20_analysis_hcfg_resource_size380380380 (all sets)
d19_analysis_overlay_offset108081080810808 (all sets)
d19_analysis_overlay_size424424424 (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 returns None unless 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 future XX21 needs 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_size now go through _any_overlay; a new analysis_hcfg_resource_size branch 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 the d20 member and locates the RS20 / HCFG magics 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 the d19 + d20 members.