GHSA-R99V-75P9-XQM5
Vulnerability from github – Published: 2026-04-22 19:54 – Updated: 2026-04-22 19:54Summary
The HTTPUEContextTransfer handler in internal/sbi/api_communication.go does not include a default case in the Content-Type switch statement. When a request arrives with an unsupported Content-Type, the deserialization step is silently skipped, err remains nil, and the processor is invoked with a completely uninitialized UeContextTransferRequest object.
Details
In internal/sbi/api_communication.go, the HTTPUEContextTransfer function handles the Content-Type header with a switch statement that only covers application/json and multipart/related:
switch str[0] {
case applicationjson:
err = openapi.Deserialize(ueContextTransferRequest.JsonData, requestBody, contentType)
case multipartrelate:
err = openapi.Deserialize(&ueContextTransferRequest, requestBody, contentType)
// no default case
}
if err != nil {
// skipped entirely when Content-Type is unsupported
c.JSON(http.StatusBadRequest, rsp)
return
}
s.Processor().HandleUEContextTransferRequest(c, ueContextTransferRequest)
This is inconsistent with the two analogous handlers in the same file, HTTPCreateUEContext and HTTPN1N2MessageTransfer, which both correctly include a default branch:
default:
err = fmt.Errorf("wrong content type")
The fix is simply to add the same default case to HTTPUEContextTransfer.
PoC
With a free5GC deployment running, send a POST request to the UE context transfer endpoint using any unsupported Content-Type (e.g. text/plain):
curl -s -X POST "http://<AMF_IP>/namf-comm/v1/ue-contexts/<ueContextId>/transfer" \\
-H "Content-Type: text/plain" \\
-d '{"test":"data"}' \\
-i
Expected (correct) behavior: 400 Bad Request from the SBI layer, rejecting the request due to unsupported Content-Type — consistent with HTTPCreateUEContext.
Actual (observed) behavior: The SBI-layer error check is bypassed and the processor is reached with an empty request object, returning:
HTTP/1.1 400 Bad Request
{"status": 400, "cause": "MANDATORY_IE_MISSING"}
The MANDATORY_IE_MISSING cause originates from the processor's internal validation, not from the SBI handler — confirming the processor was called with an uninitialized struct.
Impact
The endpoint is an inter-NF SBI API used during AMF-to-AMF UE context handover. It is not directly reachable from external UEs and requires access to the internal 5GC SBI network. The processor's secondary mandatory field validation prevents any unintended state modification, so there is no direct exploitability. However, the SBI handler layer is the intended first line of defense — relying on the processor to compensate for a missing input check increases fragility and violates defense in depth. Any future change to the processor's validation logic could inadvertently expose the system to processing completely empty request objects.
{
"affected": [
{
"package": {
"ecosystem": "Go",
"name": "github.com/free5gc/amf"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"last_affected": "1.4.3"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-41136"
],
"database_specific": {
"cwe_ids": [
"CWE-440"
],
"github_reviewed": true,
"github_reviewed_at": "2026-04-22T19:54:54Z",
"nvd_published_at": "2026-04-22T00:16:29Z",
"severity": "MODERATE"
},
"details": "## Summary\n\nThe `HTTPUEContextTransfer` handler in `internal/sbi/api_communication.go` does not include a `default` case in the `Content-Type` switch statement. When a request arrives with an unsupported `Content-Type`, the deserialization step is silently skipped, `err` remains `nil`, and the processor is invoked with a completely uninitialized `UeContextTransferRequest` object.\n\n## Details\n\nIn `internal/sbi/api_communication.go`, the `HTTPUEContextTransfer` function handles the `Content-Type` header with a switch statement that only covers `application/json` and `multipart/related`:\n\n```go\nswitch str[0] {\ncase applicationjson:\n err = openapi.Deserialize(ueContextTransferRequest.JsonData, requestBody, contentType)\ncase multipartrelate:\n err = openapi.Deserialize(\u0026ueContextTransferRequest, requestBody, contentType)\n// no default case\n}\n\nif err != nil {\n // skipped entirely when Content-Type is unsupported\n c.JSON(http.StatusBadRequest, rsp)\n return\n}\n\ns.Processor().HandleUEContextTransferRequest(c, ueContextTransferRequest)\n```\n\nThis is inconsistent with the two analogous handlers in the same file, `HTTPCreateUEContext` and `HTTPN1N2MessageTransfer`, which both correctly include a `default` branch:\n\n```go\ndefault:\n err = fmt.Errorf(\"wrong content type\")\n```\n\nThe fix is simply to add the same `default` case to `HTTPUEContextTransfer`.\n\n## PoC\n\nWith a free5GC deployment running, send a POST request to the UE context transfer endpoint using any unsupported `Content-Type` (e.g. `text/plain`):\n\n```bash\ncurl -s -X POST \"http://\u003cAMF_IP\u003e/namf-comm/v1/ue-contexts/\u003cueContextId\u003e/transfer\" \\\\\n -H \"Content-Type: text/plain\" \\\\\n -d \u0027{\"test\":\"data\"}\u0027 \\\\\n -i\n```\n\n**Expected (correct) behavior:** `400 Bad Request` from the SBI layer, rejecting the request due to unsupported Content-Type \u2014 consistent with `HTTPCreateUEContext`.\n\n**Actual (observed) behavior:** The SBI-layer error check is bypassed and the processor is reached with an empty request object, returning:\n\n```\nHTTP/1.1 400 Bad Request\n{\"status\": 400, \"cause\": \"MANDATORY_IE_MISSING\"}\n```\n\nThe `MANDATORY_IE_MISSING` cause originates from the processor\u0027s internal validation, not from the SBI handler \u2014 confirming the processor was called with an uninitialized struct.\n\n## Impact\n\nThe endpoint is an inter-NF SBI API used during AMF-to-AMF UE context handover. It is not directly reachable from external UEs and requires access to the internal 5GC SBI network. The processor\u0027s secondary mandatory field validation prevents any unintended state modification, so there is no direct exploitability. However, the SBI handler layer is the intended first line of defense \u2014 relying on the processor to compensate for a missing input check increases fragility and violates defense in depth. Any future change to the processor\u0027s validation logic could inadvertently expose the system to processing completely empty request objects.",
"id": "GHSA-r99v-75p9-xqm5",
"modified": "2026-04-22T19:54:54Z",
"published": "2026-04-22T19:54:54Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/free5gc/free5gc/security/advisories/GHSA-r99v-75p9-xqm5"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-41136"
},
{
"type": "PACKAGE",
"url": "https://github.com/free5gc/free5gc"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N/E:P",
"type": "CVSS_V4"
}
],
"summary": "free5GC AMF: Missing default case in Content-Type switch in HTTPUEContextTransfer"
}
Sightings
| Author | Source | Type | Date |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.