To wield the axe, one must first bypass the forge’s final lock.
Overview
StormBreaker is a tiny Jetpack Compose Android app with a single “vault” screen: a PIN text field and an Unlock button. The goal is to get past the lock and recover the flag.
flowchart LR
A[K int array] -->|XOR 0x5A| B[16-byte AES key]
B --> D[AES-128-CBC decrypt]
C[hardcoded IV + base64 blob] --> D
D --> E[plaintext = PIN = flag body]
F[user input] -->|equals?| E
E -->|match| G[show vault contents]
E -->|no match| H[Wrong PIN]
Prerequisites / Setup
unzip— raw look at the APK contentsapktool— decode manifest and resources, dump smalijadx/jadx-gui— decompile dex back to readable Kotlin/Java-like codestrings,grep— quick triage of native libs and dexpython3+pycryptodome— reproduce the decryptionopenssl, CyberChef (optional) — cross-check the decryption
Recon
Step 1 — Unpack the APK
Goal: Confirm the APK structure and that it is just a zip.
mkdir sb_raw && cd sb_raw
unzip -q ../STORMBREAKER.apk
ls
AndroidManifest.xml classes.dex classes2.dex classes3.dex
classes4.dex classes5.dex classes6.dex lib res resources.arsc ...
Several dex files already tell us the app is big because of bundled libraries (Compose, AndroidX, Kotlin).
Decode it properly with apktool to get a readable manifest and smali:
apktool d STORMBREAKER.apk -o STORMBREAKER
cd STORMBREAKER
ls
AndroidManifest.xml apktool.yml kotlin lib META-INF original res
Exploitation
Step 2 — Read the manifest
Goal: Confirm the package, activity, and that there is no exported attack surface.
cat AndroidManifest.xml
Things worth noting:
- Package is
com.fryda.stormbreaker, a single launcher activityMainActivity. android:debuggable="true"andallowBackup="true"(useful if you want to go dynamic later, but not needed).- The only extra activities and receivers are stock AndroidX (
PreviewActivity,ComponentActivity,ProfileInstallReceiver). Nothing custom or suspicious. - No dangerous permissions, no network, no custom providers.
Step 3 — Check the native libraries (dead end)
Goal: Confirm the logic is not native.
The lib/ folder has four ABIs, so it is tempting to assume the logic is native.
ls lib/
ls lib/x86_64
strings lib/x86_64/libandroidx.graphics.path.so | head -40
arm64-v8a armeabi-v7a x86 x86_64
libandroidx.graphics.path.so
The only library is libandroidx.graphics.path.so. The strings (androidx/graphics/path/PathIteratorPreApi34Impl, internalConicToQuadratics, createInternalPathIterator, …) show it is the standard AndroidX Compose path helper. It contains nothing related to the challenge.
Step 4 — Locate the app’s own code
Goal: Find which dex holds com.fryda.stormbreaker.
Six dex files is mostly library code. Grep each one for the app’s package name:
for f in classes*.dex; do
echo "== $f"
strings -n 6 "$f" | grep "com/fryda/stormbreaker" | head
done
Hits:
classes2.dex: only the generatedRclasses (resources).classes3.dex:ui/theme/ColorKt,ThemeKt,TypeKt(styling).classes4.dex:MainActivity,MainActivityKt,ComposableSingletons$MainActivityKt. This is the one.
With apktool’s output this maps directly to a folder:
ls smali_classes4/com/fryda/stormbreaker/
ComposableSingletons$MainActivityKt.smali
MainActivity.smali
MainActivityKt.smali
MainActivityKt$$ExternalSyntheticLambda0.smali (and 1, 2)
Step 5 — Decompile MainActivityKt
Goal: Read decryptVault(), key(), and the Unlock click handler.
Open the APK in jadx (or jadx -d out STORMBREAKER.apk for CLI) and go to com.fryda.stormbreaker.MainActivityKt. The relevant members are the static array K, key(), decryptVault(), and the button click lambda inside VaultScreen.
jadx -d jadx_out STORMBREAKER.apk
less jadx_out/sources/com/fryda/stormbreaker/MainActivityKt.java
The unlock check
The Unlock button’s click handler (VaultScreen$lambda$10$lambda$9$lambda$8 in the smali) does the following:
val input = pinState.value
val vault = decryptVault()
resultState.value = if (input == vault) decryptVault() else "Wrong PIN"
So the comparison target is the decrypted string. There is no hash or second secret, so recovering decryptVault() output is the whole challenge.
The crypto routine
fun decryptVault(): String {
val c = Cipher.getInstance("AES/CBC/PKCS5Padding")
c.init(
Cipher.DECRYPT_MODE,
SecretKeySpec(key(), "AES"),
IvParameterSpec("0123456789abcdef".toByteArray(Charsets.UTF_8))
)
val ct = Base64.decode("ocBtN+01RjIU0RWW7jEIz/rBCprw4dndwksr9XAv8sLADrTyj/hdsyEQAsSM3BuNqKABM7ikwqmuSb4vZmjVzHEJgdn67h8+/f4BlQk40dU=", 0)
return String(c.doFinal(ct), Charsets.UTF_8)
}
Everything is static:
| Parameter | Value |
|---|---|
| Algorithm | AES-128, CBC, PKCS5/PKCS7 padding |
| IV | 0123456789abcdef (ASCII) |
| Ciphertext | base64 string above (80 bytes after decoding) |
| Key | produced by key(), see next step |
The key derivation
The key is not stored as a string, which is why a simple strings | grep for it fails. It is rebuilt at runtime from an int array K XORed with 90:
val K = intArrayOf(
0x14, 0x6a, 0x2e, 0x09, 0x6a, 0x09, 0x69, 0x39,
0x28, 0x69, 0x2e, 0x11, 0x69, 0x23, 0x7b, 0x7b
)
fun key(): ByteArray {
val out = ByteArray(16)
for (i in 0 until 16) out[i] = (K[i] xor 90).toByte()
return out
}
In the smali the array shows up as a fill-array-data payload in MainActivityKt.<clinit>. Each element is stored as a 4-byte little-endian int, so the raw payload looks like \x14\x00\x00\x00j\x00\x00\x00.\x00\x00\x00.... Pull out every first byte of each 4-byte group:
grep -n -A 25 "array-data 4" smali_classes4/com/fryda/stormbreaker/MainActivityKt.smali
XOR each value with 0x5A (decimal 90):
| i | K[i] | K[i] ^ 0x5A | char |
|---|---|---|---|
| 0 | 0x14 | 0x4e | N |
| 1 | 0x6a | 0x30 | 0 |
| 2 | 0x2e | 0x74 | t |
| 3 | 0x09 | 0x53 | S |
| 4 | 0x6a | 0x30 | 0 |
| 5 | 0x09 | 0x53 | S |
| 6 | 0x69 | 0x33 | 3 |
| 7 | 0x39 | 0x63 | c |
| 8 | 0x28 | 0x72 | r |
| 9 | 0x69 | 0x33 | 3 |
| 10 | 0x2e | 0x74 | t |
| 11 | 0x11 | 0x4b | K |
| 12 | 0x69 | 0x33 | 3 |
| 13 | 0x23 | 0x79 | y |
| 14 | 0x7b | 0x21 | ! |
| 15 | 0x7b | 0x21 | ! |
The derived AES key is the ASCII string N0tS0S3cr3tK3y!!.
Step 6 — Solver script
Goal: Reproduce the decryption in Python and strip PKCS7 padding.
Install the dependency (a virtualenv keeps things tidy) and save as solver.py:
python3 -m venv myenv && source myenv/bin/activate
pip install pycryptodome
#!/usr/bin/env python3
import base64
from Crypto.Cipher import AES
# int array K from MainActivityKt.<clinit>
K = [0x14, 0x6a, 0x2e, 0x09, 0x6a, 0x09, 0x69, 0x39,
0x28, 0x69, 0x2e, 0x11, 0x69, 0x23, 0x7b, 0x7b]
key = bytes(k ^ 90 for k in K) # key() in the app
iv = b"0123456789abcdef" # hardcoded IV
ct = base64.b64decode(
"ocBtN+01RjIU0RWW7jEIz/rBCprw4dndwksr9XAv8sLADrTyj/hdsyEQAsSM3BuNqKABM7ikwqmuSb4vZmjVzHEJgdn67h8+/f4BlQk40dU="
)
print("key:", key)
pt = AES.new(key, AES.MODE_CBC, iv).decrypt(ct)
print("raw:", pt)
# strip PKCS7 padding
pad = pt[-1]
print("clean:", pt[:-pad].decode())
python3 solver.py
Output (flag body masked per vault rules):
key: b'N0tS0S3cr3tK3y!!'
raw: b'<REDACTED>\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b'
clean: <REDACTED>
Step 7 — Optional: confirm in the app
Because the unlock check compares the input to the decrypted string, typing the plaintext (without the flag wrapper) into the PIN field should reveal the vault. To test it:
adb install STORMBREAKER.apk
adb shell monkey -p com.fryda.stormbreaker 1
Dynamic alternative: since the app is debuggable, hook MainActivityKt.decryptVault() with Frida and print its return value, which skips the crypto entirely.
Flag
r00t{REDACTED}
The decrypted vault string is the flag body. The challenge platform expects it wrapped in the event’s flag format:
r00t{REDACTED}
Lessons / Takeaways
- Hardcoded keys are not secret. Obfuscating the key with an XOR loop only costs the attacker a few minutes. Anything inside the APK is recoverable.
- The comparison target and the secret were the same value. Checking the PIN against the decrypted plaintext means the “lock” and the “treasure” are identical, so decrypting is the same as unlocking.
- Triage fast. Check the manifest, ignore stock library code, grep dex files for the app’s package name, and skip decoy native libraries like
libandroidx.graphics.path.so. - A static IV and static key make the AES here purely decorative. Real secrets belong on a server, or in the Android Keystore with user authentication, not in the client.
- Debuggable release builds (
android:debuggable="true") make dynamic analysis trivial and should never ship.
Techniques
- Hardcoded Secrets
- APK Decompilation
- AES-CBC Decryption
- XOR Key Obfuscation
- Smali Analysis

