The vulnerability lies in the free5gc/nrf service, where a specially crafted HTTP GET request with a malformed group-id-list or external-group-identity parameter can cause a denial of service. The root cause is improper input validation in the buildFilter function, located in internal/sbi/processor/nf_discovery.go. This function passes the user-provided parameter to the nrf_context.EncodeGroupId function without ensuring it is correctly formatted. The EncodeGroupId function, in turn, attempts to access array indices without verifying the array's length, which triggers an 'index out of range' panic when the input is malformed, crashing the service.
The patch addresses this by introducing validation within the buildFilter function. It adds a call to validator.ValidateGroupIdFormat to check the format of the group ID before it's passed to the vulnerable EncodeGroupId function. Additionally, the signature of buildFilter was changed to return an error, which is now handled by its caller, NFDiscoveryProcedure. This ensures that instead of crashing, the service returns a proper HTTP error. Consequently, processor.buildFilter is the primary function that would be observed in a runtime profile during an exploit attempt, as it is the function that directly handles the malicious input.