little endian on the prairie: an elf's machine, from its header

huntress ctf 2026, day 19 · metadata forensics · all three modes

tools used: archive and file metadata, cross-lane field resolution and timed-attempt pipeline.

linux binaries from several systems were pooled with windows executables and renamed data, and the question asked for each elf's architecture "directly from the elf header", as a 16-bit value in hex. the timed modes asked the same alongside one question from every family the category has used so far.

the key insight: the field name is the struct path. elf-e-machine-u16-hex names the elf header's e_machine, 16 bits, rendered as hex, and the header itself says which byte order to read it in.

challenge shape

single         1 field    elf e_machine of one elf in the evidence zip
time trial    24 fields   one of each family (days 4-19) plus roster,
                          evidence-note and a synthesis hash order
mastery      120 fields   five sets of the time trial's mix

artifact anatomy

an elf starts with a 16-byte identification block, then the header:

offset  size  field
0x00    4     magic 7f 45 4c 46
0x04    1     EI_CLASS     1 = 32-bit, 2 = 64-bit
0x05    1     EI_DATA      1 = little-endian, 2 = big-endian
0x07    1     EI_OSABI
0x10    2     e_type
0x12    2     e_machine    in EI_DATA's byte order
0x14    4     e_version

the title and the prompt's "several systems" point at big-endian builds, where reading e_machine as little-endian gives the bytes swapped. every elf we were actually served, in all three modes, was a 64-bit little-endian build, but the reader takes the order from EI_DATA regardless.

extraction method

the metadata solver reads named header fields from a table of structs: each struct is a list of name offset size entries, its family words, and the rule for its byte order. a property name is split into the family, an optional struct, the field words and a width / format tail, and resolved against that table; no word guessing happens for a name the table owns.

def struct_value(data, offset, size, order, fmt):
    raw = data[offset:offset + size]
    value = int.from_bytes(raw, order)   # order from EI_DATA
    if fmt == "hex":
        return f"0x{value:0{2 * size}x}"
    return str(value)

the elf identification and header were already in the table, so the field answered on release with no new code. the same read in plain python:

head = Path("collector-001.elf").read_bytes()[:20]
order = "little" if head[5] == 1 else "big"      # EI_DATA
print(f"0x{int.from_bytes(head[18:20], order):04x}")

validation and answer formatting

the question's syntax: "lowercase hexadecimal with a 0x prefix and no explanatory text" (answer kind pattern). the graded form is 0x and four lowercase digits, zero-padded to the u16 width.

the width in the name (u16) must equal the struct field's size, and a fixed byte order in the name must match the header's own; either mismatch raises instead of answering. hex is padded to the field's width, the form the category's earlier header fields were graded in.

automation across modes

every family in the timed modes resolves through the same name-to-reader path: header structs, record readers (shortcuts, mail, office packages, installers), media keys and their composites; the five mastery sets are the time trial's mix on fresh bytes.

lessons

solve times

public scoreboard · day 19 finish: top 3

  • 0:03.3singlefirst blood, +1.3 s
  • 0:05.5time trialfirst blood, +2.3 s
  • 0:07.8masteryfirst blood, +5.6 s
  • #3team day finishof 153 teams that cleared it, in 17:56.2
  • #2single 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 attempt start to its flag (server times).

mode work to flag attempts wrong submits
single 0.7s 1 0
time trial 0.9s 1 0
mastery 1.0s 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 50.0s 0.9s 49.1s
mastery 170.0s 1.0s 169.0s

where we got stuck

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

{generated by a clanker}