CVE-2026-58870 AI-generated analysis
platform/packages/modules/Wifi, Wi-Fi P2P service (service/java/com/android/server/wifi/p2p/WifiP2pServiceImpl.java)
WifiP2pServiceImpl now stores each IWifiP2pListener's AttributionSource at registration and, when broadcasting onPersistentGroupsChanged, sends an empty WifiP2pGroupList to listeners lacking NETWORK_SETTINGS/NETWORK_STACK/READ_WIFI_CREDENTIAL and redacts the own device MAC for listeners lacking LOCAL_MAC_ADDRESS.
Root cause
In WifiP2pServiceImpl, the onPersistentGroupsChanged broadcast loop called mWifiP2pListeners.getBroadcastItem(i).onPersistentGroupsChanged(p2pGroupList) for every registered IWifiP2pListener with the full persistent group list, without any signature-permission check and without erasing the own device's MAC address. registerWifiP2pListener only enforced the nearby-devices permission and registered the listener without recording the caller's identity (mWifiP2pListeners.register(listener)), so the broadcast path had no UID to check against. Per the commit message, it broadcast to all registered listeners without enforcing signature permissions or redacting the own device's MAC address.
How the fix works
- WifiP2pServiceImpl.java:registerWifiP2pListener: reads the AttributionSource from extras (null-safe on extras) with the typed getParcelable(key, AttributionSource.class); throws IllegalArgumentException if it is null and SecurityException if attributionSource.checkCallingUid() fails; then passes that AttributionSource to mWifiPermissionsUtil.enforceNearbyDevicesPermission and registers the listener with it as the RemoteCallbackList cookie: mWifiP2pListeners.register(listener, attributionSource).
- WifiP2pServiceImpl.java: onPersistentGroupsChanged broadcast loop: for each listener it fetches the cookie via mWifiP2pListeners.getBroadcastCookie(i) and skips the listener (with an error log) if it is null; if checkNetworkSettingsOrNetworkStackOrReadWifiCredentialPermission(source.getUid()) is false it delivers new WifiP2pGroupList() (empty) and continues; otherwise it delivers mP2pStateMachine.maybeEraseOwnDeviceAddress(p2pGroupList, source.getUid()), which per the new tests replaces the own device address with 02:00:00:00:00:00 when the UID lacks LOCAL_MAC_ADDRESS.
- WifiP2pServiceImplTest.java: setup now registers mP2pListener with an AttributionSource for Binder.getCallingUid(); new tests cover unauthorized listener (empty list), MAC redaction with and without LOCAL_MAC_ADDRESS, null AttributionSource (IllegalArgumentException) and UID mismatch (SecurityException); factory reset tests adjust checkNetworkSettingsPermission call counts because the broadcast now performs an extra check.
Completeness
- Covers only the onPersistentGroupsChanged broadcast of IWifiP2pListener; the diff touches no other IWifiP2pListener callback in WifiP2pServiceImpl (tests show onGroupCreated delivering a WifiP2pGroup with an owner device), and the material does not show whether those paths already redact or gate data.
- Registration is now fail-closed: a missing or UID-mismatched AttributionSource rejects the registration, and a listener with a null cookie is skipped at broadcast time, so there is no legacy path that still receives unfiltered data.
- Unauthorized listeners are not silenced; they still receive the callback but with an empty WifiP2pGroupList.
- The redaction relies on the existing mP2pStateMachine.maybeEraseOwnDeviceAddress(WifiP2pGroupList, int) helper; its implementation is not in the material.
Behavior changes
- registerWifiP2pListener throws IllegalArgumentException when extras is null or lacks WifiManager.EXTRA_PARAM_KEY_ATTRIBUTION_SOURCE (previously a null extras would NPE and a missing source was passed through to enforceNearbyDevicesPermission).
- registerWifiP2pListener throws SecurityException when the AttributionSource UID does not match the Binder calling UID.
- Listeners without NETWORK_SETTINGS, NETWORK_STACK or READ_WIFI_CREDENTIAL now receive an empty WifiP2pGroupList from onPersistentGroupsChanged.
- Listeners with those permissions but without LOCAL_MAC_ADDRESS now receive the list with the own device address replaced by 02:00:00:00:00:00.
- One additional checkNetworkSettingsPermission call per listener per persistent-groups broadcast (visible in the updated factory reset tests).
Per major
- Android 14: not affected per the bulletin; the patched region is only partially present (4/8 lines) at android-security-14.0.0_r31 and no fix commit is recorded there
- Android 15: same fix: commit 3614d2e9c5fb in android-security-15.0.0_r19 (cherry-pick of 964377f10006, Change-Id I55bbffb01970876a4ba2aead2d86e95a40d22b8d); 7/8 lines of the patched region present
- Android 16: same fix: commit 082c38fa9877 in android-security-16.0.0_r10; identical WifiP2pServiceImpl.java diff; the test diff mainly differs in not adding testP2pListenerWpsGroupCreated (it appears to exist already), with minor context/whitespace differences; 7/8 lines present
- Android 17: same fix: commit 45fb77ab8884 in android-security-17.0.0_r3; identical WifiP2pServiceImpl.java diff; the test diff additionally removes a registerWifiP2pListener(mP2pListener, TEST_PACKAGE_NAME, mBundle) call in testGroupRemovedBeforeGroupFormed; 7/8 lines present
Unknowns
- Whether other IWifiP2pListener callbacks (e.g. onGroupCreated) expose the same data without gating; the material only shows the onPersistentGroupsChanged loop.
- The implementation of mP2pStateMachine.maybeEraseOwnDeviceAddress and whether it copies the list before redaction (inferred only from the tests).
- What the framework-side WifiP2pManager.registerWifiP2pListener puts in extras, i.e. whether existing clients always supplied the AttributionSource before this change.
- Why Android 14 is listed as not affected despite registerWifiP2pListener being gated on SdkLevel.isAtLeastT().
- Whether other P2P paths already gate persistent group data behind signature permissions or LOCAL_MAC_ADDRESS.