Source: frameworks/base/data/etc/platform.xml → /system/etc/permissions/platform.xml
Parsed by frameworks/base/core/java/com/android/server/SystemConfig.java
Group names resolve via system/core/libcutils/include/private/android_filesystem_config.h
Permission
Group name
AID
Kernel then allows
INTERNET
inet
3003
AF_INET / AF_INET6 sockets — all networking
BLUETOOTH
net_bt
3002
Bluetooth sockets
BLUETOOTH_ADMIN
net_bt_admin
3001
Bluetooth administration
BLUETOOTH_STACK
bluetooth, wakelock, uhid
1002, 3010, 3011
Bluetooth stack device nodes
NET_ADMIN
net_admin
3005
Network configuration
NET_TUNNELING
vpn
1016
The TUN device
MAINLINE_NETWORK_STACK
net_admin, net_raw
3005, 3004
Raw sockets, net config
READ_LOGS
log
1007
The log device
ACCESS_MTP
mtp
1024
MTP device node
DIAGNOSTIC
input, diag
1004, 2002
Diagnostic device nodes
ACCESS_CACHE_FILESYSTEM
cache
2001
/cache
READ_NETWORK_USAGE_HISTORY
net_bw_stats
3006
Network accounting
UPDATE_DEVICE_STATS
net_bw_acct
3007
Modify network accounting
VIRTUAL_INPUT_DEVICE
uhid
3011
/dev/uhid
MANAGE_VOICE_KEYPHRASES
audio
1005
Audio device nodes
ACCESS_BROADCAST_RADIO
media
1013
/dev/fm
USE_RESERVED_DISK
reserved_disk
1065
Reserved disk quota
WRITE_SECURITY_LOG
security_log_writer
—
Security log
LOOP_RADIO
loop_radio
—
Loop radio device
M — READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE have NO <group> on API 33. They are
declared in platform.xml with no child at all, under a comment explaining they survive only for
upgrade compatibility. Chrome held both and its gids= was [3002, 3003] — no 1015, no 1028.
Do not test shared-storage access by group membership on a modern device.
adbshelldumpsyspackage<pkg># everything; 3 blocks
adbshelldumpsyspackage<pkg>|sed-n'/declared permissions/,/disabledComponents/p'
adbshelldumpsyspackage<pkg>|grep'granted=false'# decided: NO
adbshelldumpsyspackage<pkg>|grep'gids='# permission-derived GIDs
python3scripts/grant-state.pydump.txt# the four sets, separated
python3scripts/grant-state.py--pkg<pkg># capture + read in one step
adbshelldumpsyspackagepermission<perm># sourcePackage=, prot=, gids= <-- memorise this
adbshellpmlistpermissions-f-g|grep-A5<perm>
adbshellpmlistpermissions-f-g# every permission, full records
adbshellpmlistpermissions-d-g# dangerous only
adbshellpmlistpermissions-g# names only -- almost useless
pm list permissions flag
Effect
-f
Full record, including protectionLevel and declaring package. Without it you learn nothing
adbshellcmdappopsget<pkg># every op for the package
adbshellcmdappopsget<pkg><OP># one op
adbshellcmdappopsset<pkg><OP>allow# test devices only; restore afterwards
adbshellcmdappopsset<pkg><OP>default
adbshelldumpsysappops# access TIMESTAMPS -- when, not just whether
Op mode
Meaning
allow
Permitted
ignore
Silently returns empty data rather than throwing
deny
Refused, usually with an exception
default
Not "deny". No explicit decision; defer to the permission
foreground
Permitted only while the app is in use
rejectTime= on an op records when the app last attempted something it was refused. Attempt
evidence, not capability evidence.
adbshellpmgrant<pkg><perm># runtime + `development` permissions ONLY
adbshellpmrevoke<pkg><perm>
adbshellpmreset-permissions# whole device, back to defaults
M — pm grant on a normal permission:
SecurityException: … is not a changeable permission type. There is no per-app runtime state to
write; the grant lives in packages.xml.
adbshellcat/proc/<pid>/status|grep-E'^(Uid|Gid|Groups)'# the LIVE group list
adbshellcat/system/etc/permissions/platform.xml# the mapping. No root needed
adbshellls/system/etc/permissions//vendor/etc/permissions//product/etc/permissions/
adbshellcat/system/etc/permissions/privapp-permissions-platform.xml
shouldShowRequestPermissionRationale returns false for BOTH "never asked" and "permanently
refused". Combine it with grant state and request history to tell them apart.
The current Binder caller. PERMISSION_DENIED if there is no caller
Yes — fail-closed
enforceCallingPermission(p, msg)
Same, but throws
Yes
checkPermission(p, pid, uid)
The named process
Yes, with Binder.getCallingPid/Uid()
checkCallingOrSelfPermission(p)
The caller — or, if none, ME
NO. Vulnerability pattern
enforceCallingOrSelfPermission(p, msg)
Same, but throws
NO
checkSelfPermission(p)
Myself
Not an authorisation check at all — feature detection
PackageManager.checkPermission(p, pkg)
A package
Reporting only. Package names are ambiguous under sharedUserId
The correct caller check, which nothing an attacker installs can influence:
intuid=Binder.getCallingUid();if(uid==Process.myUid())return;// ourselvesif(getPackageManager().checkSignatures(Process.myUid(),uid)!=PackageManager.SIGNATURE_MATCH){thrownewSecurityException("uid "+uid+" is not same-signature");}
getPackagesForUid() returns an array. Under sharedUserId a UID maps to several packages;
check every entry. getCallingPackage() gives you only the first, and null outside a
transaction.
10. checkComponentPermission — the five-condition ladder¶
// ActivityManagerService.checkComponentPermission -- order mattersif(uid==0||uid==SYSTEM_UID)returnGRANTED;// root/system pass everythingif(UserHandle.isSameApp(uid,owningUid))returnGRANTED;// same UID: NO check at allif(!exported)returnDENIED;// stronger than any permissionif(permission==null)returnGRANTED;// exported + unguarded = openreturncheckUidPermission(permission,uid);// finally, the string compare
A owns it. sourcePackage=A, prot= whatever A chose
A owns it; B tries to declare the same name
B cannot install.INSTALL_FAILED_DUPLICATE_PERMISSION
B owns it; A tries to declare it
A cannot install. Symmetric, regardless of level or malice
Victim uses a name it never declares; attacker declares it at normal
Attacker owns the rule. Victim installs fine. This still works
Unrelated third app requests the squatted name
granted=true at install, no prompt, no signature relationship M
Definer is uninstalled
Definition and every grant of it disappear
Configuration
What squatting IS
Impact class
Both declare
Install denial — victim becomes uninstallable
Availability, Low–Medium
Used-but-undeclared
Access-control bypass
Confidentiality/Integrity, High
Fix (both parts required):
1. Every app in the suite declares the permission identically at signature — no install order
leaves the name unowned.
2. Re-check the caller in code with checkSignatures. It cannot be squatted.
# the single highest-value line: a permission that grants itself
grep-n'<permission 'AndroidManifest.xml|grep-vprotectionLevel
grep-n'uses-permission'AndroidManifest.xml
grep-n'<permission '-A3AndroidManifest.xml
grep-nE'android:(permission|readPermission|writePermission)='AndroidManifest.xml
grep-n'permission-tree'AndroidManifest.xml
grep-rn'checkCallingOrSelfPermission\|enforceCallingOrSelfPermission'jadx-out/# the bug
grep-rn'clearCallingIdentity'jadx-out/
grep-rn'Binder.getCallingUid\|checkSignatures\|getPackagesForUid'jadx-out/# good sign
grep-rn'addPermission'jadx-out/
grep-rn'requestPermissions\|checkSelfPermission'jadx-out/
grep-rho'android.permission.[A-Z_]*'jadx-out/|sort-u# used
grep-o'android.permission.[A-Z_]*'AndroidManifest.xml|sort-u# asked
catout/res/xml/accessibility_service_config.xml# if BIND_ACCESSIBILITY_SERVICE
catout/res/xml/device_admin*.xml# if BIND_DEVICE_ADMIN
Read every window, inject events. Can operate the permission dialogs itself
BIND_NOTIFICATION_LISTENER_SERVICE
Notification access
Every notification, including one-time codes
SYSTEM_ALERT_WINDOW
Display over other apps
Tapjacking and overlay phishing
MANAGE_EXTERNAL_STORAGE
All files access
Every other app's shared-storage files
PACKAGE_USAGE_STATS
Usage access
Which apps, when
REQUEST_INSTALL_PACKAGES
Install unknown apps
Dropper capability
BIND_DEVICE_ADMIN
Device admin
Lock, wipe, resist uninstall
WRITE_SETTINGS
Modify system settings
System configuration
SCHEDULE_EXACT_ALARM
Alarms and reminders
Persistence
All are granted through a Settings screen, not a runtime dialog. Malware bridges that gap with
an overlay narrating the steps — which is why SYSTEM_ALERT_WINDOW + BIND_ACCESSIBILITY_SERVICE
is the combination to look for.