CVE-2026-59005 AI-generated analysis
platform/packages/providers/TelephonyProvider, MmsProvider (MMS content provider insert path)
Moves the subscription-ownership check (ProviderUtil.allowInteractingWithEntryOfSubscription) in MmsProvider.insertInternal out of the TABLE_PDU-only branch so it is enforced for every MMS insert table, including addr and part.
Root cause
In MmsProvider.insertInternal, the call to ProviderUtil.allowInteractingWithEntryOfSubscription(getContext(), subId, callerUserHandle) was nested inside `if (table.equals(TABLE_PDU))`. Inserts targeting other tables (for example TABLE_ADDR via content://mms/<id>/addr and TABLE_PART) therefore skipped the check that the subscription id in the values (or the default SMS subscription) is associated with the calling user, allowing a caller in one profile to write MMS address/part rows tied to a subscription belonging to another profile (the commit describes this as cross-profile MMS content injection).
How the fix works
- src/com/android/providers/telephony/MmsProvider.java:insertInternal: the `if (!ProviderUtil.allowInteractingWithEntryOfSubscription(getContext(), subId, callerUserHandle))` block is hoisted to immediately after subId is resolved (from Telephony.Sms.SUBSCRIPTION_ID in values, else SmsManager.getDefaultSmsSubscriptionId()), before the table dispatch. On failure it still calls TelephonyUtils.showSwitchToManagedProfileDialogIfAppropriate and returns null. The TABLE_PDU branch now starts directly with the addDate/addMsgBox logic.
- tests/src/com/android/providers/telephony/MmsProviderTest.java: setup mocks SubscriptionManager and UserManager (isSubscriptionAssociatedWithUser true, isManagedProfile false) so existing tests pass the new check; adds testInsert_unassociatedSubId_forAddrOrPartTable_isBlocked which inserts into content://mms/1/addr with SUBSCRIPTION_ID=1 while isSubscriptionAssociatedWithUser(1, ...) returns false and asserts the insert returns null.
Completeness
- Covers all tables reached through MmsProvider.insertInternal (pdu, addr, part and any other table handled there), since the check now precedes table dispatch.
- The value validated is the subId taken from the caller-supplied ContentValues (or the default SMS subscription when absent); in the shown code the check does not use a subscription derived from the parent PDU row referenced by the URI.
- Only the insert path is changed; the material does not show the query/update/delete paths of MmsProvider, so their handling of subscription association is not visible here.
Behavior changes
- Inserts into non-pdu MMS tables (addr, part, etc.) now return null when the subscription id is not associated with the calling user, and may trigger the switch-to-managed-profile dialog via TelephonyUtils.showSwitchToManagedProfileDialogIfAppropriate.
- MmsProviderTest now requires mocked SubscriptionManager/UserManager system services in its context.
Per major
- Android 14: adapted fix (50196bfe2002, android-security-14.0.0_r31): same hoisting, but the check is TelephonyPermissions.checkSubscriptionAssociatedWithUser instead of ProviderUtil.allowInteractingWithEntryOfSubscription; test changes identical; 8/8 patched lines present.
- Android 15: same fix (c8373a5f6d0e, android-security-15.0.0_r19), cherry-pick of a8cf618a797f; 8/8 patched lines present.
- Android 16: same fix (70b9404db328, android-security-16.0.0_r10), identical hunk at a different line offset; 8/8 patched lines present.
- Android 17: same fix (95af247d92b5, android-security-17.0.0_r3), identical source hunk at line ~765; test diff adjusted for existing ReadRestrictionStatsLogger/Mockito imports; 8/8 patched lines present.
Unknowns
- Whether the query, update and delete paths of MmsProvider apply an equivalent per-table check is not shown in the material.
- The internals of ProviderUtil.allowInteractingWithEntryOfSubscription (e.g. handling of invalid subId) are not included.