CVE-2026-58884 AI-generated analysis
platform/packages/modules/Wifi, WifiServiceImpl (SoftAp / Local Only Hotspot start path)
Passes the original requestor's UID and PID into WifiServiceImpl.startSoftApInternal and validates them through a new validateSoftApConfigurationInternal helper. SoftApConfiguration privilege validation for Local Only Hotspot therefore no longer evaluates the system server's own identity when it runs on the Wifi handler thread.
Root cause
WifiServiceImpl.startSoftApInternal computed `privileged = isSettingsOrSuw(Binder.getCallingPid(), Binder.getCallingUid())` and passed it to WifiApConfigStore.validateApWifiConfiguration. The LOHS start block, which builds mActiveConfig with IFACE_IP_MODE_LOCAL_ONLY and calls startSoftApInternal(mActiveConfig, request.getWorkSource(), null), runs on the Wifi handler thread, not on the requesting app's binder thread. Per the commit message, Binder.getCallingUid()/getCallingPid() there returned the system server's identity (SYSTEM_UID), so the privilege check (which requires NETWORK_SETTINGS) passed incorrectly. As a result, an unprivileged LOHS requestor's custom SoftApConfiguration with a custom BSSID was accepted.
How the fix works
- service/java/com/android/server/wifi/WifiServiceImpl.java: the public binder API validateSoftApConfiguration now reads Binder.getCallingUid()/getCallingPid() and delegates to a new private validateSoftApConfigurationInternal(config, uid, pid). That helper computes `privileged = isSettingsOrSuw(pid, uid)` and calls WifiApConfigStore.validateApWifiConfiguration(config, privileged, mContext, mWifiNative).
- WifiServiceImpl.startSoftApInternal: the signature changes to (apConfig, requestorWs, callback, uid, pid). The method no longer calls Binder.getCallingUid()/getCallingPid(). It logs uid and pid and validates through validateSoftApConfigurationInternal(softApConfig, uid, pid). On failure it still logs 'Invalid SoftApConfiguration' and notifies the callback if one is present.
- WifiServiceImpl LOHS start block (builds mActiveConfig with IFACE_IP_MODE_LOCAL_ONLY): takes uid from request.getWorkSource() (ws.getUid(0) if the WorkSource is non-null and non-empty, else -1) and pid from request.getPid(), and passes both to startSoftApInternal. Per the commit message, these values are obtained on the binder thread when the request is first received.
- WifiServiceImpl tethered path that calls startSoftApInternal directly: passes callingUid and Binder.getCallingPid().
- WifiServiceImpl.startTetheredHotspot and the request/callback-based tethered method: both pass callingUid and Binder.getCallingPid() to startTetheredHotspotInternal, which gains an `int callingPid` parameter. startTetheredHotspotInternal forwards callingUid/callingPid to startSoftApInternal and passes the captured callingPid to mLastCallerInfoManager.put instead of reading Binder.getCallingPid() again.
- service/tests/wifitests/.../WifiServiceImplTest.java: FakeLohsCallback now records mIsFailed/mFailureReason. The new test testCustomLohs_BssidValidationFailsForUnprivilegedCaller registers a LOHS request with a custom BSSID from uid 9999 (permissions denied). It asserts that ActiveModeWarden.startSoftApis never called and that the callback fails with LocalOnlyHotspotCallback.ERROR_GENERIC.
Completeness
- All three direct call sites of startSoftApInternal in the diff now pass an explicit uid/pid: the LOHS block, the direct tethered call, and startTetheredHotspotInternal (which serves two tethered entry points). startSoftApInternal no longer calls Binder.getCallingUid/getCallingPid.
- The tethered paths read Binder.getCallingPid() at their entry points. The commit message describes only the LOHS path as affected, so the tethered changes look like consistency changes.
- For LOHS, the uid comes from the first entry of the request's WorkSource (-1 if the WorkSource is null or empty), not from a stored caller uid. Whether this is correct depends on how the WorkSource is filled in when the request is created, which the material does not show.
- The public validateSoftApConfiguration binder API still evaluates the direct binder caller, so its behavior is unchanged.
- Other validation inside WifiApConfigStore.validateApWifiConfiguration is untouched. The fix only corrects the `privileged` input.
Behavior changes
- A LOHS request with a custom SoftApConfiguration that needs privilege (for example a custom BSSID), from a requestor that does not pass isSettingsOrSuw, now fails validation. ActiveModeWarden.startSoftAp is not called, the LOHS block reports WIFI_AP_STATE_FAILED / SAP_START_FAILURE_GENERAL, and the app callback receives onHotspotFailed(ERROR_GENERIC) (per the new test).
- The startSoftApInternal trace log now includes pid ('startSoftApInternal uid=% pid=% mode=%').
- mLastCallerInfoManager.put for API_TETHERED_HOTSPOT now records the pid read at the binder entry point instead of one read again later.
Per major
- Android 14: Adapted fix (platform/packages/modules/Wifi 92a476d578f8, android-security-14.0.0_r31). It uses the same validateSoftApConfigurationInternal split and the same uid/pid passing. Differences in the 14 code: there is no ISoftApCallback parameter, validateApWifiConfiguration takes no mWifiNative argument, and the diff touches no startTetheredHotspotInternal. Instead, a tethered method on the API_TETHERED_HOTSPOT path captures callingPid itself and calls startSoftApInternal directly. The LOHS failure path uses onStateChanged(WIFI_AP_STATE_FAILED, ERROR_GENERIC). Resolver: 7/8 patched-region lines present.
- Android 15: This fix (e5e03f250557, android-security-15.0.0_r19). Resolver: 7/8 patched-region lines present.
- Android 16: Same fix (ba0dac1abc08, android-security-16.0.0_r10) with the same production changes. The request-based tethered method also has the tetheringWithSoftApConfig flag expression, but uid/pid are passed the same way. The test differs slightly (generateLocalOnlyHotspotConfig is stubbed with an extra eq(true) argument). Resolver: 7/8 lines present.
- Android 17: Adapted fix (ef93e87553c1, android-security-17.0.0_r3). Before the fix, 17's validateSoftApConfiguration already computed privileged as isSettingsOrSuw || checkNetworkStackPermission || checkMainlineNetworkStackPermission, and startSoftApInternal called validateSoftApConfiguration(softApConfig) directly. The fix moves that logic into validateSoftApConfigurationInternal(config, uid, pid) and passes uid/pid the same way as on the other branches. Resolver: 8/8 lines present.
Unknowns
- How the LocalOnlyHotspotRequestInfo WorkSource and pid are filled in at request time, which decides whether ws.getUid(0)/request.getPid() identify the real requestor.
- How isSettingsOrSuw handles uid -1 (used when the WorkSource is null or empty).
- Which permissions are needed to submit a custom SoftApConfiguration for LOHS in the first place.
- Whether settings other than BSSID depend on `privileged` inside WifiApConfigStore.validateApWifiConfiguration (that function is not in the material).