Skip to content

Fix TS.43 EAP-AKA identity and entitlement request semantics - #2

Open
keeltrace wants to merge 3 commits into
naormeit:rcs-bounty-2994from
keeltrace:keeltrace/2994-ts43-eap-realm
Open

keeltrace wants to merge 3 commits into
naormeit:rcs-bounty-2994from
keeltrace:keeltrace/2994-ts43-eap-realm

Conversation

@keeltrace

@keeltrace keeltrace commented Sep 10, 2026

Copy link
Copy Markdown

Summary

This remains a focused follow-up on the TS.43 path in rcs-bounty-2994 / microg#3784. It now contains three independent correctness fixes, each kept as an attributable commit:

  1. d61bba261f44fbd1af35d52855567e33c45d9e54 — preserve the exact EAP identity used in the exchange when deriving EAP-AKA keys, including alternate realms.
  2. 5776fbdfb3bd830f190938f6465acf2f3f41299d — honor an explicit TS.43 terminal_id; use the device IMEI only as fallback.
  3. 9b728c8eab66ce172339fb93adefadb94340db43 — when the entitlement request omits terminal metadata, default vendor/model/software-version from the device before applying the existing GMS-compatible truncation lengths.

Why these matter

EAP-AKA identity

The flow already uses Ts43Challenge.eap_aka_realm when constructing the EAP_ID sent to the carrier. Before the first commit, performSimAkaAuth rebuilt a default-realm identity before deriving K_aut. RFC 4187 section 7 derives the master key from the identity used in the exchange, so alternate-realm flows could MAC the response using a different identity than the one sent to the carrier.

terminal_id precedence

The existing builder used the device IMEI whenever available and only used ServiceEntitlementRequest.terminal_id when IMEI was null. Android's Service Entitlement implementation does the reverse: an explicit request terminal ID wins, with IMEI as the fallback.

terminal metadata defaults

The existing builder could send empty terminal_vendor, terminal_model, and terminal_sw_version values when the request omitted them. Android's Service Entitlement request defaults these fields from the device (Build.MANUFACTURER, Build.MODEL, and Android software version). The third commit adds the same fallback behavior while preserving explicit request values and the existing truncation limits.

Verification

Prepared on top of naormeit/GmsCore:rcs-bounty-2994 at 063ccbea736763234b439f4a5802ccbe18e27649.

Dedicated proof run: https://github.com/keeltrace/GmsCore/actions/runs/34563119544

  • focused TS.43 unit tests: PASS
  • :play-services-constellation-core:lintDebug: PASS
  • :play-services-constellation-core:assembleDebug: PASS

The proof branch contains only the same code/test tree plus an isolated CI workflow; that workflow is not part of this PR.

Prior work / attribution

This is a narrow follow-up to the Constellation/Asterism implementation by @opstic in microg#3359 / microg#3360 and the integration work in microg#3784. It does not claim ownership of that base implementation.

References:

Limitations

No TS.43 carrier/SIM hardware end-to-end test has been run yet. These are protocol/request-construction corrections with unit/lint/build verification, not a claim that this PR alone completes microg#2994.

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@keeltrace keeltrace changed the title Fix TS.43 EAP-AKA key derivation for alternate realms Fix TS.43 EAP-AKA identity and entitlement request semantics Sep 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant