APKey
APKey is a sanitized challenge note from the local HTB archive, organized for quick review by category, difficulty, evidence flow, and reusable operator
Scenario
APKey attack path
APKey is a sanitized challenge note from the local HTB archive, organized for quick review by category, difficulty, evidence flow, and reusable operator
Objective
Challenge walkthrough focused on Mobile evidence, validation, and reusable operator lessons.
Walkthrough flow
Extract the HTB ZIP with the standard archive...
Inspect MainActivity; the app accepts username admin,...
Follow the success path to c.b.a.b.a(c.b.a.g.a()).
Resolve g.b() as AES.
Reconstruct the AES key from the helper classes'...
Source coverage
High source coverage
Status: complete. This article is generated from 6 sanitized Markdown sources and keeps raw flags, credentials, keys, cookies, and reusable secrets out of the rendered blog.
High confidence: the page is reconstructed from a primary walkthrough plus multiple supporting notes or evidence sources. Treat the chain as source-backed, while still checking the listed source files for sensitive values.
- Mobile/APKey/writeup.md
- htb-challenge/Mobile/APKey/notes.md
- htb-challenge/Mobile/APKey/memory-summary.md
- htb-challenge/Mobile/APKey/hypothesis-board.md
- HTB/_knowledge/exports/ctf-lightrag-latest-203412/documents/challenge__Mobile__APKey__memory-summary.md.c0b4cc42c8.md
- HTB/_knowledge/exports/ctf-lightrag-latest-203412/documents/challenge__Mobile__APKey__notes.md.0eac8f36d3.md
Technical Walkthrough
Writeup
Challenge
- Name: APKey
- Category: Mobile
- Difficulty: Easy
- Mode: file
Summary
The APK contains a simple login screen, but the protected value is generated entirely client-side. MainActivity checks for username admin and a hardcoded MD5 digest, then displays the result of decrypting an obfuscated Base64 string. Static decompilation with jadx was enough to reconstruct the AES algorithm, key, and ciphertext without running the APK.
Artifact Inventory
Reference analysis/artifact-inventory.json and summarize the relevant files or remote surface.
files/a12c738d-36f8-4c14-863a-e6c3bc924bdf.zip: <password redacted> HTB ZIP containingAPKey.apk.analysis/extracted/APKey.apk: extracted Android APK.analysis/jadx/: Java/resources decompiled withjadx.analysis/jadx/sources/com/example/apkey/MainActivity.java: login and success path.analysis/jadx/sources/c/b/a/*.java: obfuscated fragments used to build the AES mode, key, and ciphertext.
Analysis
activity_main.xmlshows a basic login form with username and password fields.MainActivity.javarequires usernameadmin.- The password is checked by MD5, but the digest rendering omits zero padding; this is only a gate to display the decrypted value.
- On success,
MainActivitycallsc.b.a.b.a(c.b.a.g.a()). g.b()resolves toAES, so Android uses the default AES transformation.b.a()constructs a 16-byte AES key from character indexes across helper classesa,c,e,f,h, andi.g.a()concatenates obfuscated string fragments into the Base64 ciphertext.solve/solve.pyreproduces the same key/ciphertext construction and decrypts the flag offline.
Solve
Run:
python3 Mobile/APKey/solve/solve.pyThe script reconstructs the APK's AES key and ciphertext from the decompiled helper classes, decrypts the ciphertext with AES/ECB and PKCS padding, and prints the flag for harness capture.
Flag
Raw flag is stored in loot/flag.txt and intentionally not reproduced here.
Lessons
- For Easy mobile APKs, decompile first and follow the success path before setting up emulator/runtime tooling.
- Android
Cipher.getInstance("AES")maps to the platform default AES transformation, which is normally ECB with PKCS padding. - Obfuscated string-fragment classes are often just static data assembly; reconstructing them in a short script is faster and more reliable than running the app.
Source-Backed Dossier
The sections below are merged from companion Markdown notes for the same case. They are rendered after sanitization so the article stays precise without publishing raw flags, credentials, or target-specific secrets.
Notes
Scope
- Challenge: APKey
- Category: Mobile
- Difficulty: Easy
- Mode: file
- Remote instance: none
- Start time: 2026-06-10T10:25:28Z
- Operator: harness
- State file:
challenge-state.json
Harness Status
- Current phase: see
challenge-state.json - Next allowed actions: see
next-action.json - Raw flags and sensitive material stay in
loot/only. Do not paste them here.
Artifact Inventory
| File | Size | SHA256 | Type | Notes |
|---|---|---|---|---|
files/a12c738d-36f8-4c14-863a-e6c3bc924bdf.zip | 1144778 | <hash redacted> | Zip archive data, at least v2.0 to extract, compression method=deflate | zip entries: 1 shown in artifact inventory JSON |
Evidence Ledger
| Time | Action | Output/File | Finding | Confidence | Next |
|---|---|---|---|---|---|
| 2026-06-10T10:25:28Z | harness init | challenge-state.json | Workspace initialized with deterministic state file | High | Inventory artifacts |
| 2026-06-10T10:25:28Z | artifact inventory | analysis/artifact-inventory.json | 1 artifact(s) inventoried | High | Build or update hypotheses |
| 2026-06-10T10:25:56Z | hypothesis recorded | hypothesis-board.md | Static APK reverse: decompile APKey.apk and inspect hardcoded strings, resources, and Java/Kotlin logic for a unique key or flag-generation check. | Medium | Extract APK, decompile with jadx, search decompiled sources/resources for HTB format, key literals, and validation routines. |
| 2026-06-10T10:26:08Z | research skip | analysis/research/research-skip.md | Research intentionally skipped with recorded reason | Medium | Gate before exploit |
| 2026-06-10T10:27:48Z | checkpoint recorded | analysis/checkpoint-analysis-20260610T102748968704Z-d74c55f1.md | Checkpoint for ANALYSIS | High | Use checkpoint to drive next decision |
| 2026-06-10T10:27:48Z | flag capture | loot/flag.txt | HTB-format flag captured; raw value kept in loot only | High | Write solution and run completion gate |
| 2026-06-10T10:29:12Z | completion gate | challenge-state.json | Completion gate passed; state marked COMPLETE | High | Optional sanitized memory summary approval |
Key Findings
- ZIP contains one APK:
APKey.apk. jadxrecovered the relevant app logic despite a few decompiler errors.MainActivityrequires usernameadminand compares a hardcoded non-padded MD5 digest for the password.- The success path calls
c.b.a.b.a(c.b.a.g.a()). g.b()resolves toAES;b.a()builds the AES key from obfuscated helper-class string fragments.g.a()builds the Base64 ciphertext from the same helper-class fragments.solve/solve.pyreproduces the static AES decryption and the harness captured the flag intoloot/flag.txt.
RAG / Advisory Memory
RAG output is advisory only. Record evaluated retrievals with:
scripts/challenge_harness.py rag-record <workspace> --query "..." --tag MATCHED|PARTIAL|MISSING|<secret redacted>|GENERIC --validation "..."Secrets/Flags
Raw flags and sensitive material stay in loot/ only. Use scripts/challenge_harness.py capture-flag to validate and record flag capture without printing the value.
Memory Summary
Metadata
- Platform: HackTheBox Challenges
- Category: Mobile
- Challenge: APKey
- Difficulty: Easy
- Source workspace:
<local workspace>
Validated Solve Chain
Concepts only. Do not include raw flags, reusable credentials, tokens, cookies, private keys, or live secrets.
- Extract the HTB ZIP with the standard archive password and decompile the APK with
jadx. - Inspect
MainActivity; the app accepts usernameadmin, checks a hardcoded MD5 digest, and then displays a decrypted value. - Follow the success path to
c.b.a.b.a(c.b.a.g.a()). - Resolve
g.b()asAES. - Reconstruct the AES key from the helper classes' selected character positions.
- Reconstruct the Base64 ciphertext from
g.a(). - Decrypt offline with AES/ECB and PKCS padding.
Reusable Lessons
- For local-only Easy Android challenges, start with
jadxand inspect the app package before considering emulator, ADB, Frida, or Objection. - Android
Cipher.getInstance("AES")generally means provider-default AES/ECB with PKCS padding. - A password gate does not always need to be bypassed if the protected value is decryptable from static code.
- Be careful with handwritten hex rendering in Java; missing zero padding can make digest strings shorter than canonical MD5 hex.
Dead Ends
- No emulator/runtime instrumentation was needed.
- Cracking or entering the login password was unnecessary because the decrypt routine is fully static.
Tool Quirks
jadxreported a few decompiler errors but still recovered the relevant app classes.apktool,adb,frida,objection, andghidrawere unavailable locally;jadxwas sufficient.
Evidence Paths
analysis/jadx/sources/com/example/apkey/MainActivity.javaanalysis/jadx/sources/c/b/a/b.javaanalysis/jadx/sources/c/b/a/g.javaanalysis/checkpoint-analysis-20260610T102748968704Z-d74c55f1.mdsolve/solve.pyloot/flag.txt
Ingestion Decision
- Proposed for LightRAG: yes
- Requires user approval before ingestion: yes
Hypothesis Board
Keep no more than 3 active hypotheses on Easy/Medium and 5 on Hard unless the user explicitly asks for breadth.
| Rank | Path | Evidence | Missing Proof | Cheapest Validation | Confidence | Status |
|---|---|---|---|---|---|---|
| 1 | Static APK reverse: decompile APKey.apk and inspect hardcoded strings, resources, and Java/Kotlin logic for a unique key or flag-generation check. | ZIP contains a single Android APK named APKey.apk; challenge asks for unique keys. | Extract APK, decompile with jadx, search decompiled sources/resources for HTB format, key literals, and validation routines. | Medium | Active |
Closed Branches
| Branch | Evidence Tested | Failure Output | Reason Closed | Revisit Condition |
|---|
Memory Summary
approval_required: true
Sanitized Memory Summary
Metadata
- Platform: HackTheBox Challenges
- Category: Mobile
- Challenge: APKey
- Difficulty: Easy
- Source workspace:
<local workspace>
Validated Solve Chain
Concepts only. Do not include raw flags, reusable credentials, tokens, cookies, private keys, or live secrets.
- Extract the HTB ZIP with the standard archive password and decompile the APK with
jadx. - Inspect
MainActivity; the app accepts usernameadmin, checks a hardcoded MD5 digest, and then displays a decrypted value. - Follow the success path to
c.b.a.b.a(c.b.a.g.a()). - Resolve
g.b()asAES. - Reconstruct the AES key from the helper classes' selected character positions.
- Reconstruct the Base64 ciphertext from
g.a(). - Decrypt offline with AES/ECB and PKCS padding.
Reusable Lessons
- For local-only Easy Android challenges, start with
jadxand inspect the app package before considering emulator, ADB, Frida, or Objection. - Android
Cipher.getInstance("AES")generally means provider-default AES/ECB with PKCS padding. - A password gate does not always need to be bypassed if the protected value is decryptable from static code.
- Be careful with handwritten hex rendering in Java; missing zero padding can make digest strings shorter than canonical MD5 hex.
Dead Ends
- No emulator/runtime instrumentation was needed.
- Cracking or entering the login password was unnecessary because the decrypt routine is fully static.
Tool Quirks
jadxreported a few decompiler errors but still recovered the relevant app classes.apktool,adb,frida,objection, andghidrawere unavailable locally;jadxwas sufficient.
Evidence Paths
analysis/jadx/sources/com/example/apkey/MainActivity.javaanalysis/jadx/sources/c/b/a/b.javaanalysis/jadx/sources/c/b/a/g.javaanalysis/checkpoint-analysis-20260610T102748968704Z-d74c55f1.mdsolve/solve.pyloot/flag.txt
Ingestion Decision
- Proposed for LightRAG: yes
- Requires user approval before ingestion: yes
Notes
Notes
Scope
- Challenge: APKey
- Category: Mobile
- Difficulty: Easy
- Mode: file
- Remote instance: none
- Start time: 2026-06-10T10:25:28Z
- Operator: harness
- State file:
challenge-state.json
Harness Status
- Current phase: see
challenge-state.json - Next allowed actions: see
next-action.json - Raw flags and sensitive material stay in
loot/only. Do not paste them here.
Artifact Inventory
| File | Size | SHA256 | Type | Notes |
|---|---|---|---|---|
files/a12c738d-36f8-4c14-863a-e6c3bc924bdf.zip | 1144778 | <hash redacted> | Zip archive data, at least v2.0 to extract, compression method=deflate | zip entries: 1 shown in artifact inventory JSON |
Evidence Ledger
| Time | Action | Output/File | Finding | Confidence | Next |
|---|---|---|---|---|---|
| 2026-06-10T10:25:28Z | harness init | challenge-state.json | Workspace initialized with deterministic state file | High | Inventory artifacts |
| 2026-06-10T10:25:28Z | artifact inventory | analysis/artifact-inventory.json | 1 artifact(s) inventoried | High | Build or update hypotheses |
| 2026-06-10T10: <REDACTED>, resources, and Java/Kotlin logic for a unique key or flag-generation check. | Medium | Extract APK, decompile with jadx, search decompiled sources/resources for HTB format, key literals, and validation routines. | |||
| 2026-06-10T10:26:08Z | research skip | analysis/research/research-skip.md | Research intentionally skipped with recorded reason | Medium | Gate before exploit |
| 2026-06-10T10:27:48Z | checkpoint recorded | analysis/checkpoint-analysis-20260610T102748968704Z-d74c55f1.md | Checkpoint for ANALYSIS | High | Use checkpoint to drive next decision |
| 2026-06-10T10: <REDACTED> | |||||
| 2026-06-10T10:29:12Z | completion gate | challenge-state.json | Completion gate passed; state marked COMPLETE | High | Optional sanitized memory summary approval |
Key Findings
- ZIP contains one APK:
APKey.apk. jadxrecovered the relevant app logic despite a few decompiler errors.MainActivityrequires usernameadminand compares a hardcoded non-padded MD5 digest for the password.- The success path calls
c.b.a.b.a(c.b.a.g.a()). g.b()resolves toAES;b.a()builds the AES key from obfuscated helper-class string fragments.g.a()builds the Base64 ciphertext from the same helper-class fragments.solve/solve.pyreproduces the static AES decryption and the harness captured the flag intoloot/flag.txt.
RAG / Advisory Memory
RAG output is advisory only. Record evaluated retrievals with:
scripts/challenge_harness.py rag-record <workspace> --query "..." --tag MATCHED|PARTIAL|MISSING|<secret redacted>|GENERIC --validation "..."Secrets/Flags
Raw flags and sensitive material stay in loot/ only. Use scripts/challenge_harness.py capture-flag to validate and record flag capture without printing the value.
Technical analogy
How to remember this solve
Think of the app like a packed suitcase. You unpack it, inspect the labels and hidden pockets, then trace which local file or network call contains the useful clue.
For APKey, keep the mental model simple: identify the trusted assumption, prove it with the smallest safe test, then automate or repeat only the part that directly leads to the flag.