Android Backup Enabled for Sensitive Data

The Android app allows its private data to be included in backups and device transfers, which can expose stored tokens and personal data outside the device.

SeverityLow
CVSS 3.13.1 CVSS:3.1/AV:P/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N Open in the calculator
CVSS 4.01 CVSS:4.0/AV:P/AC:L/AT:P/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N Open in the calculator
CWECWE-530: Exposure of Backup File to an Unauthorized Control Sphere
CategorySecurity Misconfiguration

Description

Android can copy an app's private data into backups: Auto Backup to the user's Google account, device-to-device transfers when the user sets up a new device, and on older versions the adb backup command. This is controlled by the android:allowBackup attribute of the manifest's application element, which defaults to true, and refined by android:fullBackupContent (Android 11 and lower) and android:dataExtractionRules (Android 12 and higher), which include or exclude specific files.

The weakness arises when backups are enabled and the app stores sensitive data, such as session tokens, keys or personal data, without excluding it. An attacker with access to the user's unlocked device can then transfer the app's data to a device they control, or for older apps extract it with adb backup, and read the stored data or restore it to take over the user's session. Data can also be altered before it is restored, if the app trusts it.

For apps targeting Android 12 (API level 31) or higher, adb backup no longer includes app data, which removes the easiest extraction route, but cloud backups and device-to-device transfers still copy it. The need for access to the unlocked device, or to the user's backup account and screen lock, limits the likelihood. Testing reviews the manifest and backup rules and, where possible, creates and inspects a backup of the app's data.

Remediation

  • Set android:allowBackup="false" if the app has no data that users need restored, or exclude sensitive files with backup rules. For apps targeting Android 12 or higher, android:allowBackup="false" does not stop device-to-device transfers on some manufacturers' devices, so exclude sensitive files in the device-transfer rules as well.
  • Define android:dataExtractionRules, with separate cloud-backup and device-transfer sections, for Android 12 and higher, and android:fullBackupContent for earlier versions, excluding tokens, keys, caches and other sensitive files.
  • Keep encryption keys in the Android Keystore, whose keys are not included in backups, so that encrypted data that is backed up cannot be decrypted elsewhere.
  • Bind sessions to the device where possible, so that restored tokens are not accepted from another device.
<data-extraction-rules> <cloud-backup> <exclude domain="sharedpref" path="session.xml" /> <exclude domain="database" path="app.db" /> </cloud-backup> <device-transfer> <exclude domain="sharedpref" path="session.xml" /> <exclude domain="database" path="app.db" /> </device-transfer> </data-extraction-rules>

Confirm the fix by creating a backup or device transfer of a test installation and checking that the excluded files are absent.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More Mobile Applications Findings

Every Mobile Applications finding