resourceful: a resource overlay with scratch after it

huntress ctf 2026, day 20 · binary reverse engineering · all three modes

tools used: binary analysis toolkit and timed-attempt pipeline.

the prompt: "binaries have attics: resources, overlays, bytes past the end of the sections. rummage through this one's hidden storage and map every boundary." the evidence archive holds every day's tagged builds so far and a new elf with an RS20 overlay past its section table. the configuration record lives in a "resource" inside that overlay, and scratch bytes follow the resource so the overlay does not end where the resource does. every tag's fields are asked in the single: 239 known names and one new.

the key insight: the question spells the header, and one new name asks for one of its fields. everything else was day 19's work: the overlay by its magic, the record by its crc inside the resource.

challenge shape

single        240 fields   every tag (days 1-20): 239 known names, one new
time trial    240 fields   the same names on fresh builds
mastery      1200 fields   five sets of them

artifact anatomy

offset  size  field (from the question text)
+0      4     magic RS20
+4      1     version
+8      4     HCFG resource length, u32le
+12     2     scratch length, u16le
+16     32    sha-256 of the scratch bytes
+48     n     the HCFG resource (the configuration record at its offset 0)
+48+n   m     scratch

the configuration questions spell this layout word for word: "read hcfg resource length u32le at +8 and scratch length u16le at +12; bytes +16..+47 are the scratch sha-256, the hcfg resource starts at +48, and scratch follows it. verify exact end bounds and scratch sha-256, then use the hcfg resource at offset 0." the new field's question asks for "the little-endian hcfg resource size field ... in base 10". the resource needs no unpacking: its first byte is the record's HCFG magic.

day 19's PK19 header put the packed bytes at +44 and ended the member with them; RS20 moves the data to +48 and appends scratch, so a reader that expects the packed length to end the member finds the magic only because the section table ends exactly there.

extraction method

the binary toolkit notes every question's header words before it reads the tags: "resource length u32le at +8", "scratch length u16le at +12", "+16..+47 are the scratch sha-256", "the resource starts at +48" become a layout for the RS20 magic (the gap between a word and its +N stops at a comma, since the sha-256 sentence runs into the next clause). with a scratch field in the layout the overlay reader accepts a member that ends after the scratch, and the new field names read off the proven overlay:

def overlay_at(b, at, lay):
    n = u32le(b, at + lay.length)
    tail = u16le(b, at + lay.scratch) if lay.scratch is not None else 0
    last = at + lay.data + n
    if last + tail != len(b) and last != len(b):
        return None
    return Overlay(at, packed=b[at + lay.data:last], scratch=b[last:last + tail])

PRODUCERS["hcfg_resource_size"] = lambda b: str(len(overlay(b).packed))
PRODUCERS["scratch_size"] = lambda b: str(len(overlay(b).scratch))

the configuration record is found the day-19 way (the HCFG magic, a crc32 over the record, the json inside), so the other 239 fields answered before the new name did. by hand, with at the RS20 offset:

import struct
(res_len,) = struct.unpack_from("<I", data, at + 8)   # d20_analysis_hcfg_resource_size
(scratch_len,) = struct.unpack_from("<H", data, at + 12)
assert at + 48 + res_len + scratch_len == len(data)
record = data[at + 48 : at + 48 + res_len]            # starts with b"HCFG"

validation and answer formatting

the resource length must end the member or be followed by exactly the scratch length; the record's crc32 must verify. the new field is a base-10 integer. the d20 member graded elf for the format (an enum: elf, pe, pe_cli, jar, wasm, neko_bytecode) and x86-64 for the architecture and the machine.

failed approaches and pivots

automation across modes

the layout is noted once per question text and applies to every set; the timed modes ask the same names per set, the new ones read from the same proven overlay.

lessons

solve times

public scoreboard · day 20 finish: below top 10

  • 0:42.3single#2 of 168 solvers
  • 0:46.0time trial#2 of 166 solvers
  • 0:50.9mastery#2 of 166 solvers
  • #25team day finishof 150 teams that cleared it, in 12:50.9
  • #5single orderof the day's 7, 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 the mode's first start on the game master to its correct submit.

mode work to flag attempts wrong submits
single 41.1s 1 0
time trial 2.9s 1 0
mastery 3.9s 1 0

the clock

server timer of the winning attempt; used is attempt start to flag, left is what remained on the clock.

mode time available time used time left
time trial 80.0s 2.9s 77.1s
mastery 325.0s 3.9s 321.1s

where we got stuck

flags: single, time trial, and mastery [redacted].

{generated by a clanker}