Skip to content
Back to skills

Mobile Security Review

ASecurity

Use when reviewing a Kotlin Multiplatform, Android or iOS app or change for security — secrets in source, BuildConfig or Info.plist, tokens or PII in logs, cleartext, ATS exceptions, certificate pinning, WebView bridges, deep links, universal links, intents, PendingIntent, exported components, Keychain or Keystore storage, logout wipe, backups, screenshots, clipboard, debug bypasses in release, LLM or AI features, OWASP MASVS, MASWE or MASTG. Not for Android-only intent, permission or JNI aud...

  • 17 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
developmentjavascriptrustgojavaswiftkotlinshellbashsqltesting

Works with

  • cursor
  • cli
  • api

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned December 3, 2026

npx -y skills add Kushpawan/kmp-mobile-skills --skill mobile-security-review --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Mobile Security Review?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Mobile Security Review
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/kushpawan-mobile-security-review/badge)](https://www.skillsdirectory.com/skills/kushpawan-mobile-security-review)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: mobile-security-review
description: Use when reviewing a Kotlin Multiplatform, Android or iOS app or change for security — secrets in source, BuildConfig or Info.plist, tokens or PII in logs, cleartext, ATS exceptions, certificate pinning, WebView bridges, deep links, universal links, intents, PendingIntent, exported components, Keychain or Keystore storage, logout wipe, backups, screenshots, clipboard, debug bypasses in release, LLM or AI features, OWASP MASVS, MASWE or MASTG. Not for Android-only intent, permission or JNI audits (android-intent-security, android-permissions-security, android-jni-security).
license: Apache-2.0
compatibility: Kotlin Multiplatform, Android or iOS project in git. Optional tools — gitleaks, apkanalyzer (Android SDK command-line tools); iOS checks need macOS with Xcode.
metadata:
  category: review
  platforms: android, ios
---

# Mobile security review

Review a mobile change or app against the threat model of a shipped binary, keyed to OWASP MAS:
a **MASVS 2.1** control, the **MASWE 1.0** weakness that breaks it, and the **MASTG v2** test that
checks it. That model is not a server's: the device may be controlled by the attacker, everything in
the APK or IPA is readable, and the client cannot enforce authorisation — only the server can.

Three rules carry the skill. **Confirm every hit is reachable in a release build** before reporting
it. **Never print a secret's value** — not in the report, a command or a commit message. **Obfuscation
is not a mitigation** for anything that ships in the binary.

## When to use

- A change touches auth, tokens, storage, networking, WebViews, deep links, intents, manifests,
  `Info.plist`, entitlements, app extensions, build types, ProGuard/R8 rules, or an LLM feature.
- Before a release, or when asked for a security review, a MASVS check or a pre-pen-test sweep.
- A `targetSdk` bump to 36 or 37 — Android 16 and 17 change intent, TLS, screen-capture and
  native-loading behaviour (Quick reference).
- A scanner or store review flagged something and you need to know whether it is real.

## When not to use

- General correctness review — use `kmp-code-review` (run both on security-sensitive changes).
- Known-vulnerable dependencies, lockfiles, dependency verification, SBOMs, secret scanning in CI —
  use `kmp-dependency-security`.
- Storing tokens or keys (implementation, not review) — use `kmp-secure-storage`.
- Android vs iOS behaviour differences — use `mobile-platform-parity`.
- A deep Android-only audit of intents and components, permissions and IPC, or JNI — Google's
  `android-intent-security`, `android-permissions-security` and `android-jni-security` skills go
  further on those; keep this skill for the cross-platform view.
- Backend authorisation, tenant isolation or API rate limits — those are server reviews.
- Dynamic testing on a device (Frida, proxies, root bypasses) — see the OWASP MASTG; this skill
  reviews source and build output.

## Step 0 — Read the project first

Before searching, learn where security-relevant decisions live in *this* project:

1. **Rules.** `SECURITY.md`, `AGENTS.md`, `CLAUDE.md`, `CONTRIBUTING.md`, `.cursor/rules/*`,
   `.github/copilot-instructions.md`. A documented rule makes a finding Tier 1.
2. **Build variants and targets.** Android `buildTypes`, `productFlavors`, `src/debug/`,
   `debugImplementation`, and `minSdk` / `targetSdk` (target-gated checks depend on them); iOS build
   configurations, per-configuration `.xcconfig` and `Info.plist`, `#if DEBUG`. Note how shared
   Kotlin code learns "debug" on iOS — it has no `BuildConfig`.
3. **Stack.** Storage (DataStore, Room, SQLDelight, a settings library, Keychain wrappers),
   networking (Ktor engines, OkHttp, `URLSession`), logger and crash/analytics SDKs, auth and token
   refresh, the logout path, WebViews, deep link routing, and any model SDK or LLM endpoint.
4. **Entry points.** The merged release `AndroidManifest.xml`, `Info.plist` URL types, associated
   domains and App Groups in the entitlements, app extensions, push and notification handlers.

Done when you can name the release variants, the `targetSdk`, where tokens are stored, and the
function that logs out.

## Workflow

### 1. Choose the scope

- **Change review:** the uncommitted and unmerged changes (resolve the base the same way
  `kmp-code-review` does), plus the unchanged configuration they depend on — a new endpoint means
  reading the network security config and ATS settings too.
- **Whole-app audit:** every source set, both manifests and plists, build files, ProGuard/R8 rules,
  extensions and CI secrets handling. State that the audit is static and source-based.

Print the scope line: `scope=change · base=origin/main · 12 files + 3 config files` or
`scope=audit · modules: composeApp, shared, iosApp · targetSdk=37`.

### 2. Inventory the attack surface

| Surface | Android | iOS | Shared Kotlin |
|---|---|---|---|
| Entry points | Merged manifest: exported components, intent filters, providers, PendingIntents | URL types, associated domains, `onOpenURL`, user activities, extensions | Deep link parser, push payload handling |
| Storage | Preferences, DataStore, databases, files, Keystore | `UserDefaults`, Keychain, files, App Group containers | Repository and cache layers, logout |
| Network | Network security config (cleartext, CT, ECH, pins), engine config | ATS keys, `URLSession` / Darwin engine config | `HttpClient` setup, auth plugin, logging plugin |
| Web content | `WebView` settings, JS interfaces | `WKWebView` configuration, message handlers | URLs built for web content |
| AI features | On-device model files, model SDK keys | Core ML / on-device model files | Prompt building, tool calls, output handling |
| Build output | Build types, R8 rules, `BuildConfig` fields | Entitlements, build settings, privacy manifest | Generated constants, debug flags |

### 3. Sweep, then read

Run a first-pass search, then load [references/lens-security.md](references/lens-security.md) and
apply every row whose condition holds. Each row lists the tokens to grep for and its MASVS, MASWE
and MASTG ids.

```bash
# High-yield first pass. Prints file:line only — never pipe secret matches into a chat or ticket.
grep -rnIE --include='*.kt' --include='*.kts' --include='*.swift' --include='*.xml' \
  --include='*.plist' --include='*.xcconfig' --include='*.properties' --include='*.toml' \
  'usesCleartextTraffic|cleartextTrafficPermitted|certificateTransparency|domainEncryption|NSAllowsArbitraryLoads|checkServerTrusted|onReceivedSslError|HostnameVerifier|exported="true"|allowBackup|addJavascriptInterface|allowUniversalAccessFromFileURLs|setWebContentsDebuggingEnabled|isDebuggable|storePassword|BEGIN (RSA |EC )?PRIVATE KEY|LogLevel\.(ALL|HEADERS|BODY)|UserDefaults|getSharedPreferences|FLAG_MUTABLE|removeLaunchSecurityProtection|MODE_BACKGROUND_ACTIVITY_START_ALLOWED|setContentCaptureEnabled|System\.load\(|READ_SMS' . \
  | grep -v '/build/' | cut -d: -f1,2
```

Then read every hit in context. The search finds candidates; reading decides findings.

### 4. Confirm release reachability

For each candidate, decide whether it exists in what users install:

- **Source set and build type:** code in `src/debug/`, a `debugImplementation` dependency, or Swift
  inside `#if DEBUG` does not ship. Code in `commonMain` or `src/main` does.
- **Runtime gates:** a check on a value set from remote config, a stored preference, a hidden
  gesture or a launch argument is reachable in release. Only compile-time gates remove code.
- **Merged configuration:** a library can add an exported component, a permission or a cleartext
  exception the app's own manifest does not show. Check the merged manifest of the release build.
- **Target gates:** an Android 16/17 behaviour applies only at that `targetSdk` (or on that OS for
  all-apps changes). Report a target-gated item as "breaks or weakens when targetSdk reaches N".
- **Shipped secrets:** a value injected at build time into `BuildConfig`, generated constants,
  resources or `Info.plist` is in the binary. Decide whether it is *meant* to be public (a key
  restricted by package and signature) or grants privilege (a server secret, a model API key).

### 5. Rate and try to disprove

Set severity no lower than the row's floor. Then, for every Critical and High, argue against it: Is
the input really attacker-controlled? Does the server enforce the check anyway? Is the branch
compiled out of release? Does a platform default already block it (cleartext is off by default from
target 28; certificate transparency is on by default at target 37; Android 16 hardens nested-intent
launches unless `removeLaunchSecurityProtection()` is called; ATS blocks plain HTTP unless an
exception exists)? Mark survivors `CONFIRMED`; downgrade or drop the rest.

### 6. Report

Emit one JSON object per line (the `kmp-code-review` findings schema), then the human report grouped
by MASVS category, most severe first.

```json
{"file":"composeApp/src/main/res/xml/network_security_config.xml","line":4,"severity":"High","tier":2,"lens":"security/userCAsTrustedInRelease","title":"User-installed CAs trusted in release","why":"certificates src=\"user\" sits in base-config, so any user-added CA can intercept API traffic in production builds","fix":"move the user trust anchor into <debug-overrides>","rule":"User CAs trusted in release","masvs":"MASVS-NETWORK-1","maswe":"MASWE-0027","mastg":"MASTG-TEST-0286","verdict":"CONFIRMED"}
```

Fields: `file`, `line`, `severity` (`Critical` · `High` · `Medium` · `Low`), `tier` (`1` project rule ·
`2` lens row), `lens` (`security/<lensName>`), `title`, `why`, `fix`, `rule`, `masvs` (full id, always),
`maswe` and `mastg` (full ids from the lens row; omit a field rather than guess), `verdict`
(`CONFIRMED` · `PLAUSIBLE`; every Critical and High is `CONFIRMED`). AI rows put the
`LLM0n:2025` id in `rule`. Finish with `reviewed: <n> files · <m> findings`. "No findings" is a
valid result; list what was covered so it means something.

**IDs.** Take MASWE ids from MASWE 1.0.0 (via the lens or mas.owasp.org), never from a MASTG v2.0.0
test page, which still shows pre-1.0 numbers. Cite MASTG v2 tests (`MASTG-TEST-0200` and up), never
v1 tests or `MSTG-*` ids. Link OWASP pages; do not paste their text (CC-BY-SA).

Human report, per finding: severity, `file:line`, the MASVS control and MASWE id, why it is
exploitable, the fix, and whether it needs a server-side change too. For a secret, give its type and
location only, and say: **rotate it** — deleting the line does not remove it from git history or
from builds already shipped.

### 7. Offer fixes

Ask which findings to fix. KMP-shaped fixes are split by where the code lives:

- [references/fix-patterns-shared.md](references/fix-patterns-shared.md) — `SecureStore` interface,
  build-time debug flag, HTTP logging and auth scope, deep link parsing, logout wipe, AI features.
- [references/fix-patterns-android.md](references/fix-patterns-android.md) — network security config
  (cleartext, CT, ECH, pins), backups, `FLAG_SECURE`, clipboard, intents and PendingIntents, URI
  grants, background launches, `System.load()`, SMS codes, debug tooling.
- [references/fix-patterns-ios.md](references/fix-patterns-ios.md) — Keychain, ATS and pinning,
  backups and file protection, app-switcher cover, pasteboard, universal links, `WKWebView` bridges,
  app extensions, keyboards and share sheets.

**Stop and ask before** touching signing configuration, keystores, provisioning profiles or CI
secrets, and leave secret rotation to the user — it happens outside the repository.

## Quick reference

| MASVS group | Key MASWE | What to check in a KMP app |
|---|---|---|
| STORAGE-1/2 | 0001–0006 | Token storage per platform, logs and crash keys, backups, shared and App Group storage |
| CRYPTO-1/2 | 0003, 0007, 0013 | Keys in the Keystore / Keychain, no literal keys, one master key (Android 17 key cap) |
| AUTH-1/2/3 | 0020–0024 | Refresh handling, header scope, biometric fall-through and binding, logout wipe |
| NETWORK-1/2 | 0026–0028 | Cleartext, ATS, trust managers and challenge handlers on **both** engines, CT/ECH, pins |
| PLATFORM-1/2/3 | 0018, 0029–0039 | Exported components, links, intents, PendingIntents, WebViews, screenshots, overlays |
| CODE-1..4 | 0043, 0049, 0050 | Input validation (paths, SQL, deserialization), dynamic loading, update enforcement |
| RESILIENCE-1..4 | 0059, 0061, 0063 | Debug flags and tooling compiled out, `debuggable` off, R8 on — defence in depth only |
| PRIVACY-1..4 | 0066–0078 | Permissions, SDK consent, identifiers, privacy manifest, account deletion |

**Android 16 and 17 checks** (target 36 / 37 unless marked *all apps*):

| Change | What to look for |
|---|---|
| Intent redirection hardening (16) | `removeLaunchSecurityProtection()` calls; nested intents started without `IntentSanitizer` |
| Background launches via `IntentSender` (17) | `MODE_BACKGROUND_ACTIVITY_START_ALLOWED` → `…_ALLOW_IF_VISIBLE` |
| `usesCleartextTraffic` deprecation planned (17, all apps) | Attribute still set with `minSdk` ≥ 24 — move rules into the network security config |
| Implicit URI grants end in Android 18 (announced in 17) | `ACTION_SEND` / `ACTION_SEND_MULTIPLE` / `ACTION_IMAGE_CAPTURE` without explicit grant flags |
| Certificate transparency on by default; ECH (17) | `<certificateTransparency enabled="false"/>`, `<domainEncryption mode="disabled"/>` |
| Content capture (17) | `setContentCaptureEnabled(false)` relied on — use `FLAG_SECURE` |
| Safer native loading (17) | `System.load()` of a writable or downloaded file |
| SMS OTP delay (17; WebOTP format for all apps) | `READ_SMS` / `SMS_RECEIVED` parsing — use SMS Retriever or User Consent |
| Local network permission (17) | LAN discovery or sockets without `ACCESS_LOCAL_NETWORK` or a system device picker |
| Keystore key cap (17, all apps) | A key per record — see `kmp-secure-storage` |

| Severity | Consequence |
|---|---|
| **Critical** | Credential or session exposure, auth bypass, remote code or script execution, user data readable by other apps or users |
| **High** | Exploitable with a precondition (malicious app installed, network position, user tapping a link), or PII exposure |
| **Medium** | Hardening gap with limited impact, or a privacy-compliance gap |
| **Low** | Defence-in-depth, hygiene, or a target-gated item not yet in force |

## Verify

Run what applies and report each as `PASS`, `FAIL` or `NOT RUN — <reason>`. Never claim a scan that
did not run; a missing tool is `NOT RUN — gitleaks not installed`.

```bash
# Secrets in history and working tree (gitleaks 8.19+; older versions: gitleaks detect --redact)
gitleaks git --redact .
gitleaks dir --redact .

# What the release APK really contains — merged manifest and string constants
./gradlew :composeApp:assembleRelease
apkanalyzer manifest print <release.apk> | grep -nE 'exported="true"|allowBackup|usesCleartextTraffic|debuggable|targetSdkVersion'
unzip -p <release.apk> 'classes*.dex' | strings | grep -ciE 'api[_-]?key|secret|bearer'   # count only

# iOS build output (macOS)
plutil -p <App>.app/Info.plist | grep -nE 'NSAppTransportSecurity|NSAllowsArbitraryLoads|CFBundleURLSchemes'
codesign -d --entitlements - <App>.app

# Release logs while signing in — no tokens, no PII
adb logcat --pid=$(adb shell pidof -s com.example.app)
xcrun simctl spawn booted log stream --level debug --predicate 'subsystem BEGINSWITH "com.example.app"'
```

Dependency advisories (OSV-Scanner, lockfiles, SBOM) are verified by `kmp-dependency-security`;
report them here as `NOT RUN — out of scope, see kmp-dependency-security` unless that skill ran.

## Common mistakes

| Mistake | Why it bites | Fix |
|---|---|---|
| Reading `src/main/AndroidManifest.xml` only | Libraries merge in exported components, permissions and network config | Review the merged release manifest |
| "It's injected from CI, so it's secret" | Build-time injection keeps a value out of git, not out of the binary | Privileged secrets (and model API keys) stay on a server; the app gets short-lived tokens |
| Reverting a committed secret | It stays in git history and in every build already shipped | Rotate it, then remove it |
| Gating a bypass on a runtime flag | Remote config, stored settings and hidden menus are reachable in release | Compile it out: `src/debug`, `debugImplementation`, `#if DEBUG` |
| Fixing pinning or TLS on one engine | Android uses OkHttp/the platform stack, iOS uses `URLSession` — configured separately | Check both engines for every transport finding |
| Pinning with one pin and no expiry | The next certificate rotation locks every installed copy out | Backup pin, an expiry, or no pinning by decision |
| Treating `allowBackup="false"` as complete | Device-to-device transfer still runs on some devices for apps targeting API 31+ | Exclude sensitive files in `dataExtractionRules` too |
| Relying on `setContentCaptureEnabled(false)` | Ignored from target 37; on-device AI can read the screen | `FLAG_SECURE` on sensitive windows |
| Calling `removeLaunchSecurityProtection()` to make a flow work | Re-opens the intent redirection Android 16 closed | Sanitize the nested intent; opt out only with a written reason |
| Citing a MASWE id from a MASTG v2.0.0 test page, or a v1 test number | MASWE 1.0 renumbered; v1 tests are unmaintained — the reader lands on the wrong weakness | Lens ids or the current mas.owasp.org page; omit when unsure |
| Treating LLM output as trusted | Prompt injection turns it into attacker-controlled HTML, URLs or tool calls | Escape and validate output; confirm state-changing tool calls |
| Assuming Keychain items die with the app | They can survive uninstall and resume the previous user's session | First-launch check that clears the Keychain |
| Logout that clears only the token | Databases, caches, WebView cookies, chat history and scheduled work keep the user's data | One shared logout that wipes every store |
| Accepting root detection or obfuscation as the fix | Both are bypassable; they raise cost, they do not protect a shipped secret | Fix the underlying exposure |

## Related skills

- `kmp-code-review` — the general review; its findings schema (with `masvs`, `maswe`, `mastg`) is the
  one used here.
- `kmp-dependency-security` — vulnerable dependencies, lockfiles, dependency verification, SBOM,
  Dependabot and secret scanning in CI.
- `kmp-secure-storage` — implementing the token store the storage findings ask for.
- `mobile-platform-parity` — security controls present on only one platform.
- Google [android/skills](https://github.com/android/skills): `android-intent-security`,
  `android-permissions-security`, `android-jni-security` (Android-only deep dives) and
  `play-policy-insights` (Play policy and Data safety).
- Apple `audit-xcode-security-settings` — an agent skill exported by Xcode 27 that audits Xcode
  project security settings; use it alongside this review for build settings on the iOS side.
- [Trail of Bits `firebase-apk-scanner`](https://github.com/trailofbits/skills/tree/main/plugins/firebase-apk-scanner)
  — Firebase misconfiguration in a built APK, for authorised testing (CC-BY-SA; link only).
- OWASP: [MASVS](https://mas.owasp.org/MASVS/), [MASWE](https://mas.owasp.org/MASWE/),
  [MASTG tests](https://mas.owasp.org/MASTG/tests/),
  [Top 10 for LLM Applications 2025](https://genai.owasp.org/llm-top-10/); Android
  [intent redirection](https://developer.android.com/privacy-and-security/risks/intent-redirection)
  and [AI risks](https://developer.android.com/privacy-and-security/risks/ai-risks/risks-mitigations).
- [OWASP secure-agent-playbook](https://github.com/OWASP/secure-agent-playbook) — mobile code review
  play for native apps.
- [ivan-magda/swift-security-skill](https://github.com/ivan-magda/swift-security-skill) — Keychain,
  biometrics and CryptoKit on Apple platforms.

Files in this skill

  • SKILL.md19.6 KB
  • references/fix-patterns-android.md9.2 KB
  • references/fix-patterns-ios.md7.1 KB
  • references/fix-patterns-shared.md8.4 KB
  • references/lens-security.md28.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.