Android configuration

Android backup and debuggable flags

Two manifest attributes decide whether app data can be copied off a device and whether the running app can be inspected. Both are easy to get wrong.

allowBackup and backup rules

android:allowBackup defaults to true. Backed-up data includes files, databases and shared preferences unless rules exclude them. Apps targeting Android 12 or later use android:dataExtractionRules for cloud backup and device-to-device transfer; older versions use android:fullBackupContent. Since Android 12, adb backup no longer includes data from apps that target API 31 or later unless they are debuggable, but cloud backup and device transfer still apply.

Tokens, keys and personal data copied to a backup can be restored to a different device. This is part of MASVS-STORAGE.

debuggable

android:debuggable="true" lets anyone with adb attach a debugger, run commands as the app with run-as and read its private files. Build tools set it for debug builds; it should never reach a release build, and Google Play rejects debuggable uploads. A debuggable build distributed outside the store, such as a test or enterprise build, is still a real exposure. This relates to MASVS-RESILIENCE and to build hygiene under MASVS-CODE.

Static check

What to record from the manifest
AttributeWhat to check
allowBackupExplicit value, and whether the app stores tokens or personal data that backups would include.
dataExtractionRulesFor Android 12+ targets: which domains are excluded from cloud-backup and device-transfer.
fullBackupContentFor older targets: the include and exclude rules for each domain.
debuggableMust be absent or false in the build being assessed.
targetSdkVersionDecides which backup rules and adb backup behavior apply.

Runtime check

On a test device, adb shell run-as <package> ls succeeds only for debuggable builds, which is a quick confirmation. For backup, sign in with a test account, create data, then run adb shell bmgr backupnow <package> with a local transport and inspect what was included, or use a device-to-device transfer to a second test device and check whether the session survives.

Commands run from adb shell have shell privileges that a normal app does not; repeat important results from an unprivileged test app before reporting them.

Fix and report

Exclude tokens, keys and caches of personal data from backup rules, or set allowBackup="false" if the app has nothing worth restoring. Keep keys in the Android Keystore, which is not backed up. Make sure release builds are not debuggable and add a CI check. Report the build, the manifest values and what you were able to extract. See the manifest security review for the other attributes.

Related reading