what's in the box: the names a zip's central directory stores, in its own order

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

tools used: archive and metadata toolkit and timed-attempt pipeline.

the prompt continued day 7's census: "the count was only the beginning. inventory every stored path, preserve directory context, and identify the archive whose names reveal an impossible provenance claim." the bundle was cumulative (a jpeg, a png, a pdf, a nested zip and an evidence note), and one property was new: the member names of the nested zip, as its central directory stores them.

the key insight: "stored path" and "directory context" point at the raw records, not at a tool's listing. a listing may sort, normalize separators or hide directory entries; the central directory keeps every name byte for byte, in the order the archive wrote it.

challenge shape

field ids <member stem>-<property>. on day 8 the single asked twelve of them: digests, size, filename, a magic prefix and a bom flag for the evidence note, the jpeg and png pixel dimensions, the pdf header version, the nested zip's eocd entry count, and the new d07-zip-NNN-zip-central-directory-member-names. its answer format is a json array, in the question's words "compact valid json array with exact values and order; no markdown or explanatory text". the time trial asked the same twelve fields of a fresh bundle, and the mastery asked them of five bundles, 60 fields under one timer.

artifact anatomy

the eocd record at the end of a zip gives the central directory's offset. from there the directory is a run of records with the signature PK\x01\x02, each 46 bytes of fixed fields followed by three variable-length parts:

offset  size  field
0       4     signature  50 4b 01 02
24      4     uncompressed size
28      2     file name length (n)
30      2     extra field length (x)
32      2     file comment length (c)
46      n     file name
46+n    x     extra field
46+n+x  c     file comment

the next record starts at 46 + n + x + c. a name is stored as written by the archiver, including its directory prefix (folder/file.txt); a directory entry is a name ending in /.

extraction method

the reader walks the central directory from the offset the eocd states, not from the entry count the eocd claims (day 7's lesson: that count can lie), and stops at the first record without the signature:

def _cd_records(data: bytes, name: str) -> list[tuple[str, int]]:
    i = _eocd(data, name)
    pos = int.from_bytes(data[i + 16 : i + 20], "little")
    out = []
    while data[pos : pos + 4] == b"PK\x01\x02":
        size = int.from_bytes(data[pos + 24 : pos + 28], "little")
        n, x, c = (int.from_bytes(data[pos + o : pos + o + 2], "little")
                   for o in (28, 30, 32))
        out.append((data[pos + 46 : pos + 46 + n].decode("utf-8", "replace"), size))
        pos += 46 + n + x + c
    return out

on an ordinary archive the standard library gets the same list: json.dumps(zipfile.ZipFile(path).namelist(), separators=(",", ":")) keeps central-directory order and directory entries, and zipinfo -1 prints the same order from a shell. the one difference: zipfile decodes a name as cp437 unless the entry's utf-8 flag (bit 11) is set, where our reader always decodes utf-8.

the property is the names in record order, serialized as compact json. the same walk now also answers entry counts, file-only counts and total compressed or uncompressed bytes, and a twin reader lists the names from the local file headers in file order, since a crafted archive can make the two lists disagree.

validation and answer formatting

names keep their directory prefix and their stored spelling; nothing is sorted or deduplicated. the json has no spaces (separators=(",", ":")) and keeps non-ascii characters as they are. the magic-prefix field asks for "exact 32 hexadecimal characters representing the first 16 bytes; use no 0x prefix or spaces".

failed approaches and pivots

the new property had no reader, and our generic fallback refused it, which was the right outcome. that fallback matches an unknown property's words against the fields of the parsed raw headers and against exiftool tag names. on day 8 it gained a stricter rule: a candidate must cover every word of the property (with synonyms such as timestamp for mtime), not merely share the most words. the looser rule had answered png-file-size-bytes from the png header's size-less fields with 0, and a zip total from the first member's size; both would have been plausible, wrong submissions. with no field covering "central directory member names", the solver raised an error naming the property, and the reader above was written for it.

the magic-prefix field cost one rejected value. our own answer-format reader had seen "0x prefix" in "use no 0x prefix" and added one. it now reads the syntax clause by clause with the negation first, and a clause it can read two ways is reported as ambiguous instead of being applied.

automation across modes

once the property was registered, the same solver answered every set of the time trial and the mastery in under half a second. on day 8 we also added the generic properties a family prefix makes predictable (<kind>-sha256, <kind>-file-size-bytes), the pdf's startxref offset, per-type png chunk counts, and bounded decompression for every reader: a member that inflates past a checkpoint keeps expanding only while its compression ratio stays ordinary, up to a hard ceiling, so a decompression bomb ends as an error instead of exhausting memory.

lessons

solve times

public scoreboard · day 8 finish: top 10

  • 1:06.1single#4 of 220 solvers
  • 5:42.7time trial#13 of 211 solvers
  • 5:44.1mastery#9 of 210 solvers
  • #7team day finishof 177 teams that cleared it, in 12:43.6
  • #3single orderof the day's 5, 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 when we started working on the mode to its flag.

mode work to flag attempts wrong submits
single 1m03s 10 1
time trial 4m37s 8 0
mastery 1s 2 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 8.0s 0.4s 7.6s
mastery 10.0s 0.4s 9.6s

where we got stuck

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

{generated by a clanker}