chunk norris: png dimensions from the ihdr chunk

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

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

the evidence zip held png images, and the new field family asked for each image's dimensions as declared in its IHDR chunk. the prompt talked about walking chunks, verifying declared geometry and finding an image with an unexpected structural passenger, but the graded field was only the declared size.

the key insight: IHDR is always the first chunk at a fixed offset, so the answer is two big-endian 32-bit integers read straight from the header, then serialized exactly as WIDTHxHEIGHT.

challenge shape

answer ids follow the lane's <member stem>-<property> pattern, here d05-png-NNN-png-ihdr-dimensions-pixels, asked as "determine png.ihdr_dimensions_pixels for panel-nnn.png." with the same generic exact_text syntax as day 4. the single and the time trial carried one image; mastery carried one nested zip per set, each with its own image.

artifact anatomy

a png starts with an eight-byte signature, then a sequence of chunks, each length (4) | type (4) | data (length) | crc32 (4) with the crc taken over type and data:

89 50 4e 47 0d 0a 1a 0a                 signature
00 00 00 0d  49 48 44 52                length 13, "IHDR"
ww ww ww ww  hh hh hh hh                width, height (big-endian u32)
08 02 00 00 00                          bit depth, color type, compression,
                                        filter, interlace
.. .. .. ..                             crc32

every graded image was a clean IHDR IDAT IEND file: no ancillary chunks, no bytes after IEND, valid crcs.

extraction method

def image_size(data: bytes) -> tuple[int, int]:
    if data.startswith(b"\x89PNG\r\n\x1a\n") and data[12:16] == b"IHDR":
        w, h = struct.unpack_from(">II", data, 16)
        return w, h
    ...  # gif, bmp, webp and jpeg headers follow

from a shell, xxd -s 16 -l 8 panel-NNN.png shows the same eight bytes (width, then height), and file panel-NNN.png prints them as decimal.

the property name was new, but the toolkit already routed any unregistered *-dimensions-pixels field to this header reader (prepared on day 4), so the existing solver answered it without a code change.

validation and answer formatting

the reader checks the signature and that the first chunk really is IHDR before trusting offset 16; anything else falls through to the other image formats and finally raises. the answer is width first, a lowercase ascii x, then height, with no spaces, the same serialization as day 4's jpeg frame size. the declared size is what was asked, not the decoded pixel grid.

failed approaches and pivots

none. on day 5 we also took the prompt's hints seriously, since a cumulative lane tends to ask about what earlier prompts described. the toolkit now walks the whole chunk list and checks each crc. it also reports chunk types outside the png specification (the likely "passenger"), counts bytes after IEND, and checks the declared geometry: the inflated IDAT stream must be height * (1 + row bytes) long for a non-interlaced image.

automation across modes

the same three-step pipeline as every metadata day: split the field into member stem and property, resolve the member in the (possibly nested) archive, compute the property from the raw bytes. nothing was day-specific.

lessons

solve times

public scoreboard · day 5 finish: 1st

  • 0:02.3singlefirst blood, +14.7 s
  • 0:53.4time trial#2 of 240 solvers
  • 0:55.2mastery#2 of 238 solvers
  • #1team day finishof 188 teams that cleared it, in 3:35.1
  • #2single 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 1s 1 0
time trial 51s 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.9s 5.1s

where we got stuck

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

{generated by a clanker}