pending intent relay: a keyed codec in the puzzle asset
huntress ctf 2026, day 4 · mobile android · all three modes
tools used: android apk toolkit and timed-attempt pipeline.
as on every earlier day, the apk carried assets/huntress_puzzle.json, and the answer was its data decoded per its codec. the pending-intent framing in the manifest was flavor. day 4 introduced the first keyed codec: xor, with an integer key field.
the key insight: xor here means base64-decode the data, then xor every byte with the key. the decoded result must match ANS- plus sixteen uppercase hex digits, which also verifies the key.
artifact anatomy
{"schema": "huntress.mobile.puzzle.v1", "day": 4, "codec": "xor",
"data": "XFNOMCstXCxeXCVYJSQkKiUpKy8=", "key": 29}
the key varied per variant (four different values across the timed sets). key is a json integer below 256, and data is 28 base64 characters: twenty bytes once decoded, one per character of the code.
extraction method
by hand, the whole day-4 codec is two lines:
raw = base64.b64decode(puzzle["data"])
answer = bytes(b ^ puzzle["key"] % 256 for b in raw).decode()
the toolkit's keyed step, which also serves add and sub:
def keyed(raw: bytes, op: str, key: bytes) -> str:
if op == "xor":
return bytes(b ^ key[i % len(key)] for i, b in enumerate(raw)).decode("latin-1")
sign = -1 if op == "add" else 1
return bytes((b + sign * key[i % len(key)]) % 256 for i, b in enumerate(raw)).decode("latin-1")
codecs are chains of named steps. a keyed step decodes base64 first unless an earlier step already produced bytes. keys may be an integer, a decimal or 0x string, or a hex byte string.
validation and answer formatting
the answer shape ANS-[0-9A-F]{16} is checked after decoding. if the declared codec or key does not produce it, the toolkit tries every single-byte key for xor, add and subtract over the base64, hex and raw readings of the data (each also reversed), then the two- to four-byte keys that the known ANS- prefix fixes, and only then falls back to the generic decoding search. it reports which path succeeded instead of silently guessing.
failed approaches and pivots
the shared decoder had no notion of a key: codecs were unkeyed transforms of the data string. the single was solved with a local decode while the shared decoder grew keyed steps, a key parser and the bounded keyed search described above.
automation across modes
one solver handled the single, the time trial and a three-apk mastery under the same decode call.
lessons
- a declared codec is a claim; the answer shape is the proof.
- when a format grows keys, make the brute-force fallback part of the decoder, bounded and verified, not a manual step.
solve times
public scoreboard · day 4 finish: 1st
- 0:49.2single#2 of 247 solvers
- 1:22.3time trialfirst blood, +20.8 s
- 1:31.7masteryfirst blood, +27.6 s
- #1team day finishof 192 teams that cleared it, in 11:06.3
- #1single 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 | 44s | 1 | 0 |
| time trial | 18s | 1 | 0 |
| mastery | 5s | 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.6s | 5.4s |
| mastery | 6.0s | 0.0s | 6.0s |
where we got stuck
- the first keyed codec meant the shared decoder had no notion of a key; the single was solved with a local decode while the shared one was extended.
flags: single, time trial, and mastery [redacted].
{generated by a clanker}