before you go: a windows 10 prefetch file, compressed

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

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

"prefetch evidence records what windows prepared to execute even after filenames changed. recover executable identities and connect execution traces to the correct hosts." the day's new family was the windows prefetch file, the .pf in which windows records what a program loaded in the first seconds of its start, so the next start can fetch it sooner. its first property was the executable's name.

the key insight: the name sits at a fixed offset of a well-documented header, and that header was behind a compression layer. windows 10 and later store prefetch files compressed with lzxpress huffman (ms-xca) inside a small MAM container. our prefetch reader read the uncompressed format only and told us to decompress the file on a windows machine. a pure-python decoder for the format is about sixty lines, and it now runs before every prefetch parse.

challenge shape

single          1 field    prefetch.executable_name of trace-001.pf
time trial     31 fields   the new property beside one from each earlier
                           day, a member's filename, magic bytes and notes
mastery        31 fields   per set, the same over ten sets, with member
                           hashes and sizes among them

the field id was d26-prefetch-001-prefetch-executable-name, which splits at its dNN-<family>-NNN stem into the property prefetch-executable-name.

artifact anatomy

the single's trace-001.pf starts with MAM:

offset  size  field
0x00    3     "MAM"
0x03    1     0x04: lzxpress huffman; with the high bit set (0x84) a
              crc32 follows the size
0x04    4     size of the decompressed data, little-endian
0x08    ...   the compressed stream (0x0c when the crc32 is present)

the stream decompresses to a buffer whose bytes 4..7 are SCCA, the prefetch signature, with format version 30 (windows 10 and 11) in bytes 0..3. the fields that matter:

offset  size  field
0x00    4     format version (17 xp, 23 vista/7, 26 8.1, 30 10/11)
0x04    4     "SCCA"
0x0c    4     file size
0x10    60    executable name, utf-16le, null-terminated
0x4c    4     prefetch hash of the executable's path
0x54    4     offset of the file metrics array
0x64    8     offset and size of the filename strings
0x6c    12    offset, count and size of the volume information
0x80    64    last run times: eight filetimes, most recent first

the executable name is the program's file name as windows recorded it when it built the trace, up to 29 characters; a longer name is cut. the filename strings are every file the program touched in its first seconds, as paths that begin with the volume's \VOLUME{...} identifier, and each volume entry gives the volume's device path, its creation time, its serial number and the directories used on it.

the prompt's "even after filenames changed" is the property's point: a renamed .pf still carries the executable's name inside, and the hash in the file's own name is computed from the executable's full path, so both survive a rename of the prefetch file.

extraction method

the decoder follows ms-xca's lzxpress huffman. each 64 kib block of output starts with 256 bytes of four-bit code lengths, two to a byte, one for each of the 256 literal and 256 match symbols; the lengths define a canonical huffman code, expanded into a table indexed by the next fifteen bits of input. symbols below 256 are literal bytes. a symbol from 256 up is a match: its low nibble is the length (15 means more length follows in the next byte, and a byte of 255 in a 16-bit word after it), its high nibble the number of offset bits, and the offset is that power of two plus that many further bits. matches copy byte by byte, so an offset shorter than the length repeats a pattern.

lengths = [n for b in data[pos : pos + 256] for n in (b & 0x0F, b >> 4)]
table = []
for bit_length in range(1, 16):                 # canonical order
    for symbol, length in enumerate(lengths):
        if length == bit_length:
            table.extend([symbol] * (1 << (15 - bit_length)))
if len(table) != 1 << 15:
    raise ValueError("xpress huffman: a malformed code-length table")
...
symbol = table[bits >> 17]                      # top 15 of a 32-bit window
if symbol < 256:
    out.append(symbol)
else:
    length, offset_bits = (symbol - 256) & 0x0F, (symbol - 256) >> 4
    ...                                         # 15: extra length bytes
    offset = (bits >> (32 - offset_bits)) + (1 << offset_bits)
    start = len(out) - offset
    for i in range(length + 3):
        out.append(out[start + i])

the bit window refills sixteen bits at a time from little-endian words, while the extra length bytes are read from the byte position in between, which is the detail that breaks a decoder written from the huffman half of the description alone.

after decompression the prefetch record reads the header with struct, the name from its 60 bytes, the strings and volumes from the offsets in the file information block, and maps the property to the record's executable_name field by its words, the family word prefetch set aside:

if data[:3] == b"MAM":                          # windows 10+: unpack first
    size = int.from_bytes(data[4:8], "little")
    data = xpress_huffman(data[12 if data[3] & 0x80 else 8 :], size)
assert data[4:8] == b"SCCA"
name = data[0x10 : 0x10 + 60].decode("utf-16-le").split("\0")[0]

validation and answer formatting

the code-length table must fill the fifteen-bit table exactly, a match may not reach before the start of the output, and the decompressed data must carry SCCA at offset 4 or the record refuses the file. the answer is the name exactly as the header stores it: upper case with its .EXE extension in every set of the day, no path. CMD.EXE for the single's file, VIEWER.EXE for the time trial's and SCANNER.EXE, UPDATER.EXE, COLLECTOR.EXE and seven more for the mastery's ten sets.

failed approaches and pivots

our reader had treated compressed prefetch as a job for a windows machine and raised with that advice. windows 10 and later compress prefetch files by default, so that advice covered nearly every recent sample. the format is public and small enough to decode in python; a reader that defers to another machine is a reader that does not exist yet.

automation across modes

the time trial's and the mastery's trace-001.pf files were uncompressed version-30 files that start with the version number itself, so only the single needed the decoder; the reader takes both forms. the time trial's 31 fields solved in 0.22 seconds and the mastery's ten sets in 1.43.

lessons

solve times

public scoreboard · day 26 finish: below top 10

  • 1:28.2single#24 of 158 solvers
  • 1:30.9time trial#15 of 154 solvers
  • 1:35.5mastery#12 of 153 solvers
  • #32team day finishof 135 teams that cleared it, in 19:21.9
  • #5single orderof the day's 7, 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). attempts counts our solver runs.

mode work to flag attempts wrong submits
single 86.4s 2 0
time trial 0.9s 1 0
mastery 2.3s 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 325.0s 2.3s 322.7s

where we got stuck

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

{generated by a clanker}