{"id":"CVE-2026-42082","aliases":["CVE-2026-42082","GHSA-vrrx-58h3-prmh","GO-2026-5673"],"related":[],"kind":"vulnerability","state":"published","title":"free5GC: Missing Concurrent NAS SMC Validation During NGAP Handover","summary":"free5GC is an open-source implementation of the 5G core network. Prior to 4.2.2, the AMF in Free5GC does not enforce the concurrent security procedure rules defined in 3GPP TS 33.501 §6.9.5.1. The AMF does not check for ongoing N2 handover procedures before initiating a NAS Security Mode Command, and vice versa. This can lead to mismatches between NAS and AS security contexts in the network and the UE. This vulnerability is fixed in 4.2.2.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"free5GC is an open-source implementation of the 5G core network. Prior to 4.2.2, the AMF in Free5GC does not enforce the concurrent security procedure rules defined in 3GPP TS 33.501 §6.9.5.1. The AMF does not check for ongoing N2 handover procedures before initiating a NAS Security Mode Command, and vice versa. This can lead to mismatches between NAS and AS security contexts in the network and the UE. This vulnerability is fixed in 4.2.2.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nThe AMF in Free5GC v4.2.1 does not enforce the concurrent security procedure rules defined in 3GPP TS 33.501 §6.9.5.1. The AMF does not check for ongoing N2 handover procedures before initiating a NAS Security Mode Command, and vice versa. This can lead to mismatches between NAS and AS security contexts in the network and the UE.\n\n### Details\n\n**Vulnerability Type:** CWE-358 (Improperly Implemented Security Check for Standard)\n\n**Affected File:** `internal/ngap/handler.go` — `handleHandoverRequiredMain()` and `internal/gmm/sm.go` — `SecurityMode()`\n\n**Root Cause:**\n\n3GPP TS 33.501 §6.9.5.1 states:\n\n> \"Concurrent runs of security procedures may, in certain situations, lead to mismatches between security contexts in the network and the UE. In order to avoid such mismatches, the following rules shall be adhered to:\n> 1. AMF shall not initiate any of the N2 procedures including a new key towards a UE if a NAS Security Mode Command procedure is ongoing with the UE.\n> 2. The AMF shall not initiate a NAS Security Mode Command towards a UE if one of the N2 procedures including a new key is ongoing with the UE.\"\n\nFree5GC AMF uses an `OnGoing` state tracking mechanism (`SetOnGoing()`, `GetOnGoing()`) with `OnGoingProcedureN2Handover` type. However, the cross-procedure checks required by §6.9.5.1 are not implemented:\n\n**Rule 2 violation:**\n`SecurityMode()` in `internal/gmm/sm.go` sends SMC on `EntryEvent` without checking if N2 handover is ongoing.\n\n**Rule 1 violation:**\n`handleHandoverRequiredMain()` in `internal/ngap/handler.go` calls `SetOnGoing(OnGoingProcedureN2Handover)` without checking if SMC is ongoing.\n\n**Why NH/NCC and SMC are related:**\n\nSMC activates a new KAMF, which changes the basis for NH key derivation. The N2 HandoverRequest includes NH/NCC derived from the old KAMF. If both procedures run concurrently, the target gNB and UE derive different KgNB keys, breaking AS security.\n\n### PoC\n\n**Source code evidence:**\n\nFree5GC AMF `internal/gmm/sm.go` — `SecurityMode()`:\n```go\nfunc SecurityMode(state *fsm.State, event fsm.EventType, args fsm.ArgsType) {\n    switch event {\n    case fsm.EntryEvent:\n        // No check for OnGoing N2 procedure\n        // Directly proceeds to SMC\n```\n\nFree5GC AMF `internal/ngap/handler.go` — `handleHandoverRequiredMain()`:\n```go\namfUe.SetOnGoing(sourceUe.Ran.AnType, &context.OnGoing{\n    Procedure: context.OnGoingProcedureN2Handover,\n})\n// No check for ongoing SMC before setting N2\n```\n\n**Packet Evidence (pcap available):**\n\n| Packet | Time | Message | Description |\n|--------|------|---------|-------------|\n| #1 | 0.000s | HandoverRequired | gNB_A requests handover |\n| #18 | 0.002s | **HandoverRequest** | **N2 started (NH/NCC included)** |\n| | | *(no response from gNB_B)* | **N2 ongoing** |\n| #28 | 2.062s | Registration request | UE re-registers (same SUPI) |\n| #63 | 2.069s | Authentication request | |\n| #64 | 2.070s | Authentication response | |\n| #71 | 2.072s | **Security mode command** | **SMC during N2 ongoing = Rule 2 violation** |\n[NGAPHandover-N2-SMC-Concurrent.zip](https://github.com/user-attachments/files/26735421/NGAPHandover-N2-SMC-Concurrent.zip)\n\n\n### Impact\n\n**Integrity (MEDIUM):** Concurrent NAS and AS security procedures can cause security context mismatches between UE, AMF, and gNB. The SMC activates a new KAMF while the N2 HandoverRequest carries NH/NCC derived from the old KAMF, resulting in KgNB derivation mismatch.\n\n**Availability (LOW):** Security context mismatch may cause handover failure or security verification failures.","format":"markdown","source":"ghsa"},{"lang":"en","text":"Free5GC AMF has Missing Concurrent NAS SMC Validation During NGAP Handover in github.com/free5gc/amf","format":"markdown","source":"go"},{"lang":"es","text":"free5GC es una implementación de código abierto de la red central 5G. Antes de 4.2.2, el AMF en Free5GC no aplica las reglas de procedimiento de seguridad concurrentes definidas en 3GPP TS 33.501 §6.9.5.1. El AMF no verifica la existencia de procedimientos de traspaso N2 en curso antes de iniciar un comando de modo de seguridad NAS, y viceversa. Esto puede llevar a desajustes entre los contextos de seguridad NAS y AS en la red y el UE. Esta vulnerabilidad está corregida en 4.2.2.","source":"nvd"}],"published":"2026-05-07T01:56:13.000Z","modified":"2026-10-14T20:10:00.190Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:A/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:L","score":3.7,"rating":"LOW"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:A/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:L","score":3.7,"rating":"LOW"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:A/AC:H/PR:L/UI:N/S:U/C:N/I:L/A:L","score":3.7,"rating":"LOW"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:L","score":5.4,"rating":"MEDIUM"}],"cwes":["CWE-358"],"affected":[{"ranges":[{"version":"< 4.2.2","status":"affected"}],"vendor":"free5gc","product":"free5gc","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","lastAffected":"1.4.3"}],"ecosystem":"Go","package":"github.com/free5gc/amf","purl":"pkg:golang/github.com/free5gc/amf","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"github.com/free5gc/amf","purl":"pkg:golang/github.com/free5gc/amf","source":"go"},{"ranges":[{"status":"affected","fixed":"4.2.2"}],"vendor":"free5gc","product":"free5gc","cpe":"cpe:2.3:a:free5gc:free5gc:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/free5gc/free5gc/security/advisories/GHSA-vrrx-58h3-prmh","tags":["advisory","exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42082","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/free5gc/amf/blame/v1.4.3/internal/gmm/sm.go","tags":["web"],"sources":["ghsa","go"]},{"url":"https://github.com/free5gc/amf/blame/v1.4.3/internal/ngap/handler.go","tags":["web"],"sources":["ghsa","go"]},{"url":"https://github.com/free5gc/free5gc","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-05-28T14:47:10.325Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-42082","url":"https://www.cve.org/CVERecord?id=CVE-2026-42082","licence":"CVE Terms of Use","modified":"2026-05-28T14:47:44.462Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-vrrx-58h3-prmh","url":"https://github.com/advisories/GHSA-vrrx-58h3-prmh","licence":"CC-BY-4.0","modified":"2026-06-25T23:11:09.677Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5673","url":"https://pkg.go.dev/vuln/GO-2026-5673","licence":"CC-BY-4.0","modified":"2026-06-25T23:01:26.471Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-42082","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42082","licence":"Public domain","modified":"2026-10-14T20:10:00.190Z"}],"updatedAt":"2026-11-25T22:59:22.609Z","epss":{"score":0.00222,"percentile":0.13624,"date":"2026-12-01T12:00:22.000Z"}}