portable deception: a pdf header version, and properties we have never seen

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

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

the evidence zip held pdf documents, and the new field family asked for each document's pdf header version. the prompt promised more (real pdfs, renamed impostors, several declared versions, "which promise is false"), but the graded field was only the version the file declares in its first line.

the key insight: the answer is the x.y in the %PDF-x.y header of the raw bytes, copied as written. the harder lesson was about our own parser: it could not even reach the file until it knew the property's name.

challenge shape

answer ids follow the lane's <member stem>-<property> pattern, here d06-pdf-NNN-pdf-header-version, and the stem's number picks document-NNN.pdf. the single and the time trial carried one document; mastery carried one nested zip per set, each with its own document.

artifact anatomy

a pdf declares its version twice, in principle:

%PDF-1.7                      <- header: the first line of the file
...
1 0 obj
<< /Type /Catalog /Pages 2 0 R /Version /2.0 >>   <- optional catalog override

the catalog's /Version key, when present, overrides the header for a conforming reader. that split is what "multiple declared versions" pointed at. the delivered documents were small and regular: a handful of objects, one cross-reference table, a single %%EOF, and no catalog override. the field asked for the header.

extraction method

HEADER = re.compile(rb"%PDF-(\d+\.\d+)")

def pdf_header_version(data: bytes, name: str) -> str:
    m = HEADER.search(data[:1024])        # readers allow leading junk
    return m.group(1).decode() if m else "none"

the search window tolerates bytes before the header, which real readers accept. none is the lane's literal for an absent value: the question ("determine pdf.header_version for document-nnn.pdf.") carried the generic exact_text syntax ending "use the literal none only when the requested field is absent". from a shell, head -c 8 document-NNN.pdf shows the header line.

validation and answer formatting

the version is copied as written: major, a dot, minor, nothing else. it is not normalized to a number (1.10 would stay 1.10), not taken from the catalog, and not from the file extension. an impostor renamed to .pdf has no header and answers none.

failed approaches and pivots

the first run failed before reading a byte. the field id is <stem>-<property>, and the parser found the boundary by matching the longest property name it knew. an unknown property gave it no boundary, so it could not tell d06-pdf-001 from pdf-header-version and stopped. stems in this lane always end in a number token, so the boundary is now "after the stem's last number" when no known name matches.

the second gap was what to do with a name nobody had written a reader for. day 6 also gave the property lookup a last resort: run exiftool once on the member and pick the tag that shares the property's words.

words = set(prop.split("-"))                 # {"pdf", "header", "version"}
for tag, value in exif_text(member).items(): # PDFVersion -> {"pdf", "version"}
    score = len(words & camel_tokens(tag))
...
# the tag must contain the property's last word (the noun), or share >= 2
# words; a tie between tags is never guessed

PDFVersion shares pdf and version, so the day-6 field would have been answered without new code. exiftool's text output (-args -n) keeps values verbatim, where its json output turns 1.10 into the number 1.1. replayed against every metadata property graded on days 1-6, this fallback never returned a wrong value: the older properties have exact readers or produce no guess.

automation across modes

the solver splits every field id into stem and property, resolves the stem to a member (by name, then by the stem's number), and asks the property registry for the value. mastery's nested zips are flattened under their own stems first, so two sets never collide.

lessons

solve times

public scoreboard · day 6 finish: 1st

  • 1:04.2single#5 of 237 solvers
  • 1:14.9time trial#4 of 225 solvers
  • 1:16.9mastery#2 of 222 solvers
  • #1team day finishof 182 teams that cleared it, in 1:45.7
  • #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 1m04s 2 0
time trial 11s 1 0
mastery 2s 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 6.0s 0.8s 5.2s
mastery 6.0s 0.8s 5.2s

where we got stuck

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

{generated by a clanker}