CVE-2026-58836 AI-generated analysis
platform/frameworks/base, PackageManager install path (services/core/java/com/android/server/pm/InstallPackageHelper.java), Enhanced Confirmation Mode (ECM) / AppOps OP_ACCESS_RESTRICTED_SETTINGS
Removes the feature-flag gate and the handler post that could skip eagerly setting OP_ACCESS_RESTRICTED_SETTINGS to MODE_ERRORED after installing a package whose source is LOCAL_FILE or DOWNLOADED_FILE. The ECM "explicitly guarded" state is now written inline at install completion instead of being left to lazy evaluation.
Root cause
In InstallPackageHelper, a post-install step marks potentially dangerous packages (package source PACKAGE_SOURCE_LOCAL_FILE or PACKAGE_SOURCE_DOWNLOADED_FILE) as ECM-guarded by setting OP_ACCESS_RESTRICTED_SETTINGS to AppOpsManager.MODE_ERRORED. This step was wrapped in `if (!android.permission.flags.Flags.enhancedConfirmationModeApisEnabled() || !android.security.Flags.extendEcmToAllSettings())`, so it was skipped whenever both flags were enabled and ECM state was left to lazy evaluation. The removed comment justified this by saying the op's default mode became "decided later" in Android B. Per the commit message, a third-party package installer could then set the package source to PACKAGE_SOURCE_STORE to bypass ECM. The step was also posted to mPm.mHandler instead of running inline.
How the fix works
- services/core/java/com/android/server/pm/InstallPackageHelper.java, post-install section of the install completion path (after mPm.notifyPackageAdded/notifyPackageChanged): the flag check `!enhancedConfirmationModeApisEnabled() || !extendEcmToAllSettings()` and its explanatory comment are deleted, so the restricted-settings step runs regardless of the flags.
- The `mPm.mHandler.post(() -> {...})` wrapper is removed. When request.getPackageSource() is PACKAGE_SOURCE_LOCAL_FILE or PACKAGE_SOURCE_DOWNLOADED_FILE, setAccessRestrictedSettingsMode(packageName, appId, userId, AppOpsManager.MODE_ERRORED) is now called inline for each userId in request.getFirstTimeBroadcastUserIds().
- Two Slog.i log lines are added ("PackageSource is local file or downloaded file" and "Set OP_ACCESS_RESTRICTED_SETTINGS to MODE_ERRORED for user ..."). The commit changes a single file and is described as a revert of a previous change. Flag: EXEMPT CVE_FIX.
Completeness
- Covers the install-time write of MODE_ERRORED for packages whose source is LOCAL_FILE or DOWNLOADED_FILE, for all first-time users of the package, regardless of the ECM feature flags.
- Does not change the package-source condition itself. Installs reporting other sources (for example PACKAGE_SOURCE_STORE) still get no explicit op mode from this code. The material does not show how the eager write defeats the PACKAGE_SOURCE_STORE bypass described in the commit message.
- No change to EnhancedConfirmationManager or to the lazy evaluation logic. Only the install-side initialization is restored.
- The loop iterates firstUserIds only. Users who receive the package later are not handled by this code.
Behavior changes
- Packages installed with source LOCAL_FILE or DOWNLOADED_FILE now have OP_ACCESS_RESTRICTED_SETTINGS set to MODE_ERRORED at install completion even when both ECM flags are enabled. Before the fix the step was skipped in that configuration.
- The op write now runs inline in the post-install code instead of being posted to mPm.mHandler.
- Two new Slog.i info-level log lines in the install path.
Per major
- Android 14: Not affected per the bulletin. android-security-14.0.0_r31 has only 1/8 lines of the patched region, which suggests the code in this area differs. No fix applied.
- Android 15: Not affected per the bulletin. android-security-15.0.0_r19 has 5/8 lines of the patched region; the exact code form is not shown. No fix applied.
- Android 16: Same fix: platform/frameworks/base 9444f519c4e5 in android-security-16.0.0_r8 (bug 349318333). The fixed code is present in the android-security-16.0.0_r10 context at lines 3124-3138.
- Android 17: Same fix: platform/frameworks/base ec56593e44df in android-security-17.0.0_r1. The diff is identical but at a different offset (hunk at line 3278 vs 3117).
Unknowns
- How setting PACKAGE_SOURCE_STORE interacts with the lazy ECM evaluation to produce the bypass (the EnhancedConfirmationManager side is not in the material).
- Why the handler post was removed along with the flag gate (whether the asynchronous write was itself part of the issue).
- Which flag values ship by default on Android 16 and 17 builds.
- The exact form of the code on Android 14 and 15.
- Contents of the referenced EnhancedConfirmationManagerTest changes, if any.