CVE-2026-58978 AI-generated analysis
platform/frameworks/base, PackageManager install pipeline (services/core/java/com/android/server/pm: PackageInstallerService, InstallPackageHelper)
Rejects installation of a package for which mPm.isPackageDeviceAdmin returns true onto a non-internal (external/adopted) storage volume, both at install-session creation in PackageInstallerService and in the install prepare phase in InstallPackageHelper.
Root cause
The install path validated the storage location only for some package classes (the prepare phase in InstallPackageHelper already rejected static shared libraries when onExternal is true) but had no such restriction for device admin packages. A session could therefore target an external/adopted volume (params.volumeUuid non-null, e.g. via INSTALL_FORCE_VOLUME_UUID or the volume resolved by InstallLocationUtils.resolveInstallVolume) and install or update a device admin package there; neither the session-creation parameter validation in PackageInstallerService nor the prepare phase in InstallPackageHelper checked mPm.isPackageDeviceAdmin for the target package. The bulletin rates this as a High EoP; the material does not state the concrete consequence of a device admin living on external storage.
How the fix works
- services/core/java/com/android/server/pm/PackageInstallerService.java, in the session-creation parameter validation block right after the install-location resolution (the block handling INSTALL_INTERNAL / INSTALL_FORCE_VOLUME_UUID / resolveInstallVolume; enclosing function name not shown in the material): after params.volumeUuid has been validated or resolved, if params.volumeUuid != null and params.appPackageName != null and mPm.isPackageDeviceAdmin(params.appPackageName, userId), throw IllegalArgumentException("Device Admin can only be installed on internal storage."). This rejects the session before it is created, but only when the caller declared appPackageName.
- services/core/java/com/android/server/pm/InstallPackageHelper.java, in the prepare phase (the function that uses onExternal and already contains the static shared library external-storage check), immediately after request.setName(pkgName): if mPm.isPackageDeviceAdmin(pkgName, request.getUserId()) and onExternal, throw PrepareFailure(INSTALL_FAILED_INVALID_INSTALL_LOCATION, "Device Admin can only be installed on internal storage."). This uses the package name parsed from the APK, so it covers requests regardless of whether appPackageName was supplied at session creation. It mirrors the existing static shared library check a few lines above.
- A new test services/tests/mockingservicestests/src/com/android/server/pm/InstallPackageHelperTest.kt (installPackages_deviceAdminOnExternalStorage_failsVerification) drives installPackagesTraced with a request whose volumeUuid is non-null and whose codePath points at DEVICE_ADMIN_PACKAGE, and asserts setError with INSTALL_FAILED_INVALID_INSTALL_LOCATION. The test file appears in the 14, 16 and 17 commits; the Android 15 commit as shown touches only the two source files.
Completeness
- Two layers: the PackageInstallerService check is an early, optional reject (skipped when params.appPackageName is null); the InstallPackageHelper check uses the parsed package name and applies to every install request that reaches the prepare phase with onExternal true.
- Both checks key on mPm.isPackageDeviceAdmin(pkg, userId) for a single user (userId at session creation, request.getUserId() in prepare). How isPackageDeviceAdmin behaves for multi-user/USER_ALL install requests is not shown in the material.
- The check only triggers when the package is already a device admin at install time; it does not prevent a package already located on external storage from later becoming a device admin (that path is not part of this fix and not shown in the material).
- The PackageInstallerService check also fires when volumeUuid was auto-resolved by InstallLocationUtils.resolveInstallVolume (it sits after the if/else), not only for explicit INSTALL_FORCE_VOLUME_UUID.
- The definition of onExternal in InstallPackageHelper is outside the shown context; the test implies it is derived from a non-null request volumeUuid.
Behavior changes
- PackageInstaller session creation now throws IllegalArgumentException ("Device Admin can only be installed on internal storage.") when appPackageName names a device admin for the target user and volumeUuid is non-null, including when the volume was auto-resolved.
- Installs of a device admin package targeting external/adopted storage now fail in the prepare phase with INSTALL_FAILED_INVALID_INSTALL_LOCATION instead of succeeding.
- No change for installs to internal storage (volumeUuid null) or for packages that are not device admins.
Per major
- Android 14: same fix (76143dc38a12, android-security-14.0.0_r31): identical two checks; in the PackageInstallerService hunk the inserted block is followed by 'final int sessionId;'; also adds InstallPackageHelperTest.kt. 7/7 patched lines present.
- Android 15: same fix (92ea58ab7bb4, android-security-15.0.0_r19): the two source checks, cherry-picked from fbf97426953f; commit stat shows only the two source files (no test file). 7/7 patched lines present.
- Android 16: same fix (fc82827c1485, android-security-16.0.0_r10): identical checks at shifted line numbers, plus InstallPackageHelperTest.kt. 7/7 patched lines present.
- Android 17: same fix (50ef653380aa, android-security-17.0.0_r3): identical checks at shifted line numbers (PackageInstallerService hunk followed by the originatingUri block), plus InstallPackageHelperTest.kt. 7/7 patched lines present.
Unknowns
- The concrete security consequence of a device admin package residing on external/adopted storage (why it is an EoP) is not described in the material.
- The exact derivation of onExternal in InstallPackageHelper is outside the shown context.
- The enclosing function name of the PackageInstallerService check is not shown.
- Which caller privileges are needed to create a session targeting an external volume is not shown.
- Whether other paths that relocate an installed package to a non-internal volume (a package move API exists in PackageManagerService (general platform knowledge)) received an equivalent check is not shown in the material.
- Behaviour of isPackageDeviceAdmin for USER_ALL / multi-user install requests is not shown.