Summary
A logic flaw in free5GC UDR up to version 4.2.1 lets the Traffic Influence Subscription handler continue executing after a failed path validation, even after returning an HTTP 404 response.
An unauthenticated attacker with access to the 5G Service Based Interface can still create or overwrite arbitrary Traffic Influence Subscriptions with attacker-controlled identifiers and notification URIs, despite the apparent error response.
Affected context
The vulnerability occurs in the User Data Repository (UDR) service of free5GC (versions 4.2.1 and below), specifically in the handler for creating or updating Traffic Influence Subscriptions.
It affects deployments where:
- The UDR's 5G Service Based Interface (SBI) is reachable (e.g., from other NFs or, in misconfigured setups, from broader network segments).
- Traffic Influence Subscriptions are used to steer or influence user-plane traffic.
- The service relies on the
influenceIdpath segment validation (e.g., expectingsubs-to-notify) to gate access, but does not properly abort execution after a failed check.
Exploit preconditions
- Attack surface: The 5G Service Based Interface (SBI) endpoint of the free5GC UDR that exposes Traffic Influence Subscription APIs.
- Required access: Network-level ability to send HTTP(S) requests to the UDR SBI; no valid 5G authentication credentials are required according to the described behavior.
- Trigger point: Sending a create or update request to the Traffic Influence Subscription endpoint with any arbitrary value in the
influenceIdpath segment. - Why exploitation is possible: The handler compares the
influenceIdpath segment against the expected value (subs-to-notify) and sends a 404 on mismatch, but fails to return or stop processing. As a result, the subsequent logic still executes and creates or overwrites the subscription using attacker-provided data (includingnotificationUriand SUPI values), effectively bypassing the intended path-based authorization/validation.
Why this happens
The core issue is a control-flow and authorization check failure in the request handler:
- The code performs a validation on the
influenceIdpath parameter and responds with HTTP 404 if it does not equal the expected literal. - However, it does not terminate the handler after sending the error response, allowing the normal subscription creation/update logic to proceed.
This reflects CWE-285: Improper Authorization, since access to critical operations (creating or overwriting Traffic Influence Subscriptions) is not effectively restricted, and CWE-636: Not Failing Securely, because the system attempts to deny access but continues to process the request as if it were authorized.
Abstractly, the insecure pattern is "performing an authorization or validation check without enforcing a hard stop on failure," allowing execution to fall through into privileged code paths despite an error response.
Potential impact
- An attacker can create arbitrary Traffic Influence Subscriptions with chosen
notificationUriendpoints. - An attacker can overwrite existing subscriptions, potentially disrupting legitimate traffic steering behavior.
- Attacker-controlled
notificationUrivalues can cause sensitive event notifications to be sent to attacker infrastructure. - Arbitrary SUPIs can be associated with malicious subscriptions, enabling targeted manipulation or monitoring of subscriber-related signaling.
- Indirect impact on user-plane traffic handling, quality-of-service decisions, or policy enforcement that depends on these subscriptions.
General mitigation guidance
Defensive patterns that typically address this class of issue include:
- Fail-fast control flow: Ensure that any failed authorization or validation check returns immediately and prevents subsequent business logic from executing. This can be enforced with explicit
returnor equivalent control-transfer statements following error responses. - Centralized authorization enforcement: Move access control decisions into reusable middleware or filters that guarantee request processing stops on failure, rather than relying on inline checks scattered across handlers.
- Positive authorization models: Instead of validating for a single disallowed condition, explicitly confirm that the request matches an allowlist of expected resource identifiers or roles, and reject everything else.
- Defense-in-depth validation: Validate critical identifiers (such as
influenceIdand SUPIs) against well-defined schemas and expected relationships, not just string equality or presence checks. - Least privilege for network exposure: Limit which components can reach the UDR SBI, segment the network so that only trusted NFs or management planes can invoke these APIs, and avoid exposing SBI endpoints directly to untrusted networks.
- Secure error-handling patterns: Establish coding guidelines and reviews to ensure that after generating an error response, no further state-changing logic executes for that request.
How teams detect issues like this
Detection typically combines code-level and behavioral approaches:
- Static analysis and linters: Configure tools to flag handlers that send an HTTP response but continue executing logic, particularly for security-critical operations. Patterns include multiple
Write/Responsecalls without returns orifblocks around authorization checks that do not exit on failure. - Code review checklists: During manual review, explicitly verify that every authorization/validation failure path terminates request processing. Review path-based authorization logic, such as checks on URI segments, to ensure they cannot be bypassed.
- Security unit/integration tests: Add tests that simulate invalid
influenceIdvalues and verify that subscriptions are not created or modified when the handler is expected to return an error. - Runtime monitoring and logging: Log all subscription creation and update events with the corresponding
influenceId, SUPI, andnotificationUri. Alert on unusual patterns, such as unexpected URIs or high-volume modifications from a single source. - Policy enforcement: Use API gateways or service meshes to enforce additional request validation and access-control rules around the UDR SBI endpoints, catching malformed or unauthorized traffic before it reaches the service.

