M1: Improper Credential Usage

Hardcoded secrets, API keys, and tokens embedded directly in an application binary or source, rather than provisioned at runtime.

Why It Matters

A hardcoded credential is retrievable by anyone who obtains the binary — no privileged access or runtime exploitation required. It is one of the highest-yield findings for an attacker per unit of effort, and one of the most common mistakes in mobile codebases.

Application to Application Security

Covers API keys, backend service credentials, encryption keys, and OAuth client secrets embedded in strings.xml, Info.plist, source literals, or native libraries — anywhere a value is compiled in rather than fetched from a secrets manager or provisioned per install.

Relation to Software Development

Usually introduced for convenience during prototyping and never removed before release, or copied from a backend .env file into client code without recognizing that the client binary is not a trusted execution environment.

How Strata Surfaces This

APK scans run 11 credential patterns (AWS, Google API, Stripe, GitHub, SendGrid, Twilio, Slack and Mapbox keys, JWTs, private-key headers, and generic key, token, secret or password assignments) over the full DEX string pool. IPA scans run the same 11 patterns over printable strings from the main app binary. Each match is reported as an M1 finding. Repository scans use a separate rule set that adds entropy thresholds, and cover the current tree only: Strata does not scan git history.

Developer guidance

Never compile a secret into client code. Use a secrets manager or a backend-issued, short-lived token fetched at runtime, and add a pre-commit or CI secret-scanning gate so a leaked credential is caught before merge, not after release.

Management guidance

Ask whether secret scanning runs in CI on every pull request, not just as a periodic manual audit — the gap between introduction and detection is where the real risk lives.

Related OWASP Items
Related CWEs
CWE-798CWE-321
Related ATT&CK Techniques
OWASPM1Improper Credential UsageSource ↗