return to sender: a message id from the mail record
huntress ctf 2026, day 16 · metadata forensics · all three modes
tools used: archive and metadata toolkit and timed-attempt pipeline.
the prompt: "a mailbox export contains replies, forwards, duplicates, and reconstructed messages. use stable message identities to rebuild which mail actually belongs together." the single was a zip holding one email, and its one question asked for that message's id.
the key insight: the day's only new field was one header of one rfc 5322 message, and the mail record the toolkit has built since day 14 already held every header as stored. the threading story in the prompt, replies and forwards and duplicates, was not asked on day 16; we prepared for it anyway.
challenge shape
single 1 field a zip with message-001.eml
time trial 21 fields the cumulative evidence bundle
mastery 105 fields five bundles
the field id names the member and the property: d16-email-001-email-message-id, "determine email.message_id for message-001.eml", answer kind exact_text with "use the literal none only when the requested field is absent".
the time trial and the mastery carry fields from every earlier family (the roster's file name, hashes, size, magic prefix and byte-order mark of a text note, jpeg and png dimensions, the pdf version, a zip's entry count and member names, pe header fields and version strings, a .net mvid, an msi product code, a shortcut's target, a word document's external relationships), the day's message id, and a field that orders four named files by their sha-256 digests.
artifact anatomy
From, To, Date, Subject
Message-ID <id-left@id-right>
X-... a correlation header
MIME-Version, Content-Type: multipart/mixed; boundary="..."
--boundary text/plain body
--boundary text/plain attachment, base64, filename="..."
--boundary--
rfc 5322 section 3.6.4 defines the message identifier as "<" id-left "@" id-right ">": the angle brackets are part of the field's syntax. a reply names its parent in In-Reply-To and its ancestors, root first, in References; no message of the day carried either.
extraction method
the mail reader parses the message with python's email package under the compat32 policy, which leaves header values as they are written instead of re-rendering dates and addresses, undoes header folding, and keeps each header's first value:
msg = email.message_from_bytes(data, policy=email.policy.compat32)
record = {}
for key, value in msg.items():
record.setdefault(key, re.sub(r"\r?\n[ \t]+", " ", str(value)).strip())
the property email.message_id maps to the record's Message-ID by its words (message, id), the day 14 rule for every one-record reader.
validation and answer formatting
the graded value is the header exactly as stored, angle brackets included. reading the header text as written, rather than a parsed address or id, keeps them.
the synthesis field ("submit a compact json array of their filenames in ascending digest order") is computed across the named members, the day 13 rule for fields that span several files. with the members unpacked:
names = json.loads(listed) # the "Files: [...]" array from the question
digest = {n: hashlib.sha256(Path(n).read_bytes()).hexdigest() for n in names}
answer = json.dumps(sorted(names, key=digest.get), separators=(",", ":"))
automation across modes
every mode asks the same families of other bundles; the record answers each message's id from its own bytes, and the other families come from their readers as on earlier days.
for the next day the mail record also answers the thread: In-Reply-To, References and the other reply headers (the literal none when absent), the thread root and parent by their message ids, the subject without reply and forward prefixes, the attachment count and names, the mime boundary, and the sender's and recipient's address and domain (see day 16 additions).
lessons
- an identifier's delimiters belong to it when the standard says they do;
<and>are part of a message-id. - a header reader should keep values as written; re-rendering through a "smart" policy changes dates and addresses.
- a prompt can describe more than the day asks; read the field list first, then prepare for the rest.
solve times
public scoreboard · day 16 finish: 1st
- 0:06.5single#3 of 183 solvers
- 0:09.2time trial#2 of 174 solvers
- 0:11.6masteryfirst blood, +0.49 s
- #1team day finishof 162 teams that cleared it, in 1:02.1
- #4single 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 the mode's first attempt start to its flag (server times).
| mode | work to flag | attempts | wrong submits |
|---|---|---|---|
| single | 1.0s | 1 | 0 |
| time trial | 1.0s | 1 | 0 |
| mastery | 1.4s | 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 | 1.0s | 49.0s |
| mastery | 170.0s | 1.4s | 168.6s |
where we got stuck
- nowhere: every field name was one the readers already answered, and the first attempt of each mode was correct.
flags: single, time trial, and mastery [redacted].
{generated by a clanker}