--- name: android-logcat-clipboard-leakage description: Detect runtime information leakage on Android — secrets/PII in logcat, sensitive data left on the clipboard, and task-switcher snapshots of sensitive screens missing FLAG_SECURE. Tier 1. Use while dynamically exercising the app. Aligns to OWASP MASTG MASVS-STORAGE/PLATFORM. --- # Android Logcat, Clipboard & Screenshot Leakage Watch what the app leaks at runtime: logs, the clipboard, and background snapshots. ## Trigger phrases `logcat, pidcat, clipboard leak, flag_secure, screenshot leak, task switcher snapshot, backgrounding leak, sensitive data in logs` ## Method 1. **Logcat:** while exercising login/payment/token flows: - `adb logcat | grep -i ` or `pidcat ` - Hunt for tokens, passwords, session IDs, PII, full requests/responses, stack traces with secrets. 2. **Clipboard:** copy a credential/OTP in-app, then: - `adb shell dumpsys clipboard` (older APIs expose contents directly). - Check whether the app auto-clears sensitive clipboard data after a timeout, and whether it allows copy on password fields. 3. **Screenshot / backgrounding snapshot:** open a sensitive screen, press Home/Recents: - Check the task-switcher thumbnail for readable sensitive data. - Root: inspect `/data/system_ce/0/snapshots` for the cached snapshot. - Grep decompiled code for `FLAG_SECURE` — absence on sensitive activities = leak. ## Modern / rare techniques - **Clipboard read by other apps:** on pre-Android-10 any app reads the clipboard silently; a copied OTP/password is cross-app disclosure. - **Crash/ANR logs & third-party SDK logging** (analytics/crash reporters) often re-log full request bodies with tokens — check their log tags too. - **Snapshot persistence:** the Recents snapshot survives until the task is cleared; without `FLAG_SECURE` it is a forensic artifact of the last sensitive screen. ## Escalation / chaining Logged/clipboard tokens → replay against the backend (`android-backend-api-testing`); confirms weak handling that compounds `android-insecure-storage` findings. ## Backend & tooling Preferred Kali path (native Kali / WSL+Kali / Kali-SSH / Kali-MCP / HexStrike). Needs the user's device/emulator (adb/logcat; root for snapshots dir) + Kali tooling (pidcat/objection). Windows-local last resort. See `zazy-orchestrator`. ## Verification (background, before reporting) Reproduce the leak at least twice (secret appears in logs/clipboard/snapshot on repeat) and confirm the leaked value is genuinely sensitive/live before marking CONFIRMED. ## Evidence The logcat line / clipboard dump / snapshot showing the secret (redacted), the triggering action, and the missing control (`FLAG_SECURE`, no clipboard clear). Remediation: strip logs in release (R8); avoid clipboard for secrets or auto-clear; set `FLAG_SECURE` on sensitive activities.