{"id":"CVE-2026-55784","aliases":[],"url":"https://o3.security/vulnerability/CVE-2026-55784","summary":"free5GC AUSF authentication contexts can be overwritten by concurrent requests for the same SUPI","details":"### Summary\n\nThe AUSF component of free5GC stores per-subscriber authentication state in a global `sync.Map` keyed only by SUPI. Every incoming authentication request creates a new `AusfUeContext` and stores it under that SUPI key without checking whether an authentication procedure is already in progress and without generating a per-session unique identifier.\n\nAn attacker with access to the AUSF SBI/N12 interface can send concurrent `POST /nausf-auth/v1/ue-authentications` requests for the same target SUPI. Each request is accepted and overwrites the previous authentication context. A valid EAP-AKA' response for an earlier challenge is then verified against the latest overwritten context, whose `K_aut`, `XRES`, and `EapID` no longer match the challenge. The result is a targeted authentication denial of service for that SUPI while the request flood is maintained.\n\nThis issue was confirmed on `github.com/free5gc/ausf` v1.4.4 and current main as of June 2026.\n\n### Details\n\nThe vulnerable context pool is defined in `internal/context/context.go`.\n\n`UePool` is a `sync.Map`, which makes individual map operations safe, but it does not make the authentication procedure state safe. The problem is the session design: the key is only the SUPI, and `Store()` unconditionally replaces any active context for that SUPI.\n\n```go\ntype AUSFContext struct {\n    suciSupiMap sync.Map\n    UePool      sync.Map\n    // ...\n}\n\ntype AusfUeContext struct {\n    Supi string\n    // ...\n\n    // for EAP-AKA'\n    K_aut    string\n    XRES     string\n    Rand     string\n    EapID    uint8\n    Resynced bool\n}\n\nfunc NewAusfUeContext(identifier string) (ausfUeContext *AusfUeContext) {\n    ausfUeContext = new(AusfUeContext)\n    ausfUeContext.Supi = identifier\n    return ausfUeContext\n}\n\nfunc AddAusfUeContextToPool(ausfUeContext *AusfUeContext) {\n    ausfContext.UePool.Store(ausfUeContext.Supi, ausfUeContext)\n}\n```\n\nThe vulnerable sequence is executed for every authentication request in `internal/sbi/processor/ue_authentication.go`:\n\n```go\nueid := authInfoResult.Supi\nausfUeContext := ausf_context.NewAusfUeContext(ueid)\nausfUeContext.ServingNetworkName = snName\nausfUeContext.AuthStatus = models.AusfUeAuthenticationAuthResult_ONGOING\nausfUeContext.UdmUeauUrl = udmUrl\nausf_context.AddAusfUeContextToPool(ausfUeContext)\n```\n\nThere is no guard such as `LoadOrStore`, no `AUTHENTICATION_IN_PROGRESS` response, no rate limit per SUPI, and no unique authentication-session ID in the context URL. For EAP-AKA', the returned context URL is derived directly from the SUCI/SUPI path:\n\n```text\n/nausf-auth/v1/ue-authentications/{suci}/eap-session\n```\n\nAll concurrent authentication attempts for the same subscriber therefore point to the same logical context URL, while the backing `AusfUeContext` in `UePool` is repeatedly replaced.\n\nWhen the EAP response is later processed, the AUSF looks up the current context by SUPI:\n\n```go\ncurrentSupi := ausf_context.GetSupiFromSuciSupiMap(eapSessionID)\nausfCurrentContext := ausf_context.GetAusfUeContext(currentSupi)\n```\n\nThe EAP-AKA' response is then verified against the current context's `K_aut` and `XRES`:\n\n```go\nK_autStr := ausfCurrentContext.K_aut\nXMAC := CalculateAtMAC(K_aut, decodeEapAkaPrimePkt.MACInput)\nMAC := decodeEapAkaPrimePkt.Attributes[ausf_context.AT_MAC_ATTRIBUTE].Value\nXRES := ausfCurrentContext.XRES\nRES := hex.EncodeToString(decodeEapAkaPrimePkt.Attributes[ausf_context.AT_RES_ATTRIBUTE].Value)\n\nif !bytes.Equal(MAC, XMAC) {\n    eapOK = false\n    eapErrStr = \"EAP-AKA' integrity check fail\"\n} else if XRES == RES {\n    logger.AuthELog.Infoln(\"Correct RES value, EAP-AKA' auth succeed\")\n    // ...\n}\n```\n\nIf another request has overwritten the context between challenge issuance and response processing, the legitimate response is checked against the wrong `K_aut` and fails the AT_MAC verification.\n\n### Attack flow\n\nThe attack is selective for a target SUPI:\n\n1. The legitimate procedure starts and the AUSF stores `ctx_LEGIT` under `UePool[target_supi]`.\n2. The attacker sends many concurrent authentication requests for the same target SUCI/SUPI.\n3. Each request obtains a new authentication vector and stores a new context under the same SUPI key.\n4. `ctx_LEGIT` is overwritten by `ctx_ATTACK`.\n5. The legitimate EAP response, computed with `K_aut_LEGIT`, reaches `/eap-session`.\n6. The AUSF retrieves `ctx_ATTACK` by SUPI and computes `XMAC` with `K_aut_ATTACK`.\n7. AT_MAC verification fails and the AUSF returns an EAP-AKA' notification failure.\n\n\nWhen later contexts carry different session material, a continuous flood prevents the target subscriber from completing authentication because the AUSF's stored context keeps changing before the response is processed.\n\n### PoC and evidence\n\nThe issue was reproduced in two phases in a controlled free5GC lab.\n\n#### Phase 1: context overwrite\n\nExperiment:\n\n- 3 rounds of 8 concurrent `POST /nausf-auth/v1/ue-authentications` requests.\n- Same target SUCI: `suci-0-001-01-0-0-0-0000000002`.\n- AUSF listening on `0.0.0.0:8100`; PoC connected to `127.0.0.1:8100`.\n\nObserved result:\n\n- 24/24 requests returned HTTP 201.\n- 24 distinct EapIDs were issued:\n\n```text\n[131, 11, 157, 99, 182, 232, 127, 228, 119, 36, 104, 10,\n 107, 61, 66, 26, 110, 9, 210, 202, 53, 224, 237, 86]\n```\n\n- All responses used the same auth context URL:\n\n```text\n/nausf-auth/v1/ue-authentications/suci-0-001-01-0-0-0-0000000002/eap-session\n```\n\n- AUSF logs showed repeated context creation for the same SUCI/SUPI in a short interval:\n\n```text\nAdd SuciSupiPair (suci-0-001-01-0-0-0-0000000002, imsi-001010000000002) to map.\nUse EAP-AKA' auth method\n| 201 | POST | /nausf-auth/v1/ue-authentications\n...\n```\n\nThis confirms that concurrent authentication requests for the same SUPI are accepted independently but collapse onto one shared context key.\n\n#### Phase 2: valid EAP response fails after overwrite\n\nThe second PoC used a mock UDM with h2c support that returns different EAP-AKA' vectors by request counter for the same SUCI. This makes the overwrite directly observable:\n\n| Request | Vector class | XRES | Effect |\n|---|---|---|---|\n| 1st | LEGIT | `0102030405060708` | response client computes AT_MAC with `K_aut_LEGIT` |\n| 2nd and later | ATTACK | `deadbeefcafe0000` | flood overwrites AUSF context with `K_aut_ATTACK` |\n\nBaseline without flood:\n\n```text\nPOST /ue-authentications\n  -> EapID=120, context with K_aut_LEGIT stored\n\nPOST /eap-session with AT_MAC(K_aut_LEGIT)\n  -> AUSF log: Correct RES value, EAP-AKA' auth succeed\n  -> HTTP 200, EAP success\n```\n\nRace condition run:\n\n```text\nPOST /ue-authentications\n  -> EapID=243, context with K_aut_LEGIT stored\n\n20 concurrent POST /ue-authentications requests for the same SUCI\n  -> 20/20 accepted\n  -> K_aut_ATTACK overwrites K_aut_LEGIT in UePool\n\nPOST /eap-session with AT_MAC(K_aut_LEGIT)\n  -> AUSF validates against K_aut_ATTACK\n  -> AUSF log: EAP-AKA' failure: EAP-AKA' integrity check fail\n  -> HTTP 200, EAP notification failure\n```\n\nCritical AUSF log excerpt:\n\n```text\nAdd SuciSupiPair (suci-0-001-01-0-0-0-0000000002, imsi-001010000000002) to map.\n... repeated for the same SUCI/SUPI ...\nEapAuthComfirmRequest\n[WARN] EAP-AKA' failure: EAP-AKA' integrity check fail\n| 200 | 127.0.0.1 | POST | /nausf-auth/v1/ue-authentications/.../eap-session |\n```\n\nBaseline and attack logs are in the private evidence bundle:\n\n```text\nhallazgos/finding13-ausf-auth-race/evidencia/20260527-195933-race-condition-p2-final/\n```\n\nThe final PoC uses a Python client that constructs a protocol-valid synthetic EAP-AKA' response from known vectors. It is not a full UERANSIM/AMF trace, and the P2 run uses a mock UDM returning distinct LEGIT/ATTACK vectors to make the overwrite observable. The synthetic response is sufficient to prove the AUSF state bug because the baseline succeeds with the same client and vectors, while the flood run fails at the exact AT_MAC check predicted by the code.\n\n### Impact\n\nThe confirmed impact is targeted denial of authentication service for a chosen SUPI.\n\nAn attacker with access to the AUSF SBI/N12 interface can keep a subscriber from authenticating by continuously overwriting that subscriber's AUSF context. The AUSF process remains running; this is not a process crash and does not expose authentication material to the attacker. The availability impact is on the AUSF's primary security function for the targeted subscriber.\n\nIn the default free5GC deployment observed in the lab, the AUSF reported OAuth2 disabled and listened on `0.0.0.0:8100`. In a production deployment with strict SBI isolation, mTLS, OAuth2, or firewalling, the attacker would need access to the internal SBA network or control of a network function that can send AUSF authentication requests.\n\n### Suggested remediation\n\nThe most robust fix is to stop using SUPI as the sole authentication-session key.\n\nRecommended design:\n\n1. Generate a unique session identifier for every authentication request.\n2. Store the `AusfUeContext` under that session identifier.\n3. Return the session identifier in the auth context URL.\n4. On `/eap-session` or `/5g-aka-confirmation`, retrieve the exact session context by session ID rather than by SUPI.\n\nConceptual example:\n\n```go\nsessionID := uuid.New().String()\nausfUeContext := ausf_context.NewAusfUeContext(sessionID)\nausfUeContext.Supi = ueid\n// populate context...\nausf_context.AddAusfUeContextToPool(ausfUeContext)\n\n// Return:\n// /nausf-auth/v1/ue-authentications/{sessionID}/eap-session\n```\n\nIf the intended behavior is to allow only one active authentication procedure per SUPI, use an atomic check-and-insert operation and reject concurrent attempts explicitly:\n\n```go\nif existing, loaded := ausf_context.LoadOrStoreAusfUeContext(ueid, newCtx); loaded {\n    if existing.AuthStatus == models.AusfUeAuthenticationAuthResult_ONGOING {\n        c.JSON(http.StatusConflict, models.ProblemDetails{\n            Status: http.StatusConflict,\n            Cause:  \"AUTHENTICATION_IN_PROGRESS\",\n        })\n        return\n    }\n}\n```\n\nA mutex inside `AusfUeContext` alone is not sufficient if new requests are still allowed to replace the global map entry for the same SUPI.\n\nAdditional hardening:\n\n- Apply per-SUPI rate limiting on `POST /ue-authentications`.\n- Enable and enforce OAuth2/mTLS for SBI access in deployments.\n- Add tests for concurrent authentication requests targeting the same SUPI.\n\n### Prior art / non-duplication note\n\nKnown related issues appear to be different:\n\n- CVE-2026-33063 / GHSA-4jrw-92fg-4jwx affects free5GC AUSF, but concerns a nil interface conversion / DoS in `GetSupiFromSuciSupiMap`. It does not cover authentication context overwrite by concurrent requests.\n- CVE-2026-44318 affects free5GC BSF and concerns a different concurrency issue in a different NF. It does not cover AUSF `UePool` authentication state keyed by SUPI.","published":"2026-08-28T22:24:11Z","modified":"2026-08-28T22:30:06.458654044Z","cvss":{"score":7.5,"severity":"HIGH","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"},"epss":null,"cisaKev":null,"exploitsKnown":null,"affectedPackages":[{"ecosystem":"Go","name":"github.com/free5gc/ausf","fixedVersion":null}],"fix":null,"references":[{"type":"WEB","url":"https://github.com/free5gc/free5gc/security/advisories/GHSA-334q-h5g3-fpxv"},{"type":"PACKAGE","url":"https://github.com/free5gc/free5gc"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-08-28T22:30:06.458654044Z"}}