shared custody: an ocaml loader and the plugin it loads

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

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

"no binary is an island; this one leans on shared libraries for everything. trace the exports, the imports, and the loader's handshake, and mind the boundaries." the day's tag holds two members: a loader executable and a plugin shared object, both native ocaml. the questions ask each member's machine number and the configuration record, which only the plugin carries ("the loader has no scored hcfg config").

the key insight: two questions per field name, one per member, are a role problem the toolkit already solved on day 15 (a stripped and a symbolized build): a word of the field names the member it is about. day 21's pair differed in extension as well as in the role word, and the rule that pairs siblings had compared whole file names.

challenge shape

single       252 fields   every tag (days 1-21): format, machine, config,
                          digests, the day's role fields
time trial   252 fields   the same on fresh builds
mastery     1260 fields   five sets

the day's own fields: both members' sha-256, the plugin's configuration (campaign, domain, mutex, url) under plain and plugin_-prefixed names, and loader_machine / plugin_machine: "read the elf e_machine field and submit its unsigned base-10 numeric value (for example, do not substitute an architecture label)". each question names its member by the end of its basename ("the unique d21-- member whose basename ends loader.elf"), and the plain configuration questions add "use the d21-- plugin.cmxs member; the loader has no scored hcfg config".

artifact anatomy

-loader.elf    elf64 x86-64, type DYN (a pie executable), several
               hundred KB, interpreter ld-linux, needs libc, libm,
               libdl; well over a thousand exported symbols: the ocaml
               runtime (caml_*) a dynamically loaded plugin links against
-plugin.cmxs   elf64 x86-64, type DYN (a shared object), a few KB, needs
               libc only; exports caml_plugin_header and the
               compilation unit's frametable; its only undefined
               symbols are toolchain boilerplate (__cxa_finalize,
               the tm-clone and gmon hooks); the HCFG record sits
               in .data

caml_plugin_header is the symbol ocaml's native dynlink reads after dlopen (the loader links libdl): a description of the units the plugin defines and the interfaces it expects, which the host checks before running the plugin's initialisers. the handshake is that one exported symbol on each side of the boundary.

extraction method

the binary toolkit reads every field from the member its tag and words name. e_machine is the u16 at offset 18 of the elf header (readelf -h prints it as machine: advanced micro devices x86-64; the question wants the number, em_x86_64's decimal value, for both members). the configuration is the validated hcfg record (magic, version, xor key, payload length, crc-32 of the decoded json) found by scanning the plugin. a role field (<role>_<field>) is the plain field read from the one member the role word names, when that member has a sibling whose name differs by that word alone:

def roles(field, files):
    for word in words(field):
        hits = [f for f in files if word in stem_words(f)]
        if len(hits) != 1:
            continue
        stem = without(Path(hits[0]).stem, word)        # day 21: stems, so
        sibs = [f for f in files if f != hits[0]        # -loader.elf pairs
                and any(without(Path(f).stem, w) == stem  # with -plugin.cmxs
                        for w in stem_words(f))]
        if sibs:
            yield Role(word, hits[0], sibs)

validation and answer formatting

the role rule needs exactly one member carrying the word and at least one sibling: an extension word (elf) names no role, and a lone member is never a role. an integer question gets the header number, a label question the architecture label; the hcfg record must pass its crc and parse as json or the field crashes.

failed approaches and pivots

automation across modes

the timed modes ship the same two members per set; the stem rule and the existing producers answer every role field, and the mastery's per-set downloads are each read as they land.

lessons

solve times

public scoreboard · day 21 finish: below top 10

  • 0:21.9single#5 of 167 solvers
  • 0:24.6time trial#4 of 163 solvers
  • 0:29.5mastery#2 of 163 solvers
  • #36team day finishof 146 teams that cleared it, in 27:16.2
  • #4single orderof the day's 8, 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 20.4s 1 0
time trial 1.6s 1 0
mastery 3.5s 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 1.6s 78.4s
mastery 325.0s 3.5s 321.5s

where we got stuck

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

{generated by a clanker}