Every mobile app binary can be downloaded, decompiled and modified by anyone, so whatever it contains, keys, business logic, AI models or licence checks, should be assumed exposed unless the design accounts for it. OWASP lists this as M7 Insufficient Binary Protection in the Mobile Top 10 2024 and rates it as easy to exploit and common. This guide explains what M7 covers, how it maps to the four MASVS-RESILIENCE controls, and how to combine obfuscation, integrity checks and platform attestation (Google Play Integrity API and Apple App Attest) with server-side enforcement. It is written from the defender's side for mobile developers, application security engineers and fraud teams deciding how much protection an app needs; it does not describe how to reverse engineer apps. For the full list see the OWASP Mobile Top 10 Guide.
Key takeaways
- Every app is exposed. OWASP states that binaries are easy to obtain from stores or devices, and that risk rises when an app is popular or hard-codes sensitive data or algorithms.
- Protection raises cost, it does not make code secret. The stated goal of countermeasures is to make cracking cost more than the attacker would gain; obfuscation and native code reduce likelihood but never eliminate it.
- Absence of resilience is not itself a vulnerability. MASVS says so explicitly: resilience controls sit on top of the rest of MASVS and must never replace sound architecture, strong cryptography and server-side validation.
- Attestation decisions belong on the server. Apple notes that an app cannot rely on its own logic to check itself because a compromised app can falsify results, and Google recommends enforcing Play Integrity verdicts on the backend with graded outcomes.
- Remove what should not be there. The cheapest M7 fix is to stop shipping paid API keys, unprotected models and client-side-only licence checks, because a backend control does not depend on the binary staying intact.
What it is and who it applies to
The OWASP risk page (headed M7 Insufficient Binary Protection; the Top 10 list uses the plural "Protections") describes two attack types against the app binary: reverse engineering, decompiling the app to find secret keys, algorithms or vulnerabilities, and code tampering, modifying it to remove licence checks, bypass paywalls or insert malicious code. Attacker motives listed by OWASP include stealing commercial API keys and hard-coded cryptographic material, extracting business logic or pre-trained AI models, probing for backend weaknesses, unlocking paid features, and redistributing modified popular apps, for example with payment identifiers swapped so payments go to the attacker.
| Factor | OWASP rating | Notes from the risk page |
|---|---|---|
| Exploitability | Easy | Binaries are freely available from stores and devices. |
| Prevalence | Common | Every app is exposed; apps with sensitive data or algorithms most of all. |
| Detectability | Easy | Fully compiled iOS apps are generally harder to analyse than Android bytecode, but cross-platform frameworks such as Flutter and PWAs may not follow this pattern. |
| Technical impact | Moderate | Leaked secrets, revealed backend weaknesses, arbitrary behaviour changes that can disrupt unhardened backends. |
| Business impact | Moderate | Large bills from abused API keys, cloned features, theft of algorithms or models, reputational harm from malicious copies. |
Who it applies to: all mobile publishers, but the right level of protection varies sharply. Banking, payments, gaming, subscription and apps that carry proprietary models have strong business reasons to invest; MASVS lists theft of algorithms and AI models, fraud, cheating and revenue leakage among them. MASVS also records the opposite case: for government, health and other public-interest apps, obfuscation reduces transparency and independent verification, and platform checks can exclude legitimate users. There it recommends open source distribution, security that rests on verifiable design and server-side validation, and controls that do not hinder legitimate analysis.
Choosing a protection level
| App profile | Typical approach | Trade-off |
|---|---|---|
| Public-interest or open source app | No obfuscation beyond build shrinking; server-side validation; signed releases | Maximum transparency; client-side abuse handled by the backend |
| Ordinary consumer or enterprise app | Release shrinking and renaming, no embedded secrets, platform attestation on sensitive calls | Low cost, low false-positive risk |
| Payments, banking, high-value subscriptions | Attestation on every sensitive request, integrity and environment checks reported to the server, stronger obfuscation of sensitive modules | More build complexity and support load from blocked devices |
| Games, apps embedding proprietary models or paid content | Move valuable assets server-side where possible; layered anti-tamper and anti-analysis on what must ship; redistribution monitoring | Highest cost; protections can break libraries that rely on names or strings |
Structure and key requirements
MASVS turns M7 into four testable controls. Our OWASP Mobile Top 10 Guide maps M7 to all four.
| Control | Statement (MASVS) | Defensive intent | Typical implementation |
|---|---|---|---|
| MASVS-RESILIENCE-1 | The app validates the integrity of the platform. | Detect a compromised OS whose security features (secure storage, biometrics, sandboxing) cannot be trusted. | Play Integrity device labels; App Attest; environment checks reported to the server. |
| MASVS-RESILIENCE-2 | The app implements anti-tampering mechanisms. | Prevent running or redistributing a modified copy. | Signature and package checks, Play Integrity appRecognitionVerdict, App Attest assertions, resource integrity checks. |
| MASVS-RESILIENCE-3 | The app implements anti-static analysis mechanisms. | Make it hard to understand how the app works from the binary. | R8 renaming and shrinking, string and control-flow obfuscation, native compilation of sensitive parts. |
| MASVS-RESILIENCE-4 | The app implements anti-dynamic analysis techniques. | Make runtime observation and instrumentation harder. | Debugger and instrumentation detection, runtime application self-protection (RASP), with results sent to the server. |
Platform attestation in brief
- Google Play Integrity API: returns
appIntegrity(appRecognitionVerdictshould bePLAY_RECOGNIZED),accountDetails(appLicensingVerdictshould beLICENSED) anddeviceIntegritylabelsMEETS_STRONG_INTEGRITY,MEETS_DEVICE_INTEGRITYandMEETS_BASIC_INTEGRITY. Standard requests are low latency with replay protection by Google usingrequestHash; classic requests are for infrequent high-value actions and the developer implements replay protection with anonce. Optional verdicts includeappAccessRiskVerdictandplayProtectVerdict. - Apple App Attest:
DCAppAttestServicegenerates a key in the Secure Enclave per user account per device (generateKey), has Apple certify it against a server challenge of at least 16 bytes (attestKey), then signs sensitive requests (generateAssertion). CheckisSupportedand design a fallback. Keys survive updates but not reinstallation, device migration or restore from backup. Apple's server can return a risk metric: the approximate number of attested keys for the app on a device over the past 30 days, where an unexpectedly high count may indicate one compromised device serving many app instances.
MASVS warns that relying on these services, or on checks for specific Android flavours, creates platform lock-in that can exclude legitimate users on other operating system builds. Plan the fallback for users without Google Play services or unsupported devices before enforcing.
Identity and NHI requirements
M7 is, at heart, a machine identity problem: the app is a non-human client, and binary protection is about whether the backend can trust that client and the credentials it carries.
- No long-lived secrets in the binary: OWASP's first example scenario is a paid API key extracted from an unprotected binary and misused or sold; because the API relied only on that key, the provider faced large costs or rate-limited its real users. Obfuscating the key only delays this. Use a backend proxy, or short-lived per-session tokens issued after user authentication and attestation. See the OWASP Mobile Top 10 M1 Improper Credential Usage Guide and the API Key Management Guide.
- Attestation as client identity: an App Attest key or a Play Integrity verdict bound to a request hash gives the server evidence that the caller is a genuine, unmodified instance of the app. Bind issued tokens to that evidence and to the user session, not to a static app key.
- Per-user, per-device keys: Apple advises against reusing an App Attest key across users on a device because it hides the pattern of one compromised device serving many remote users. Treat the attested key like any machine credential: unique, tracked and revocable.
- Signing keys: the integrity of every check depends on the app signing key. Protect it as a high-value non-human credential. See the Code Signing Security Guide.
Implementation steps
- Assess what the binary is worth. Following OWASP, list the critical content (keys, algorithms, models, licence logic, payment identifiers) and the app's popularity, then rank risks by financial impact in a threat model. Apps should receive only the minimum information they need.
- Move assets server-side. Remove paid API keys, replace client-only licence checks with server-issued entitlements, and serve premium content or model inference from the backend where latency allows. OWASP advises releasing protected resources only after both local and backend checks pass.
- Enable build-level hardening. On Android, turn on R8 for release builds (
isMinifyEnabled = trueandisShrinkResources = true, oroptimization { enable = true }on newer Android Gradle Plugin versions) so unused code is removed and names are shortened. Add keep rules only where reflection requires them, and archive the mapping file for each release so crash reports can be deobfuscated. Strip symbols and debug flags from iOS release builds. - Add platform attestation in observe mode. Integrate Play Integrity and App Attest, send verdicts and assertions to the server, and log outcomes without blocking. Apple publishes separate guidance on ramping App Attest for apps with very large user bases; follow it before enabling at scale.
- Define graded server responses. Google recommends a range of outcomes (allow, allow with limits, allow with limits after a challenge, deny) rather than a binary decision. Validate
requestDetails, app recognition and licensing first, then tier by device label. For App Attest, verify the attestation chain to Apple's App Attest root, the App ID, and the challenge, and check assertion counters. - Layer in-app protections where justified. For high-value apps add integrity, environment and instrumentation checks, and stronger obfuscation of sensitive modules. Report detections to the server rather than only crashing locally, because OWASP notes attackers may find and disable local integrity checks. Test that obfuscation does not break libraries that depend on specific class names or strings.
- Pilot and enforce gradually. Enforce first on the highest-value actions (payments, payout changes, premium downloads) for a pilot cohort, measure false positives by device model and OS build, then widen. Keep enforcement under a server-side switch so rollback is a configuration change, not an app release.
- Monitor redistribution. OWASP suggests startup integrity checks that report modified copies so they can be removed from stores; specialised services also do this. Track unrecognised app versions reaching the backend.
Evidence and assessment
MASVS notes that testers must understand resilience techniques and how they can be bypassed so that assessments stay meaningful. Assessment should therefore be done by authorised testers against your own builds; OWASP names MobSF, otool, apktool and Ghidra as tools developers can use to examine their own binaries.
| Check | What good evidence looks like |
|---|---|
| Secrets in the binary | Automated secret scan of each release artefact with zero high-value findings; list of any client keys with their scope and abuse limits |
| Build hardening | Release build configuration showing shrinking and renaming enabled; archived mapping files; no debug flags |
| Server-side enforcement | Test showing a tampered or unattested client is limited or denied by the backend, independent of in-app checks |
| Attestation verification | Server code review covering challenge freshness, App ID, certificate chain, counters and verdict fields |
| Resilience controls (if in scope) | Authorised test report against MASVS-RESILIENCE-1 to 4, with the expected attacker effort stated |
Metrics that show it is working
- Attested request share: percentage of sensitive API calls carrying a valid attestation or integrity verdict.
- Unrecognised client rate: requests with failing app recognition or unknown app versions, trended per week.
- False-positive rate: legitimate users limited or denied, broken down by device model and OS build.
- Secrets in releases: high-value secrets found in shipped binaries; target zero.
- App Attest risk metric distribution: devices with key counts well above the observed baseline.
- Fraud outcome: abuse losses or chargebacks tied to modified clients before and after enforcement.
Mapping to other frameworks
The mapping is our own, based on the control texts.
| Framework | Reference | Relevance to M7 |
|---|---|---|
| OWASP MASVS | MASVS-RESILIENCE-1 to 4 | Platform integrity, anti-tampering, anti-static and anti-dynamic analysis |
| OWASP Top 10 for LLM Applications | Referenced from M7 for model theft | Protecting embedded AI models |
| NIST SP 800-53 Rev 5 | SI-7, SI-7(6), SI-7(15) | Software integrity, cryptographic protection, code authentication |
| NIST SP 800-53 Rev 5 | SA-11, SA-15 | Developer testing, development process and tools |
| NIST CSF 2.0 | PR.PS-06, DE.CM-09 | Secure development practices; monitoring software and runtime environments |
| MITRE ATT&CK v20 (enterprise) | T1552.001 Credentials In Files; T1027 Obfuscated Files or Information | Extraction of embedded credentials; malware's own use of obfuscation, which MASVS also notes |
| ISO/IEC 27001:2022 Annex A | A.8.25, A.8.26, A.8.4 | Secure development life cycle, application security requirements, access to source code |
Common pitfalls
- Obfuscating a secret instead of removing it: an obfuscated paid API key is still in the binary. Leaked keys are hard to replace quickly once exposed, as OWASP notes, and breaches such as the LLMjacking campaigns show how quickly exposed AI API keys are monetised.
- Client-only enforcement: a root or tamper check that only closes the app can be removed by patching the same binary. Send the signal to the server and enforce there.
- Binary allow or deny on attestation: blocking every device without the strongest label locks out legitimate users; use graded responses and measure false positives first.
- Replayable verdicts: integrity tokens or assertions accepted without a fresh server challenge, request hash or counter check can be captured and reused.
- Obfuscation that breaks the app: aggressive renaming breaks reflection-based libraries and serialisation; missing mapping files leave crash reports unreadable. Test release builds, not debug builds.
- Treating resilience as compliance: scoring a pass on RESILIENCE controls while the backend trusts client-supplied prices, roles or entitlements. See the OWASP Mobile Top 10 M3 Insecure Authentication and Authorization Guide.
Practitioner checklist
- Threat model the binary: list keys, algorithms, models, licence logic and payment identifiers it contains.
- Remove paid or long-lived secrets from the app and replace them with backend calls or short-lived tokens.
- Enable R8 shrinking and renaming for Android release builds and archive mapping files per release.
- Integrate Play Integrity and App Attest, verify results on the server, and start in observe mode.
- Implement graded server responses and a server-side switch for enforcement.
- Bind attestation to a fresh challenge or request hash and check App Attest counters.
- Report in-app integrity and environment detections to the server rather than acting only locally.
- Track attested request share, unrecognised clients and false positives by device.
- Commission authorised testing against MASVS-RESILIENCE where the business case justifies it.
Standards and references
- OWASP: M7 Insufficient Binary Protection
- OWASP: Mobile Top 10
- OWASP: MASVS-RESILIENCE
- Android Developers: Play Integrity API overview
- Apple Developer: Establishing your app's integrity
- Apple Developer: Assessing fraud risk
- Android Developers: Shrink, obfuscate, and optimize your app
Related NHI Mgmt Group resources: OWASP Mobile Top 10 Guide · OWASP Mobile Top 10 M2 Inadequate Supply Chain Security Guide · Mobile App Security Testing Guide · AI Model Security Guide · OWASP Mobile Top 10 M6 Inadequate Privacy Controls Guide