-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"## The ninth `&=` is what the patch adds\n\nAndroid's `PackageInstaller.SessionParams` is a `Parcelable` that carries a 32-bit `installFlags` field across Binder into `system_server`. The first thing `PackageInstallerService.createSessionInternal` does with that field, on AOSP `android-15.0.0_r36` (`services/core/java/com/android/server/pm/PackageInstallerService.java`), is walk down a list of system-only flags and clear them off the caller's value before the install proceeds:\n\n```java\nparams.installFlags &= ~PackageManager.INSTALL_FROM_ADB;\nparams.installFlags &= ~PackageManager.INSTALL_ALL_USERS;\nparams.installFlags &= ~PackageManager.INSTALL_ARCHIVED;\n...\nparams.installFlags &= ~PackageManager.INSTALL_ALLOW_TEST;\n...\nparams.installFlags &= ~PackageManager.INSTALL_ALLOW_DOWNGRADE;\n...\nparams.installFlags &= ~PackageManager.INSTALL_DISABLE_VERIFICATION;\n...\nparams.installFlags &= ~PackageManager.INSTALL_DISABLE_ALLOWED_APEX_UPDATE_CHECK;\n...\nparams.installFlags &= ~PackageManager.INSTALL_BYPASS_LOW_TARGET_SDK_BLOCK;\n```\n\nEight `&=` lines, scattered through the prelude of one function. Each one is the server saying: this bit is system-only, you do not get to set it from a regular app, I am erasing it before the rest of this code reads `installFlags`. The list is the trust boundary between caller-controlled bits and system semantics.\n\nSeveral hundred lines down in the same function, after the package source is checked, after the verifier is resolved, after device-policy state is loaded, the pre-patch code asked Device Policy Manager whether the user is organization-managed and conditionally set a ninth flag:\n\n```java\nfinal var dpmi = LocalServices.getService(DevicePolicyManagerInternal.class);\nif (dpmi != null && dpmi.isUserOrganizationManaged(userId)) {\n params.installFlags |= PackageManager.INSTALL_FROM_MANAGED_USER_OR_PROFILE;\n}\n```\n\nA `|=` with no matching `&=` above it. If `dpmi.isUserOrganizationManaged(userId)` returns `false`, the conditional does nothing. Whatever value the caller put in that bit before Binder rides through unchanged.\n\nSanjana Sunil's patch (`09055276288a68cf35b0f84ba32e28822f74ecf9`, March 2026 Android Security Bulletin, bug `A-459461121`) adds the ninth `&=`:\n\n```diff\n final var dpmi = LocalServices.getService(DevicePolicyManagerInternal.class);\n\n+// Only the system should be able to set this flag - so ensure it is unset when not needed.\n+params.installFlags &= ~PackageManager.INSTALL_FROM_MANAGED_USER_OR_PROFILE;\n\n if (dpmi != null && dpmi.isUserOrganizationManaged(userId)) {\n params.installFlags |= PackageManager.INSTALL_FROM_MANAGED_USER_OR_PROFILE;\n }\n```\n\nThe commit message states the model in one sentence: \"If the flag is not explicitly unset, an app could set this flag, leading to unexpected behaviour if the install is not actually from a managed user or profile.\" The model was correct from the day the flag was introduced. The implementation of the model arrived two release cycles later.\n\n## What the SDK does not let you set, and what `installFlags` is anyway\n\nThe public Android SDK exposes `PackageInstaller.SessionParams` through a Builder-style API. The Builder has methods like `setAppLabel`, `setAppIcon`, `setPackageSource`, `setRequestUpdateOwnership`, and roughly twenty others. None of those methods exposes `INSTALL_FROM_MANAGED_USER_OR_PROFILE`. The constant itself is annotated `@hide` in `frameworks/base` and the field it controls, `SessionParams.installFlags`, is package-private.\n\nThe public API surface is the convention. Apps that build SessionParams through the documented setters cannot set the bit because the documented setters do not write to it. That convention held everywhere the public API was the only path.\n\nThe QM4RS PoC's Unsafe Mart is the path the convention does not hold on. Its `injectManagedProfileInstallFlag()` extension, in `Unsafe Market/app/src/main/java/com/installer/safemart/MainActivity.kt`, reads the hidden constant and writes the private field with two reflective lookups:\n\n```kotlin\nprivate fun PackageInstaller.SessionParams.injectManagedProfileInstallFlag(): Boolean {\n val flagField = PackageManager::class.java\n .getDeclaredField(\"INSTALL_FROM_MANAGED_USER_OR_PROFILE\")\n .apply { isAccessible = true }\n val installFlag = flagField.getInt(null)\n\n val installFlagsField = PackageInstaller.SessionParams::class.java\n .getDeclaredField(\"installFlags\")\n .apply { isAccessible = true }\n\n val currentFlags = installFlagsField.getInt(this)\n val updatedFlags = currentFlags or installFlag\n installFlagsField.setInt(this, updatedFlags)\n return true\n}\n```\n\nThe two `getDeclaredField` calls read the constant and the field by name from the framework classes the runtime already loaded into the app's process. The `apply { isAccessible = true }` is the JVM-level access override; the runtime hidden-API blocklist is bypassed with the `ChickenHook/RestrictionBypass` library the README acknowledges as \"implementation detail to access framework interfaces.\"\n\nThe PoC author understood exactly which boundary the bug lives at. The log line they emit after `createSession` returns says it verbatim:\n\n```kotlin\nLog.i(TAG, \"createSession(sessionId=$sessionId, mode=${installMode.name}) completed. \" +\n \"These logs only confirm the app-side SessionParams mutation before Binder. \" +\n \"They do not prove system_server accepted or retained any requested flags.\")\n```\n\n\"They do not prove `system_server` accepted or retained any requested flags.\" That is the question CVE-2026-0023 answers: yes, it did, for one specific flag, for as long as `INSTALL_FROM_MANAGED_USER_OR_PROFILE` was in `PackageManager` and not in `createSessionInternal`'s scrub list.\n\n## The Parcel does not know which Builder method set which bit\n\n`PackageInstaller.createSession(SessionParams params)` packs `params` into a Binder transaction by calling `params.writeToParcel(parcel, flags)`. The `SessionParams.writeToParcel` implementation (AOSP `core/java/android/content/pm/PackageInstaller.java`) writes the 32-bit `installFlags` field with a single `parcel.writeInt(installFlags)`. The Parcel encoding is one int. There is no per-bit access control on the wire and there is no record of which Builder method, if any, set which bit.\n\nIn `system_server`, `SessionParams.CREATOR.createFromParcel` reads the int back into a new `SessionParams`. The server's view of `params.installFlags` is whatever the client wrote. The Parcel boundary is content-neutral.\n\n`createSessionInternal` is where the content gets inspected. The eight `&=` lines are the only place per-bit semantics are enforced. They are an opt-in deny list maintained by hand. Every time a new system-only flag is added to `PackageManager`, the engineer who adds it has to remember to add the matching `&=` to `createSessionInternal` for the deny list to remain complete.\n\nWhen `INSTALL_FROM_MANAGED_USER_OR_PROFILE` was added to `PackageManager` in the Android 14 cycle alongside the Update Ownership APIs, the matching scrub line was not added. The conditional `|=` was. The CL author who added the conditional knew the flag was system-only; the conditional itself encodes that knowledge by gating the write on `dpmi.isUserOrganizationManaged(userId)`. They asked \"should the system set this bit on this install?\" and did not ask \"could the caller have set it already?\"\n\nThe eight prior flags answer that second question. Each one of the existing `&=` lines was added by someone who had the same realization: the bit reads as authoritative inside the server, and the only thing keeping it from being app-controllable is the scrub at the top of the function. The pattern was right there, eight times, in the same method.\n\n## What the bit does downstream\n\n`INSTALL_FROM_MANAGED_USER_OR_PROFILE` is the server-side signal that the install session originated from a managed-profile installer. That is the enterprise device-policy controller installing into the work-profile user, in Android's enterprise deployment model. Managed-profile installs are exempt from Android's Update Ownership warning because the enterprise installer is presumed to hold authority over its target packages through device policy.\n\nWhen the bit is set on a session, the install confirmation flow that reaches the user is the generic \"Install update?\" dialog. When the bit is not set, the flow surfaces the Update Ownership warning: \"This app normally receives updates from ``. Allow `` to update it?\" The warning names the registered update owner of the target package and asks the user to confirm a deviation.\n\nThe proof of concept's Safe Mart installs Ownership Inspector through the standard PackageInstaller path with `setRequestUpdateOwnership(true)`, registering Safe Mart as the update owner of `com.installer.inspector`. Unsafe Mart then runs two installs against the same target. The first is a normal update. Android renders the Update Ownership warning naming Safe Mart. The second sets `INSTALL_FROM_MANAGED_USER_OR_PROFILE` via the reflective inject and runs the same install. Android renders the generic update dialog instead. The trust signal that names the registered update owner is gone from the flow.\n\nUpdate Ownership is the trust model Android introduced in Android 14 to give app stores, enterprise installers, and side-loaders a stable signal about who controls updates to a given package. The model's user-facing surface is the warning dialog. The dialog's gate is `INSTALL_FROM_MANAGED_USER_OR_PROFILE`. The gate's authority is the assumption that only `system_server` can set the bit. The patch is `system_server` belatedly enforcing that assumption.\n\n## Internal Only By Convention\n\nThis is [Internal Only By Convention](/patterns/internal-only-by-convention) at the Android Binder boundary. The \"internal-only\" status of `INSTALL_FROM_MANAGED_USER_OR_PROFILE` was held by three layers of soft enforcement, each of which the PoC steps over without producing anything the runtime is configured to refuse:\n\n- `@hide` on the constant. Hidden-API blocklist enforcement is bypassed by `ChickenHook/RestrictionBypass`, which the PoC adds as a Gradle dependency. The author notes correctly that \"Hidden API access is only used as an implementation detail to reach the required framework interfaces from a regular application context.\"\n- The Builder API surface. The `SessionParams.Builder` has no `setInstallFromManagedProfile()` method, so an app following the public API cannot set the bit. Reflection on `installFlags` is one `getDeclaredField` lookup.\n- The implicit contract that `dpmi.isUserOrganizationManaged(userId)` is the only writer of the bit on the server side. That contract is encoded in the conditional `|=` and was not encoded in a matching unconditional `&=` until the March 2026 patch.\n\nThe Chamilo `install.ajax.php` exhibit ([install-only by filename](/posts/chamilo-install-ajax-was-install-only-by-filename)) is the same shape on a PHP filesystem: every handler in the directory enforced auth one file at a time, the install handler was the one file that didn't, and the convention that nobody would request the install handler post-install was the gate. The Android instance is the same convention at the Binder boundary: every system-only flag was scrubbed one line at a time, the managed-profile flag was the one flag that wasn't, and the convention that nobody could reach the field through reflection was the gate.\n\nThe defender's reading is the same in both directions. When the trust boundary's enforcement is \"every caller-readable field has its own scrub line in one function,\" the boundary is one missed scrub away from absent. The deny list does not converge. Every new system-only flag added to `PackageManager` is a new opportunity for the matching line in `createSessionInternal` to not get written.\n\n## The CVE names one flag\n\nCVE-2026-0023's description names `INSTALL_FROM_MANAGED_USER_OR_PROFILE`. The patch closes that flag. The patch does not change the architecture that requires a per-flag scrub list to be maintained by hand against an open-ended set of new system-only flags. The next flag in `PackageManager` annotated `@hide` and read by `system_server` with security-relevant authority is one CL away from being the same bug.\n\nThe bit's effect is bounded. The consequence is suppression of the Update Ownership warning during an install the user is already approving, not arbitrary code execution. The same architectural shape would carry a different consequence into the system depending on which flag was forgotten. `INSTALL_BYPASS_LOW_TARGET_SDK_BLOCK` is on the scrub list because the consequence of forgetting it would be apps installing despite targeting a deprecated SDK. `INSTALL_DISABLE_VERIFICATION` is on it because the consequence would be skipping the package verifier. `INSTALL_ALL_USERS` is on it because the consequence would be cross-user installation. Each line on the list represents a CVE that was avoided by adding the line.\n\nCVE-2026-0023 represents the line that was not added.\n\nPoC: [QM4RS/CVE-2026-0023-Update-Ownership-PoC](https://github.com/QM4RS/CVE-2026-0023-Update-Ownership-PoC).","closing_line":"The deny list is the trust boundary. Eight flags were on it. The ninth was on the wire.","hook_md":"Android's `PackageInstaller.SessionParams` is a `Parcelable` that carries a 32-bit `installFlags` field across Binder into `system_server`. The first thing `PackageInstallerService.createSessionInternal` does with that field is walk down a list of system-only flags and clear them off the caller's value with `params.installFlags &= ~PackageManager.INSTALL_X` before the install proceeds. The list, before the March 2026 patch, was eight flags long: `INSTALL_FROM_ADB`, `INSTALL_ALL_USERS`, `INSTALL_ARCHIVED`, `INSTALL_ALLOW_TEST`, `INSTALL_ALLOW_DOWNGRADE`, `INSTALL_DISABLE_VERIFICATION`, `INSTALL_DISABLE_ALLOWED_APEX_UPDATE_CHECK`, `INSTALL_BYPASS_LOW_TARGET_SDK_BLOCK`. CVE-2026-0023 is the ninth flag in the same class. `INSTALL_FROM_MANAGED_USER_OR_PROFILE` is what the same function read from the caller's Parcel without scrubbing for two release cycles.","post_id":627,"slug":"android-cve-2026-0023-scrub-list-had-eight","title":"CVE-2026-0023: Android's PackageInstaller Scrubs Eight Caller-Controlled Install Flags. INSTALL_FROM_MANAGED_USER_OR_PROFILE Was The Ninth.","type":"initial","unreadable_sentence":"The Parcel encoding is one int. There is no per-bit access control on the wire and there is no record of which Builder method, if any, set which bit."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCatpPNwAKCRDeZjl4jgkQ JssvAQDXppYSL8t+QXpiLThAsSi7/FWw35qBMz6uS0yS1/tGaAEA/ZCS5uC/NANU Gu8MEamu6iDZTUpCRGXDXv2O7HfdVQ4= =WCAt -----END PGP SIGNATURE-----