Do the SELinux type and MCS categories permit the reader?
ls -Zd; compare category pairs
Policy
Does MediaProvider allow it? (shared storage only)
Test from an app; there is no file to read
MCS formula: c[appId & 0xff] , c[256 + (appId >> 8)] , then the user pair.
A first category above c255 is arithmetically impossible — the context was fabricated.
Label
Meaning
app_data_file:s0:c<a>,c<b>,c512,c768
Ordinary app; per-app categories isolate it from every other app
# host
./scripts/storage-map.sh<pkg>--media# every root, modes, labels, reachability
./scripts/storage-map.sh<pkg>--no-root# what an unprivileged principal sees
adbshell"su -c 'ls -laZR /data/user/0/<pkg>'"
adbshell"su -c 'ls -laZR /data/user_de/0/<pkg>'"# DE is a SIBLING tree, not a subdir
adbshell"ls -la /sdcard/Android/data/<pkg>"
adbshell"dumpsys package <pkg> | grep -iE 'userId|backup|flags'"
# host
adbshellbmgrenabled
adbshellbmgrlisttransports
adbshellbmgrbackupnow<pkg>
adbbackup-fout.ab-noapk<pkg># restricted or absent on many modern/OEM builds
ddif=out.abbs=1skip=24|zlib-flate-uncompress|tartvf-
SQLite (there is nosqlite3 on a stock device — pull and analyse on the host)¶
MODE_WORLD_*throws; Direct Boot + DE storage; FileProvider required for file sharing
26
8.0
getNoBackupFilesDir() widely used
29
10
Scoped storage, opt-out via requestLegacyExternalStorage
30
11
Enforced; opt-out ignored for targetSdk 30+; MANAGE_EXTERNAL_STORAGE; FUSE replaces sdcardfs; Android/data closed to other apps
31
12
dataExtractionRules replaces fullBackupContent — ship both
33
13
READ_EXTERNAL_STORAGE splits into READ_MEDIA_{IMAGES,VIDEO,AUDIO}; clipboard sensitivity flag
34
14
READ_MEDIA_VISUAL_USER_SELECTED — partial media access
Measured on the test device (Redmi M2101K6P, Android 11 / API 30, rooted, Enforcing)¶
Claim
Measurement
/data/user/0 is a symlink to /data/data
False.readlink exits 1; both are inode 118; /proc/mounts shows a bind mount
Apps cannot read another app's /data/data file
Not unconditionally. An ordinary app with no permissions read com.google.android.gms/shared_prefs/google_sdk_flags.xml — privapp_data_file has no per-app MCS categories, dir is 0711, file is 0664. Contents are SDK flags → Informational
An app can enumerate /sdcard/Android/data on API 30
No — list() returns null. But exists() on another package's dir returns true, so existence still leaks
The database; free pages keep deleted content unless secure_delete=ON
Always
<db>-wal
Pre-delete pages — where deleted rows live
WAL mode, between checkpoints. Deleted on clean close
<db>-shm
Shared-memory index into the WAL
Alongside the WAL
<db>-journal
Rollback journal
Non-WAL mode, or left behind after a crash
<prefs>.xml.bak
The previous preferences
After a crash mid-write
Remediation order: secure_delete=ON (from the start — it is not retroactive) → VACUUM →
PRAGMA wal_checkpoint(TRUNCATE). Swapping the last two silently refills the WAL.
Use rawQuery for pragmas that return a value; execSQL throws.
Always excluded, no rule needed: cache/, code_cache/, no_backup/.
Paths are relative — a leading / silently matches nothing.
Excluding x.db does not exclude x.db-wal.