
PoC and lab for CVE-2026-102945: a zero-length UESecurityCapabilities BIT STRING in an NGAP Path Switch Request panics OMEC AMF, with vulnerable/fixed containers and exploit script.
UESecurityCapabilities bit string| CVE | CVE-2026-102945 |
| Component | OMEC amf — ngap/handler.go::HandlePathSwitchRequest (5G NGAP path-switch handling) |
| Affected | < 1.7.1-0.20260725031321-d28042aaaea0 (confirmed at HEAD daed5a2, present in v3.1.5) |
| Fixed in | commit d28042aa (Guard against empty UESecurityCapabilities Bytes to avoid index panic, GHSA-v6w5-38cf-pcv8) |
| CWE | CWE-129 (Improper Validation of Array Index), CWE-248 (Uncaught Exception) |
| Impact | HandlePathSwitchRequest guards the UESecurityCapabilities IE for presence but never for length, and the extensible APER type silently yields an empty bit string. Six unguarded Bytes[0] reads panic on an unrecovered goroutine and terminate the AMF process. The AMF is the control-plane entry point for a 5G core, so terminating it drops mobility management for every subscriber |
| Vector | A peer NGAP Path Switch Request carrying an extensible, zero-length UESecurityCapabilities BIT STRING |
| Trigger | Path Switch Request with UESecurityCapabilities present but Bytes empty → six Bytes[0] reads |
The vulnerable code checked only for nil:
// ngap/handler.go — pre-fix (line 3267)
if uESecurityCapabilities != nil { // presence only
amfUe.UESecurityCapability.SetEA1_128_5G((uESecurityCapabilities.NRencryptionAlgorithms.Value.Bytes[0] & 0x80) >> 7)
... // five more Bytes[0] reads
}
The fix requires at least two bytes and ignores the IE per its CRITICALITY:
// fixed (commit d28042aa)
if len(uESecurityCapabilities.NRencryptionAlgorithms.Value.Bytes) < 2 ||
len(uESecurityCapabilities.NRintegrityProtectionAlgorithms.Value.Bytes) < 2 {
ran.Log.Warnln("UESecurityCapabilities bit string too short ... ignoring IE ...")
} else {
... // the six original reads
}
UESecurityCapabilities is declared with an extensible APER BIT STRING
(aper:"sizeExt,sizeLB:16,sizeUB:16"). When a peer sets the extension bit,
the APER decoder discards the SIZE(16) constraint and returns successfully
with an empty Bytes slice. The handler's only guard was a nil check on
the containing IE, so all six Bytes[0] reads (three encryption and three
integrity algorithm flags) executed against a zero-length slice. Go raises
runtime error: index out of range [0] with length 0; the panic is not
recovered in the NGAP handler goroutine and terminates the whole AMF. The fix
checks both bit strings for the minimum two bytes required by
BIT STRING (SIZE(16,...)); because the IE has CRITICALITY IGNORE in a Path
Switch Request, a short value is logged and ignored rather than applied.
| service | image | role |
|---|---|---|
ps-vuln | cve-2026-102945:vuln | upstream block from d28042aa^ (vulnerable) compiled with Go 1.24 |
ps-fixed | cve-2026-102945:fixed | upstream block from d28042aa (fixed) compiled with Go 1.24 |
poc | cve-2026-102945-poc:local | stdlib-only Python driver |
The handler block is copied verbatim from ngap/handler.go at the two
commits; only minimal stubs (APER bit strings, capability setters, ran.Log)
are supplied. The handler is compiled into a binary that runs as a child of
the HTTP service, so the panic is observed as an exit code and a Go stack
trace rather than taking down the service. Input modes: empty (extension
bit → zero-length Bytes) and valid (two bytes, normal decode).
./run-lab.sh build # builds both sides (golang:1.24-alpine + python3)
./run-lab.sh up # cve102945lab network: ps-vuln / ps-fixed
./run-lab.sh sweep
./run-lab.sh down
poc/poc.py (stdlib only):
index out of range panic, 0 when the short IE is
warned and ignored; 3 no worker, 2 unreachable/indeterminate.Bytes[0] reads → unrecovered panic → 5G core
mobility management lost.empty and valid modes with exit codes, panic flags and
stderr snippets (the valid case proves the fix is not dead).d28042aa / len(Bytes) >= 2 / CRITICALITY IGNORE.A standalone full-chain exploit ships at exploit/exploit.py:
python3 exploit/exploit.py --host=ps-vuln
# exit 1 on confirmed panic, 0 on a safe target
| bit string | ps-vuln (d28042aa^) | ps-fixed (d28042aa) |
|---|---|---|
empty (Bytes zero-length) | child exit 2 — panic: index out of range [0] with length 0 | exit 0 — WARN: ... bit string too short ... ignoring IE |
| valid (2 bytes) | exit 0, EA1..IA3 = 1 | exit 0, EA1..IA3 = 1 |
Captured runs: evidence/check-*-run.txt, evidence/exploit-*-run.txt,
evidence/probe-*-run.txt, evidence/mitigation-*-run.txt,
evidence/exploit-standalone-run.txt, evidence/exploit-standalone-fixed-run.txt,
evidence/versions.txt, evidence/upstream-*-block.txt, evidence/0day-sweep.txt.
cve102945lab
network; Go 1.24 toolchain in the lab images.UESecurityCapabilities BIT STRING
to the AMF's SCTP listener.The upstream guard checks both NRencryptionAlgorithms and
NRintegrityProtectionAlgorithms bit strings, covering all six index-zero
reads with one length check. The valid input sets EA1..IA3 to 1 on both
builds, confirming the fix does not disable legitimate capability decoding.
No sibling path with the same presence-only guard was found in this sweep.
README.md this write-up
run-lab.sh environment driver (build / up / sweep / down)
Makefile convenience targets
poc/poc.py the PoC (check / exploit / probe / mitigation)
exploit/exploit.py standalone full-chain exploit
lab/main-vuln.go upstream vulnerable block + minimal stubs
lab/main-fixed.go upstream fixed block + minimal stubs
lab/lab.Dockerfile builds both sides from the Go sources
lab/service.py HTTP wrapper (POST /run), child-process isolation
evidence/ captured runs of every mode on both sides
TRACKING.md excluded (working record)
ngap/handler.go, lines 3267–3274 (pre-fix)