critical · M1 · MASVS-CRYPTO-1 · PTKD-CRED-SECRET
Hardcoded secret in the app
A credential is embedded in the app and is trivially recoverable by unpacking it.
How it is exploited
Anyone can download your APK/IPA and run strings on it. A hardcoded API key, AWS credential, or private key is extracted in seconds and reused from an attacker's own scripts, far from your app's rate limits.
Why it matters
Cloud bills run up on your keys, backend data accessed as "the app", and rotation is painful because the secret ships inside every installed copy.
How to fix it
- Revoke and rotate the exposed secret now; assume it is public.
- Move the capability server-side: the app calls your backend, the backend holds the secret.
- For unavoidable client keys (analytics, maps), restrict them by package name/bundle id and scope them to the minimum permission.
Does your app have this?
PTKD checks your build or your source project for PTKD-CRED-SECRET and every other check in this knowledge base.
Scan your appReferences
Related checks (M1)
- Secret returned in an API response
- App code calls Supabase admin APIs, so the service-role key ships in the app
- Credential passed in a URL
- Hardcoded secret sent on the wire
- Secret written in eas.json
- A .env file ships inside the app
- Secret .env file is not ignored by git
- Secret in the Expo app config `extra`, which ships inside the app