Summary
free5GC's Network Repository Function (NRF) discovery service performs improper input validation on the group-id-list query parameter, allowing out-of-range array access during request processing.
A remote attacker can send a crafted HTTP GET request with a malformed group-id-list value, causing the NRF process to panic and crash, resulting in denial of service for all dependent discovery operations.
Affected context
The vulnerability occurs in the free5GC NRF component when handling discovery requests that use the group-id-list query parameter.
Specifically, the EncodeGroupId function assumes that splitting the parameter on separator characters will produce at least three elements, and then unconditionally accesses indices [0], [1], and [2].
Any deployment that exposes the NRF discovery API, including internal service meshes or externally reachable control-plane endpoints, may be affected if malformed parameters are not filtered or validated upstream.
Exploit preconditions
- Attack surface: HTTP-based NRF discovery API endpoint.
- Required access: Ability to send HTTP GET requests to the NRF service (e.g., from another network function, sidecar, or any client that can reach the NRF API).
- Trigger point: Processing of a discovery request where the
group-id-listquery parameter is present but contains insufficient separator characters, resulting in fewer than three elements after splitting. - Why exploitation is possible: The
EncodeGroupIdfunction uses array indices [0], [1], and [2] on the split result without checking its length, allowing an out-of-range index access that causes a runtime panic and service crash.
Why this happens
At its core, this issue is an improper input validation problem in the request-handling logic for the NRF discovery service.
The group-id-list parameter is treated as structurally well-formed, and the code assumes that splitting the string on a delimiter will always yield at least three segments.
This violates robust defensive coding practices: external input is not validated for expected structure, length, or bounds before being used.
The resulting out-of-range index access leads to a runtime panic, which in Go terminates the process unless explicitly recovered, mapping to improper input handling that enables denial of service.
Potential impact
- The NRF discovery service can crash and become unavailable.
- Dependent 5G core network functions may be unable to discover or register services.
- Service registration and discovery failures can disrupt session establishment and mobility procedures.
- An attacker could repeatedly trigger crashes to maintain a persistent denial of service against the control plane.
General mitigation guidance
Mitigation generally focuses on enforcing strict validation of all externally supplied parameters before they are used in indexing or parsing logic, and on hardening the service against panics.
Useful defensive patterns include:
- Validating the structure and format of query parameters such as
group-id-listbefore processing, including checking the number of segments after splitting and rejecting malformed input early. - Using defensive coding practices to verify slice or array bounds before accessing specific indices and handling unexpected lengths gracefully.
- Introducing input schemas or contracts (for REST or OpenAPI-based interfaces) and enforcing them at the API boundary to prevent structurally invalid requests from reaching core logic.
- Adding centralized error handling and recovery mechanisms around request-handling paths to prevent a single malformed request from terminating the entire service.
- Applying network-layer or service-mesh policies to restrict access to the NRF API to trusted components and to rate-limit potentially abusive traffic patterns.
How teams detect issues like this
Organizations can detect and monitor for this class of issue through a combination of code-level and operational controls:
- Static analysis or linters configured to flag unchecked slice or array indexing that depends on external input, especially around parsing and splitting routines.
- Code reviews that pay particular attention to request handlers, ensuring that all query/path/body parameters are validated for length and structure before use.
- Runtime monitoring and logging for panic events in the NRF process, correlating spikes in crashes with specific request patterns or parameters (e.g., malformed
group-id-list). - API gateway or service mesh logs that track unusual or repeated malformed requests targeting discovery endpoints, which may indicate active probing or exploitation attempts.

