CSCTF 2026Mobile
VaultKeeper
The note is an AES-GCM blob stored in a string resource. Its key is built from three values, and all of them can be recovered from the APK without running it:
- Competition
CSCTF 2026- Category
- MobileEasy
- Source status
- Source-documented · not platform-verified
- Document
- PDF edition3 min read
Brief
The challenge
- Category
- Mobile
- Difficulty
- Easy
- Points
- 120
- Author
- Pratik Shetty
- File
vaultkeeper.apk(SHA-25679559746ad419b219c88b362ff89b667993bad726e3b7109501b075c007de2ed)
Responders seized a field handset during coordinated attacks on emergency communications. Recover that note from the APK. The surviving handover card carries authorization code
ZHUU-SANS-9XJN-QPCQ. Analyze the package offline; you do not need to install it or complete its UI workflow.

TL;DR
The note is an AES-GCM blob stored in a string resource. Its key is built from three values, and all of them can be recovered from the APK without running it:
key = SHA256( "KJSC-" + certSHA256[:8] + "-RECOVERY" // recovery_token, derived from the signing cert + "4972" // archive digits, pinned by the receiver's HMAC check + "ZHUU-SANS-9XJN-QPCQ" ) // handover authorization code typed into the main screennote = AES-GCM-decrypt(key, iv = blob[:12], ct||tag = blob[12:])01
Recon
The APK has a single classes.dex with no native libraries. The app's own code is in com.vaultkeeper:
IntroActivity, which is the launcher.MainActivity, the vault screen with an input field and an unlock button.ArchiveActivity, which takes a 4-digit code.RecoveryDiagnosticsActivity, which handles the deep linkvault://recover?stage=1.RecoveryStage2Receiver, a broadcast receiver.VaultDiagnosticsProvider, a content provider atcontent://com.vaultkeeper.provider.diagnostics/keys.LegacyRecoveryActivity, a decoy that only prints "channel decommissioned".
jadx hung on this APK, so I dumped the bytecode with androguard instead (dump.py, dump2.py).
02
The intended UI workflow
On a device the unlock works in two stages:
Stage 1. Open
vault://recover?stage=1with the extrarecovery_tokenset to the value the content provider returns.RecoveryDiagnosticsActivitythen setsstage1_complete.Stage 2. In
ArchiveActivity, type 4 digits. The activity stores them asarchive_digits_cacheand showsarchive_key = HMAC-SHA256("VK-7F42", digits)[:8].upper(). Send that key as thearchive_keyextra toRecoveryStage2Receiver. If it equals3778F16D, the receiver setsstage2_complete.Unlock. Once both flags are set, the unlock button in
MainActivity(handlerH0/d, case 2) decrypts the note.
03
The decryption routine
From H0/d.onClick:
token = A.c.a0(context) // provider's recovery_tokendigits = prefs["archive_digits_cache"]input = MainActivity EditTextkey = SHA256(token + digits + input)blob = Base64(getString(0x7f0f0038))AES/GCM/NoPadding, iv = blob[0:12], 128-bit tag, ct = blob[12:]So the stage flags only gate the UI. What actually matters is the three key inputs.
04
Recovering each input offline
recovery_token. A.c.a0 takes SHA-256(signatures[0].toByteArray()), which is the SHA-256 of the DER signing certificate, keeps the first 8 hex characters, uppercases them and wraps them:
cert SHA-256 = 1C28DC7E5AB079FF...recovery_token = KJSC-1C28DC7E-RECOVERYArchive digits. String resource 0x7f0f0020 is the HMAC key VK-7F42. The receiver hard-codes the expected key 3778F16D, and only one 4-digit value out of 10,000 produces it:
HMAC-SHA256("VK-7F42", "4972")[:8] = 3778F16D → digits = 4972User input. This is the handover card's authorization code from the briefing: ZHUU-SANS-9XJN-QPCQ.
05
Decrypt
GCM authenticates the ciphertext, so a successful decrypt confirms all three inputs are correct.
$ python solve.pyhmac key resource: VK-7F42recovery_token: KJSC-1C28DC7E-RECOVERYarchive digits: ['4972']note: CSCTF{intent_uri_and_a_broadcast_unlock_the_vault}Solve script
solve.py:
import base64, hashlib, hmacfrom androguard.core.apk import APKfrom cryptography.hazmat.primitives.ciphers.aead import AESGCMa = APK("vaultkeeper.apk")res = a.get_android_resources()hmac_key = res.get_resolved_res_configs(0x7f0f0020)[0][1]blob = base64.b64decode(res.get_resolved_res_configs(0x7f0f0038)[0][1])cert_sha = a.get_certificates()[0].sha256_fingerprint.replace(" ", "")token = f"KJSC-{cert_sha[:8].upper()}-RECOVERY"digits = [f"{i:04d}" for i in range(10000) if hmac.new(hmac_key.encode(), f"{i:04d}".encode(), hashlib.sha256).hexdigest()[:8].upper() == "3778F16D"]code = "ZHUU-SANS-9XJN-QPCQ"iv, ct = blob[:12], blob[12:]for d in digits: key = hashlib.sha256((token + d + code).encode()).digest() print(AESGCM(key).decrypt(iv, ct, None).decode())Flag
Flag
CSCTF{intent_uri_and_a_broadcast_unlock_the_vault}
Source-documented · not platform-verified
Takeaways
Multi-stage UI gates (deep links, broadcasts, provider tokens) are just state flags. Go straight to the code that uses the secret and rebuild its inputs.
PackageInfo.signatures[0]is the DER signing certificate, so any key "bound to the device" this way is really bound to the APK and can be recovered offline.A truncated HMAC over a 4-digit space reveals its input: brute-force all 10,000 values against the hard-coded comparison.