/

CVE-2026-44325

Severity:

HIGH RISK

(7.5)

Type Confusion / Input Validation Error in free5GC NRF SBI

CVE-2026-44325

Analyzed

Vulnerability type

Category:

Type Confusion / Input Validation Error

CWE:

CWE-20, CWE-755, CWE-843

Impact:

Remote Denial of Service (DoS) via Repeated Handler Panics

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

free5GC's NRF root SBI endpoint POST /oauth2/token contained a parser-level type confusion issue where attacker-controlled form fields were reflected into struct fields using an incorrect assumed type.

By sending a crafted, unauthenticated form-encoded request, an attacker could trigger repeated panics in the access token handler, causing consistent HTTP 500 responses and making the NRF endpoint remotely crashable on demand.

Affected context

The vulnerability occurs in the Network Repository Function (NRF) of free5GC, specifically at the root SBI OAuth2 token endpoint POST /oauth2/token.

It affects deployments where:

  • The NRF service is running a version prior to 4.2.2
  • The /oauth2/token endpoint is reachable over the network (e.g., from other NFs or potentially less trusted segments)
  • Form-encoded POST requests are processed using the reflection-based handler in NFs/nrf/internal/sbi/api_accesstoken.go

The issue is localized to the parsing of access token request fields into the models.NrfAccessTokenAccessTokenReq struct using reflection.

Exploit preconditions

  • Attack surface: The NRF SBI HTTP interface, specifically the unauthenticated POST /oauth2/token endpoint.
  • Required access: Network-level ability to send HTTP requests to the NRF; no valid credentials or prior authentication are required.
  • Trigger point: Submission of a crafted application/x-www-form-urlencoded body that includes arbitrary field names mapped to values that are parsed as models.PlmnId.
  • Why exploitation is possible:
  • The handler reflects over models.NrfAccessTokenAccessTokenReq, only special-casing plain string and NrfNfManagementNfType fields.
  • All other fields are treated as if they are a single models.PlmnId, regardless of their actual type.
  • The parsed *models.PlmnId is then assigned via reflect.Value.Set() into whatever field name the attacker provided.
  • When the real type of the destination field is incompatible (e.g., slice, different struct, primitive), the reflect.Value.Set() call panics.
  • Gin's recovery middleware converts these panics into HTTP 500 responses while keeping the endpoint callable, allowing repeated triggering.

Why this happens

The underlying bug stems from unsafe use of reflection combined with insufficient input type validation, aligning with:

  • CWE-843: Access of Resource Using Incompatible Type — the code assumes that any non-special-cased field in the access token request struct is a models.PlmnId, regardless of its declared type.
  • CWE-20: Improper Input Validation — attacker-controlled field names and values from a form body are not validated against the actual struct schema before assignment.
  • CWE-755: Improper Handling of Exceptional Conditions — reflective assignment panics are used as de facto error handling, and while Gin recovers them into HTTP 500 responses, the logic still permits attacker-controlled panics.

At a design level, the handler uses a generic reflection-based mapper instead of a schema-aware parser or explicit binding logic. By treating "all other fields" as models.PlmnId and assigning via reflect.Value.Set() without checking the target field kind (struct vs. slice vs. primitive), the code creates a type confusion path where malformed or unexpected input causes runtime panics that can be triggered remotely.

Potential impact

  • Remote triggering of panics in the /oauth2/token handler, resulting in repeated HTTP 500 responses.
  • Degradation of NRF reliability and availability due to attacker-controlled bursts of failing token requests.
  • Potential cascading impact on other network functions that depend on the NRF for discovery or authorization, causing broader service disruption.
  • Increased log noise and operational overhead as monitoring and alerting systems react to repeated 500-level errors.
  • A more favorable environment for further probing, where attackers can use repeated panics as a side-channel to infer internal parsing behavior or error paths.

General mitigation guidance

Mitigation focuses on making request parsing schema-aware, type-safe, and resilient to malformed or unexpected input:

  • Replace ad-hoc reflection-based assignment with explicit binding logic that maps known request fields to known struct types.
  • Introduce strict input validation that:
  • Confirms each incoming field name is expected.
  • Verifies that data can be safely parsed into the declared field type before assignment.
  • When reflection is unavoidable:
  • Inspect the reflect.Kind and concrete type of the destination field and only call Set() when the source value is type-compatible.
  • Prefer defensive patterns such as CanSet() checks, type switches, and safe constructors that return errors instead of panics.
  • Treat parse failures as normal errors and return structured client errors (e.g., 400 Bad Request) rather than allowing runtime panics to occur.
  • Apply fail-closed behavior around critical control-plane endpoints so that invalid input is rejected early and cannot degrade the entire service.
  • Use principle of least privilege for network exposure, ensuring that sensitive NRF endpoints are reachable only from required network functions or trusted segments.

How teams detect issues like this

Detection can rely on a combination of code-centric and behavior-centric techniques:

  • Static analysis and code review:
  • Flag use of reflect.Value.Set (or similar APIs) where the source type is not explicitly checked against the destination field type.
  • Highlight reflection loops over struct fields that treat "all other fields" generically without schema validation.
  • Look for panic-prone parsing logic in request handlers, especially those that handle unauthenticated or public-facing endpoints.
  • Runtime and operational monitoring:
  • Monitor for unusual spikes in HTTP 500 responses on /oauth2/token or other SBI endpoints.
  • Use application performance monitoring (APM) or logging to track panic stack traces originating from parsing functions like api_accesstoken.go.
  • Testing and fuzzing:
  • Apply fuzzing to HTTP handlers that parse form-encoded or JSON bodies, focusing on random field names and types to surface type confusion and panics.
  • Incorporate negative tests in CI that submit malformed or unexpected field combinations to critical control-plane endpoints.
  • Automated tooling:
  • Integrate linters or SAST tools oriented toward Go that can identify unsafe reflection patterns and panic-prone error handling in request paths.
  • Enforce policy checks in pull requests to gate changes introducing new reflection-based parsers or unbounded error recovery.

Sources

SourceLink
github.comgithub.com/free5gc/free5gc/issues/918
github.comgithub.com/free5gc/free5gc/security/advisories/GHSA-f8qv-7x5w-qr48
github.comgithub.com/free5gc/nrf/commit/f7bc77daa7425506af7569f2e61c2a210f5a0423
github.comgithub.com/free5gc/nrf/pull/83

Frequently asked

questions

The issue is practically exploitable whenever an attacker can reach the NRF's /oauth2/token endpoint. Because the endpoint is unauthenticated and the bug is triggered by crafted form fields, an attacker can reliably cause repeated panics and HTTP 500 responses on demand.

No. The vulnerable handler processes unauthenticated POST /oauth2/token requests. Network reachability to the NRF interface is the main prerequisite; no prior registration, token, or NF identity is required.

The safest pattern is to remove generic reflection-based parsing in favor of explicit, schema-driven binding. Each expected field should be parsed and validated according to its declared type, with failures producing regular error responses instead of panics. Where reflection must remain, strict type checks and robust error handling should ensure that incompatible assignments cannot occur.

Future implementations should treat request parsing as a well-defined contract: validate all input against a clear schema, avoid "catch-all" reflection logic, and ensure that malformed or unexpected fields result in controlled errors rather than runtime panics. Regular code reviews, static analysis targeting reflection and panic usage, and fuzz testing of parsing paths can help catch type confusion and error-handling flaws early in development.

Find out what's already
exploitable in your codebase.