All vulnerabilities
HIGHSecretsexploited in the wild

SECRET-CLIENT-EMBEDDED

Secrets · Mobile · Secrets embedded in client-side and mobile apps

Summary

Any secret shipped to code that runs on a user's device is public by definition, because the user controls the runtime and can read everything in it. API keys and cloud credentials in a JavaScript front-end sit in plaintext inside the served bundle and are visible via browser dev tools or by downloading the .js file, while keys compiled into mobile apps are recoverable by unzipping the APK/IPA and decompiling with tools like apktool, jadx, or strings to dump embedded constants. Symantec's threat-hunting team found over 1,800 mobile apps with hardcoded AWS credentials, mostly on iOS, and 77% contained valid, live AWS access tokens granting access to private cloud services, with nearly half exposing S3 buckets holding millions of files (September 2022). CloudSEK separately reported roughly one in 200 mobile apps leaking hardcoded private keys, including 40-plus apps with over 100 million combined downloads. The fix is architectural: secrets must live on a backend the client authenticates against, never in the shipped artifact.

How to avoid it in your code

  • Never embed long-lived API keys or cloud credentials in front-end bundles or mobile binaries; proxy calls through a backend.
  • Issue short-lived, scoped tokens to clients via an authenticated server endpoint instead of static secrets.
  • Scan built APK/IPA and JS bundles with Trufflehog or MobSF before release to catch embedded keys.
  • Rotate any key ever shipped client-side and restrict it with IP, referrer, or scope limits.
  • Apply least-privilege IAM so a leaked client key cannot reach sensitive cloud resources.

References

Related vulnerabilities

All Secrets →