CVE-2026-58963 AI-generated analysis
platform/packages/services/Iwlan, ePDG tunnel management (EpdgTunnelManager / NetworkSliceSelectionAssistanceInformation)
Iwlan's S-NSSAI parser now builds the 3-byte Slice Differentiator as an unsigned 24-bit value and maps the reserved value 0xFFFFFF to SLICE_DIFFERENTIATOR_NO_SLICE before it reaches NetworkSliceInfo.Builder. EpdgTunnelManager now wraps per-payload IKE 3GPP data processing in a RuntimeException catch and null-checks the TunnelConfig, so a malformed N1 mode information payload from the ePDG no longer crashes the Iwlan process.
Root cause
EpdgTunnelManager handles IKE 3GPP notify payloads (DATA_TYPE_NOTIFY_N1_MODE_INFORMATION) delivered through TmIke3gppCallback.onIke3gppDataReceived and feeds the S-NSSAI bytes to NetworkSliceSelectionAssistanceInformation.getSliceInfo, which sets the result on NetworkSliceInfo.Builder. Per the commit message, a previous change removed the filter for the reserved SD value 0xFFFFFF (TS 24.501 9.11.2.8, "no SD value associated with the SST"). That value was therefore handed to Builder.setSliceDifferentiator, which throws IllegalArgumentException because it exceeds the maximum 0xFFFFFE; the exception was not caught and crashed the process. The Android 17 pre-fix code shows that form: getSD returned the unsigned 24-bit value with no reserved-value check. The Android 14/15/16 pre-fix getSD still compared against 0xFFFFFF but built the value by OR-ing signed bytes without masking, so any SD byte with the high bit set was sign-extended into a negative int that bypassed the 0xFFFFFF comparison and was passed to the Builder as-is. In addition, the handler dereferenced mApnNameToTunnelConfig.get(apnName) without a null check and cast the payload to Ike3gppN1ModeInformation / Ike3gppBackoffTimer without an instanceof check, with no exception handling around any of it.
How the fix works
- NetworkSliceSelectionAssistanceInformation.java:parseSliceDifferentiator (renamed from getSD): builds the SD as ((b0 & 0xFF) << 16) | ((b1 & 0xFF) << 8) | (b2 & 0xFF), then returns NetworkSliceInfo.SLICE_DIFFERENTIATOR_NO_SLICE when the result equals the new constant RESERVED_SD_VALUE (0xFFFFFF), otherwise the value. The out-of-range fallback now returns SLICE_DIFFERENTIATOR_NO_SLICE instead of SLICE_SERVICE_TYPE_NONE. This is used for both the SD (offset 1) and the mapped HPLMN SD (offset 5).
- NetworkSliceSelectionAssistanceInformation.java:getSliceInfo: switch restructured with named length constants (LENGTH_SST_ONLY ... LENGTH_SST_SD_MAPPED_SST_AND_MAPPED_SD); SST is set once before the switch via parseSliceServiceType (renamed from getSST, made package-private); the length validation against VALID_LENGTHS is unchanged. The android.support.annotation.NonNull import is dropped.
- EpdgTunnelManager.java: the Ike3gppDataReceived handler now checks tunnelConfig != null after mApnNameToTunnelConfig.get(apnName); if it is null, it logs a warning and skips processing. Otherwise it loops over the payloads and calls the new processIke3gppData(tunnelConfig, payload).
- EpdgTunnelManager.java:processIke3gppData (new): contains the former per-payload logic (N1 mode information -> getSliceInfo -> setSliceInfo; backoff timer -> decodeBackoffTime -> setBackoffTime) inside try { ... } catch (RuntimeException e), which logs 'Exception while processing 3GPP payload' and continues. IllegalArgumentException from the Builder, ClassCastException from the payload casts, or any other RuntimeException in that block therefore no longer propagates to the handler thread.
- EpdgTunnelManager.java: TunnelConfig.setSliceInfo and the TmIke3gppCallback constructor are changed from public/private to package-private so the new tests (testProcessIke3gppData_* in EpdgTunnelManagerTest) can drive the callback directly.
- Tests: NetworkSliceSelectionAssistanceInformationTest is rewritten with a parseAndAssertSliceInfo helper and new cases for the reserved SD (0xFFFFFF) in SD and mapped SD, unsigned conversion (0xFFFFEF), and invalid offsets for parseSliceServiceType/parseSliceDifferentiator. EpdgTunnelManagerTest adds success, exception-handled (ClassCastException) and null-TunnelConfig cases.
Completeness
- Both SD fields (SD at offset 1 and mapped HPLMN SD at offset 5) go through parseSliceDifferentiator, so the reserved-value mapping and unsigned assembly apply to all lengths 4, 5 and 8.
- parseSliceServiceType is unchanged apart from the rename; it already used Byte.toUnsignedInt. The material does not show whether NetworkSliceInfo.Builder.setSliceServiceType / setMappedHplmnSliceServiceType reject any 0..255 value. Any such rejection would now be absorbed by the RuntimeException catch rather than crash.
- The catch (RuntimeException) in processIke3gppData is a backstop for the whole per-payload block, including the Ike3gppBackoffTimer path and the unchecked casts. It does not add instanceof checks, so a mismatched payload type is still handled only by catching ClassCastException.
- The null check covers only the Ike3gppDataReceived handler's mApnNameToTunnelConfig.get(apnName) lookup; other handlers in EpdgTunnelManager are not touched by this change.
- The length validation (VALID_LENGTHS) and the null-snssai check in getSliceInfo are unchanged.
Behavior changes
- SD or mapped SD bytes FF FF FF now yield NetworkSliceInfo.SLICE_DIFFERENTIATOR_NO_SLICE (-1) in the resulting NetworkSliceInfo. Before the fix they caused an exception (17) or went through sign-extended arithmetic (14/15/16).
- On 14/15/16, SD values whose bytes have the high bit set (e.g. 0xFFFFEF) are now parsed as the correct unsigned 24-bit value instead of a sign-extended negative int.
- parseSliceDifferentiator's out-of-bounds fallback returns SLICE_DIFFERENTIATOR_NO_SLICE instead of SLICE_SERVICE_TYPE_NONE.
- A RuntimeException while processing one IKE 3GPP payload is logged (Log.e) and that payload is skipped; the remaining payloads in the list are still processed.
- If no TunnelConfig exists for the APN when 3GPP data arrives, the payloads are ignored with a Log.w instead of a NullPointerException.
- TunnelConfig.setSliceInfo and TmIke3gppCallback(String, int) become package-private (test-visibility change, no functional effect).
Per major
- Android 14: Same fix, commit 67dacb3a0166 in android-security-14.0.0_r31: identical source changes to EpdgTunnelManager.java and NetworkSliceSelectionAssistanceInformation.java at different line offsets (handler near line 1745, new method near line 2182). Pre-fix getSD had the signed-byte assembly with the 0xFFFFFF comparison. Test diffs adapted (PersistableBundle already imported, verify(...).onOpened with two args).
- Android 15: This commit, 0f6cb0efeb6d in android-security-15.0.0_r19: source changes as analysed. Pre-fix getSD had the signed-byte assembly with the 0xFFFFFF comparison. Tests under test/com/google/android/iwlan/epdg/.
- Android 16: Same fix, commit 5177f7686879 in android-security-16.0.0_r10: identical source changes at different offsets (handler near line 2415, new method near line 2969). Pre-fix getSD identical to 14/15. EpdgTunnelManagerTest adapted for the three-argument onOpened callback (extra any()).
- Android 17: Adapted fix, commit f9bbc40e8eab in android-security-17.0.0_r3. Pre-fix getSD already used the unsigned (& 0xFF) assembly but had no reserved-value check and returned SLICE_SERVICE_TYPE_NONE as its fallback (the form the commit message describes). The fix adds the RESERVED_SD_VALUE mapping and the NO_SLICE fallback. getSliceInfo already used arrow-switch syntax. Tests live under test/instrumentation/, and NetworkSliceSelectionAssistanceInformationTest only gains the four new cases because it was already refactored.
Unknowns
- The exact input that crashed Android 14/15/16 builds is not shown. The commit message describes the Android 17 code form (filter removed), while the 14/15/16 pre-fix getSD still compared against 0xFFFFFF but used sign-extended bytes.
- The material does not include the validation that NetworkSliceInfo.Builder.setSliceDifferentiator performs on negative values, or that setSliceServiceType performs; only the 0xFFFFFE maximum is stated in the commit message.
- Which 'previous change' removed the reserved-value filter is not identified.
- How the Iwlan fix is delivered to devices (platform build vs. separately updatable module) is not stated in the material.