hook line and signal: an answer the app computes

huntress ctf 2026, day 23 · mobile android · all three modes

tools used: android apk toolkit and timed-attempt pipeline.

"separate real instrumentation signals from generated false positives." every mobile challenge so far has carried a puzzle file in the apk's assets: data, a key and a codec chain that decode to the backend answer code, ANS- and sixteen uppercase hex digits. day 23's single was one more of those (codec xor, base64 data, an integer key). the time trial's puzzle named a new schema, a codec called analysis, and no data at all: the code is not stored anywhere in the apk. the app computes it.

the key insight: when nothing in the apk holds the answer, the answer is the return value of the code that builds it. find the method that holds the ANS- literal, run it on a small dalvik interpreter, and prefer the method that other code actually calls.

challenge shape

single         1 field    the answer code of a schema v1 puzzle
time trial     1 field    the answer code of a schema v2 puzzle (codec
                          "analysis", no data, no key)
mastery        7 fields   one code per set, seven apks

artifact anatomy

the time-trial apk is small: a manifest, one classes.dex of about five kilobytes, a signature and assets/huntress_puzzle.json, which holds only the schema, the day, the codec name and a build id. the dex has a handful of classes in the case's package. one static method takes a Context and returns a string: it builds ANS- with a StringBuilder, then appends sixteen characters taken from "0123456789ABCDEF" by shifting a 64-bit value right by 60, 56, ... 0 and masking four bits. that 64-bit value comes from a chain of static helpers, each a few lines of 64-bit arithmetic:

token   = mix_c(mix_b(mix_a(CONSTANT)))
value   = mix_e(mix_d(token)) ^ CONSTANT
mix_*   add, xor and multiply by 64-bit constants, rotate by fixed amounts

one of the token helpers also folds in "signal" probes: static methods over four integers that return an integer, the app's model of instrumentation checks. several more helpers of the same shape exist in the dex and are never reached from the answer method; their names (hook, trampoline, seal, signal) look just like the live ones, so only the call graph tells them apart.

extraction method

we interpret the bytecode instead of reading it. the dex parser we already had (string, type, field and method tables, class data and code items) supplies the instructions; the interpreter keeps a register file per call, treats a wide value as a register pair, and implements each opcode with java's semantics: 64-bit wraparound, logical versus arithmetic right shifts, shift counts masked to six bits for longs.

def run(method, args):
    regs = [0] * method.registers
    regs[method.registers - len(args):] = args        # arguments sit last
    pc, result = 0, None
    while True:
        op, a, b, c = decode(method.insns, pc)
        if op == CONST_WIDE:
            regs[a] = c
        elif op == ADD_LONG_2ADDR:
            regs[a] = wrap64(regs[a] + regs[b])
        elif op == MUL_LONG_2ADDR:
            regs[a] = wrap64(regs[a] * regs[b])
        elif op == XOR_LONG_2ADDR:
            regs[a] = regs[a] ^ regs[b]
        elif op == USHR_LONG:
            regs[a] = (regs[b] & MASK64) >> (regs[c] & 63)
        elif op == INVOKE_STATIC:
            result = run(resolve(c), [regs[r] for r in a])
        elif op == MOVE_RESULT_WIDE:
            regs[a] = result
        elif op == RETURN_WIDE:
            return regs[a]
        ...
        pc = next_pc(op, pc)

calls into the java and android libraries the code uses (StringBuilder, String.charAt, Long, Math) are implemented in python; a call into anything else (a thread, a device service) stops the run with an error that names it, so a missing piece is reported, never guessed. a step cap bounds every run: the day's code finished in about 81,000 steps.

without an interpreter the same answer comes from a decompiler: open the apk in jadx, copy the helper chain into python and mask every long operation to 64 bits (& 0xFFFFFFFFFFFFFFFF; java's >>> shifts the masked value, >> keeps the sign). our interpreter does exactly that, one opcode at a time.

to find what to run, the interpreter lists every method whose code loads the ANS- string, runs each, and keeps the results that have the answer's shape. methods that some other method calls come first: a decoy that nothing invokes can produce a well-formed code too, but the live path is the one the app executes.

validation and answer formatting

the result must match the question's own pattern (ANS- and exactly sixteen uppercase hex digits); the interpreter returns the string the method built, so the case and length come from the app.

failed approaches and pivots

the solver's puzzle reader tried every codec and data reading it knew and reported that no decoding path existed, which was true: there was no data. an apk with nothing to decode needed a different reader, not a wider search.

automation across modes

the same interpreter answers each mastery set; seven apks took a fraction of a second. the pools for this challenge carried two further steps of the same idea, which the reader now handles too:

lessons

solve times

public scoreboard · day 23 finish: 1st

  • 0:02.7singlefirst blood, +0.43 s
  • 5:22.4time trial#20 of 158 solvers
  • 5:24.5mastery#11 of 156 solvers
  • #1team day finishof 140 teams that cleared it, in 8:58.5
  • #2single 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 0.8s 1 0
time trial 319.1s 2 0
mastery 0.8s 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.4s 49.6s
mastery 230.0s 0.8s 229.2s

where we got stuck

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

{generated by a clanker}