little things: utf-16 behind a byte-order mark

huntress ctf 2026, day 19 · warmups · all three modes

tools used: decoding engine and timed-attempt pipeline.

the prompt: "two bytes walk into a bar. the little one goes first." the single and the time trial were one blob of lowercase hex; the mastery was a zip of 93 blobs of nineteen numbered lines, the nineteenth in the same form.

the key insight: two bytes per character with the little one first is utf-16 little-endian. the hex decodes to bytes that start with the byte-order mark ff fe, then alternate a character byte and a zero byte. the bytes were right on the first step; the text reader was what failed.

challenge shape

single        1 field    one hex blob, the whole message
time trial    1 field    one hex blob
mastery      93 fields   93 blobs of 19 numbered lines, line k in day k's form

the field is message (setK.message in mastery): the slug the final decoded line names, in the question's syntax "three lowercase words separated by hyphens, followed by a hyphen and a two-digit number; submit the slug only" (word-word-word-NN).

artifact anatomy

hex text   "fffe" then four hex digits per character
bytes      ff fe  c1 00  c2 00  c3 00 ...
           bom    one character, then its zero high byte

after the hex step the payload is utf-16le with a bom: every character is two bytes, low byte first, and ascii text leaves the high byte zero.

extraction method

the engine turns every reading's bytes into text through one function. it already accepted utf-16le, detected by the zero high bytes at the odd positions, so windows tooling output decodes without a named step. the bom broke that test: its second byte, fe, sits at index 1, so the odd positions were not all zero, the bytes went to the utf-8 decoder, and ff is never valid utf-8. every reading of the blob ended there and the search reported no path.

the reader now checks for a mark before the zero test, and reads both byte orders and utf-32 the same way (utf-32 first, because its little-endian mark starts with utf-16le's):

def as_text(data):
    if len(data) > 7 and len(data) % 4 == 0:
        if data[:4] in (b"\xff\xfe\x00\x00", b"\x00\x00\xfe\xff"):
            data = data.decode("utf-32").encode()
    if len(data) > 3 and len(data) % 2 == 0:
        if data[:2] in (b"\xff\xfe", b"\xfe\xff"):
            data = data.decode("utf-16").encode()
        elif not any(data[1::2]):
            data = data.decode("utf-16-le").encode()
        elif not any(data[0::2]):
            data = data.decode("utf-16-be").encode()
    return data.decode("utf-8")

that reader change came at the end of day 19. in the race, the timed modes ran on a nine-line transform saved beside the solver, utf16lehex: hex, then utf-16 by its mark or by zeros on one side. with the reader fixed, the plain hex step reads the blob as well, and utf16lehex is the line schedule's row 19, so the mastery's nineteenth line is read by its day.

validation and answer formatting

the decoded text is english ending in the slug; the slug must match the question's shape. the utf-16 detection only accepts an even length and a mark or zeros in every high byte, so ordinary bytes are never read as utf-16.

failed approaches and pivots

the generic search did not fail for lack of the right transform: it had it. the lesson is that a reader shared by every transform is a single point of failure, and a mark the encoding defines must be checked before a heuristic.

automation across modes

the time trial and the mastery ran on the utf16lehex transform: the time trial's blob in one step, the mastery's line 19 through the search for the line past the schedule. since the end of day 19 every mode reads through the fixed reader: the whole blob by the hex step, the mastery's line 19 by its schedule row.

lessons

solve times

public scoreboard · day 19 finish: top 3

  • 0:26.4single#13 of 187 solvers
  • 0:43.0time trial#14 of 176 solvers
  • 0:46.5mastery#6 of 172 solvers
  • #3team day finishof 153 teams that cleared it, in 17:56.2
  • #4single 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 when we started working on the mode to its flag.

mode work to flag attempts wrong submits
single 24.7s 1 0
time trial 0.7s 1 0
mastery 1.1s 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 30.0s 0.7s 29.3s
mastery 110.0s 1.1s 108.9s

where we got stuck

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

{generated by a clanker}