Summary
free5GC UDR versions 4.2.1 and below contain an authorization flaw in the handler for reading Traffic Influence Subscriptions, where a failed path validation still returns subscription data alongside an HTTP 404 response.
An unauthenticated attacker with network access to the 5G Service Based Interface can read arbitrary Traffic Influence Subscription records, including SUPIs/IMSIs, DNNs, S-NSSAIs, and callback URIs, by supplying any value for the influenceId path segment.
Affected context
The issue occurs in the User Data Repository (UDR) service of free5GC 5G core deployments running versions 4.2.1 and below.
It affects the HTTP handler that serves Traffic Influence Subscription resources via the 5G Service Based Interface (SBI).
The vulnerable behavior appears when the path segment intended to identify subscriptions (influenceId) is validated against an expected literal (subs-to-notify), but execution does not stop after sending an HTTP 404 response.
In environments where the UDR SBI is reachable from untrusted or partially trusted networks, this logic error can expose sensitive subscriber and policy-related data to unauthenticated entities.
Exploit preconditions
- Attack surface: 5G Service Based Interface endpoint of the UDR that exposes Traffic Influence Subscription APIs.
- Required access: Network-level access to the UDR SBI (e.g., from another network function, management plane, or any entity able to send HTTP requests to the UDR).
- Authentication/authorization: No valid credentials or tokens are required; the flaw is reachable by unauthenticated callers.
- Trigger point: An HTTP request to the Traffic Influence Subscription read endpoint using any arbitrary value for the
influenceIdpath segment. - Why exploitation is possible: The handler checks if
influenceIdequals the expected literal (subs-to-notify) and sends a 404 error when it does not match, but fails to return immediately. As a result, the function continues executing and retrieves and returns subscription data in the response body, despite the error status.
Why this happens
This vulnerability stems from incomplete control flow after an authorization/validation check within the UDR HTTP handler.
The code performs a comparison on the influenceId path parameter, intending to restrict access to a specific, expected value.
When the comparison fails, the handler sends an HTTP 404 response but does not terminate execution (e.g., via return or equivalent), allowing subsequent logic to run as though the check had passed.
This pattern maps to CWE-285: Improper Authorization, since the system fails to enforce access control decisions, and also relates to CWE-636: Not Failing Securely, because a failure condition (invalid influenceId) does not result in a safe termination of processing.
Conceptually, the bug is a classic "send error but continue processing" pattern in request handlers, where error handling is not coupled with a hard stop in the control flow.
Potential impact
- Exposure of Traffic Influence Subscription records that may include SUPIs/IMSIs, allowing correlation to individual subscribers.
- Leakage of Data Network Names (DNNs) and S-NSSAIs associated with subscribers or traffic policies.
- Disclosure of callback URIs and associated endpoints, providing additional reconnaissance data for attackers.
- Violation of privacy and regulatory requirements due to unauthorized access to subscriber identifiers and policy data.
- Potential facilitation of targeted attacks against other 5G core components using the revealed topology and configuration data.
General mitigation guidance
Effective mitigation focuses on enforcing fail-safe control flow and robust access control around UDR APIs:
- Ensure that any handler that sends an HTTP error (such as 404 or 403) terminates execution immediately, avoiding further processing of the request.
- Centralize authorization checks for SBI endpoints and implement them as gatekeepers that decide early whether a request proceeds, ensuring no data access occurs on failed checks.
- Apply a strict "deny by default" policy for UDR resources, requiring explicit authorization for any subscription or subscriber-related data retrieval, regardless of path parameters.
- Use structured routing and handler frameworks that couple route validation with automatic short-circuiting when a route or parameter is invalid, minimizing custom error-handling logic.
- Limit network exposure of the UDR SBI so that only trusted, authenticated network functions can reach it, and segment it away from general-purpose or management networks.
- Adopt least-privilege service accounts and tokens for internal components that need access to Traffic Influence Subscriptions, ensuring that even legitimate consumers are constrained.
How teams detect issues like this
Organizations can detect similar vulnerabilities in service handlers and API endpoints by combining code-level and system-level approaches:
- Static analysis and linting: Define rules or patterns to flag handlers that write an HTTP error response but then continue executing logic that may access sensitive data or write another response.
- Code review practices: During manual review, pay close attention to error-handling branches in HTTP handlers, verifying that every error path returns or otherwise terminates processing.
- Security-focused unit and integration tests: Add tests that simulate invalid path parameters or authorization failures and assert that no sensitive data appears in the response body for error status codes.
- Runtime logging and monitoring: Monitor for anomalous 404 responses that contain non-trivial response bodies, especially those including subscription-like payloads, and alert on such patterns.
- Policy enforcement in CI/CD: Integrate automated tools into the pipeline that check for missing returns after error responses or improper mixing of status codes and data production.

