0x11
← All write-ups
writeups://deadface-diagnosis-exported-activity Write-up

Write-up · DEADFACE CTF

Diagnosis: a Hidden Exported Activity in an APK Manifest

A DEADFACE CTF Android challenge. The APK ships a DiagnosticActivity declared android:exported="true" with no launcher intent-filter — invisible to the user but startable by any app — and its screen prints the flag. A second, guarded SecureVaultActivity plants a decoy flag to burn a blind grep; the manifest, not the grep, decides which one counts.

#mobile#android#apk#reverse-engineering#ctf

Challenge: Diagnosis (DEADFACE CTF) · Mobile / Android. Prompt: “One of De Monne’s developers suspects there is hidden activity occurring in the app, possibly due to manifest misconfigurations.” Flag format deadface{flag_text}. Artifacts: app-release.apk — an Android banking app (“De Monne Financial”), com.demonne.financial, two dex files. Flag: deadface{flaG_ManIfesT3d}

The APK ships a component that never appears in the launcher but is declared android:exported="true" in the manifest — com.demonne.financial.internal.DiagnosticActivity — and its diagnostic screen prints the flag. The decoy is a second flag-shaped string in SecureVaultActivity (deadface{Ur_N0t_A110wEd_h3r3}), planted to catch a blind grep for deadface{. The challenge name (“Diagnosis”) and the “manifest misconfigurations” hint both point at the exported-but-unlisted activity: the key move is reading AndroidManifest.xml to see which component is reachable by misconfiguration, then confirming its string over the decoy’s.

First contact

Establish the artifact and spot the binary manifest before decoding:

$ file app-release.apk app_extracted/AndroidManifest.xml
app-release.apk:                 Android package (APK)
app_extracted/AndroidManifest.xml: Android binary XML          (!)

$ unzip -l app-release.apk | grep -E 'classes|manifest'
classes.dex
classes2.dex                    (!)   two dex files — target pkg com/demonne/financial/
AndroidManifest.xml

Standard APK layout. The manifest is compiled binary XML, so it needs decoding (apktool/aapt) before it’s readable — and the “manifest misconfiguration” hint means that file is the objective, not a side quest.

The investigation

Decode the binary manifest

apktool fails on a fresh install because its framework dir doesn’t exist — a one-line fix, not a dead end:

$ apktool d app-release.apk -o app_decoded_full -f
Exception ... Could not create framework directory: ~/.local/share/apktool/framework

$ mkdir -p ~/.local/share/apktool/framework
$ apktool d app-release.apk -o app_decoded_full -f        # succeeds
# (aapt alternative: aapt dump xmltree app-release.apk AndroidManifest.xml)

This yields a readable AndroidManifest.xml plus smali, to pair with a jadx decompile for Java sources.

Grep the decompiled output for flag candidates

A broad sweep across both jadx and apktool output surfaces two deadface{...} strings (!):

$ grep -rniE "deadface\{" app_jadx/ app_decoded/
app_jadx/.../SecureVaultActivity.java:  deadface{Ur_N0t_A110wEd_h3r3}
app_jadx/.../internal/DiagnosticActivity.java:  deadface{flaG_ManIfesT3d}

Two hits means the flag string alone is not the answer — the manifest has to decide which component the challenge actually intends.

Read the hidden activity’s source

From app_jadx/sources/com/demonne/financial/internal/DiagnosticActivity.java:15:

((TextView) findViewById(R.id.tvDiagOutput)).setText(
    "build.version   : 2.4.1 (5)\n" +
    "build.env       : production\n" +
    "api.endpoint    : http://dmf.dctf.io:8081\n" + /* ... */
    "\n━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n" +
    "diagnostic.code : deadface{flaG_ManIfesT3d}\n" +
    "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n" +
    "\nstatus          : internal build — not for distribution\n");

Corroborated in smali at app_decoded/smali/com/demonne/financial/internal/DiagnosticActivity.smali:75 — a real, reachable string, not dead code.

Dead ends

  • SecureVaultActivity → deadface{Ur_N0t_A110wEd_h3r3} is the bait for a blind grep. Its own text (“Unauthorized access is a violation of De Monne Financial policy”) and its name both signal it’s guarded (signature permission / exported="false"), i.e. it is not the manifest misconfiguration the prompt describes. The flag text itself — “you’re not allowed here” — is the tell.
  • Treating the apktool framework error as a blocker. It’s a one-line mkdir fix; jadx output alone was already enough to find both strings.

The pivot

The connecting insight is the manifest, which breaks the tie between the two flag strings. DiagnosticActivity is declared exported but has no launcher intent-filter:

$ grep -B2 -A8 "DiagnosticActivity" app_decoded_full/AndroidManifest.xml
<activity android:name="com.demonne.financial.internal.DiagnosticActivity"
          android:exported="true" />          (!)  no <intent-filter>

exported="true" + no launcher intent-filter = a component invisible to the user but startable by any other app via an explicit intent — exactly the “hidden activity due to manifest misconfiguration” the prompt names. That is why DiagnosticActivity is the intended target and SecureVaultActivity (guarded) is the decoy: the manifest, not the grep, is the authority.

Extracting the flag

Static extraction (no device needed):

$ mkdir -p ~/.local/share/apktool/framework
$ apktool d app-release.apk -o app_decoded_full -f

# The misconfigured component
$ grep -A1 "DiagnosticActivity" app_decoded_full/AndroidManifest.xml
<activity android:name="com.demonne.financial.internal.DiagnosticActivity" android:exported="true" />

# Its flag string
$ grep -ro "deadface{[^}]*}" app_jadx/.../internal/DiagnosticActivity.java
deadface{flaG_ManIfesT3d}

Or trigger it live on a device/emulator (the exported misconfiguration is what makes this possible):

$ adb shell am start -n com.demonne.financial/.internal.DiagnosticActivity
# the diagnostic screen renders the flag

deadface{flaG_ManIfesT3d}

Takeaways

  • The manifest is the first file to read on any APK. An activity with android:exported="true" and no launcher intent-filter is invisible to users but launchable by any app (OWASP Mobile M1 — Improper Platform Usage); the component list tells you what’s reachable before any decompiling.
  • A flag-shaped string is a candidate, not an answer. When grep returns more than one deadface{...}, let the prompt and the manifest disambiguate — here a guarded SecureVaultActivity was deliberately planted to burn a blind grep.
  • Cross-check Java against smali. Confirming the flag string appears in both the jadx decompile and the apktool smali rules out dead code or a fake string left to mislead.
  • A tool error is rarely the end of the road. apktool’s missing-framework-dir failure is a one-line mkdir; and jadx alone would have carried the whole analysis if apktool were unavailable.
  • What a careful developer would have avoided: shipping a debug/diagnostic activity in a production build at all, and if it must exist, marking it exported="false" (or guarding it with a signature-level permission) so it can’t be launched out of context.
// EOF ← All write-ups