Tactical LogHuntress CTF 2026 // team archive

Days / Day 29 / Mobile Android / White Box Key Recovery

DAY 29//LANE: MOBILE ANDROID//STATUS: CORRECT x3

White Box Key Recovery

Mobile Android SSTTMM Modes reported CORRECT in this write-up

Day 29 - White Box Key Recovery (mobile-android) - agent-5

All three modes CORRECT (GM-accepted flags):

ModeResultFlag
Single SolveCORRECT117395dd4f8ce421045bc4e67b2450d7
Time TrialCORRECT (ranked)a32e387eba2c28788d07cc52bd4d5d18
Mastery (13 APKs)CORRECT (regular path)f056325f23f61848b19a809ba10b5f40

Single / Time Trial: new codec table

assets/huntress_puzzle.json = {"codec":"table","data":"<hex>","key":41,...}. data is 20 hex bytes; the bytes minus "ANS-" differ by 41,44,47,50, so plain[i] = (byte[i] - key - 3*i) mod 256, giving ANS- + 16 uppercase hex. Added _table to the per-CID solver clone (scripts/mobile_wip.py): step is read if declared, otherwise searched over 0..255, and a reading is accepted only when exactly one yields a valid ^ANS-[0-9A-F]{16}$.

Mastery: 13 APKs from earlier days (d02..d29), codec analysis

Each answer comes from running the APK's Release.code(Context) in the stdlib Dalvik interpreter. Two gaps surfaced:

  1. JNI-bound NativeLibrarySecrets.nativeShare(J)J (d15, mastery_6) - no bytecode in the DEX; the logic is in lib/x86_64/libarena.so (challenge artifact, not published). Static disassembly (objdump): x ^= C1; x *= C2; x = rol(x,59); x += C3; x ^= x>>35; x ^= x>>31. Instead of hard-coding the constants, the clone now parses the ELF64 symbol Java_<mangled owner>_<name> from the APK's own library and runs it in a tiny x86-64 straight-line emulator (mov/movabs/xor/add/sub/imul/and/or/shifts/rol/ror/ret, anything else raises DexHeld). Checked against a hand-written reference on 5 inputs. Nothing from the APK is executed natively.
  2. d19 mastery_8 - packed-switch/sparse-switch (0x2B/0x2C) and reflection (Class.forName, Long.valueOf, Long.longValue) were unsupported; added. After the patch all 13 APKs decoded offline to valid ANS codes before the runner's Mastery attempt.

Lessons

  • A day's puzzle codec may be new (table); a Mastery bundle mixes earlier-day APKs, so the DEX interpreter must cover every earlier day's opcodes/natives, not just today's.
  • Native .so leaves can be emulated from the APK's own library rather than reversed by hand per variant.
  • The Time Trial needed the Commander to stage it (prebrief) before the runner would start it.