/

CVE-2026-40248

Severity:

HIGH RISK

(7.5)

Improper Authorization / Access Control in free5GC UDR

CVE-2026-40248

Analyzed

Vulnerability type

Category:

Improper Authorization / Access Control

CWE:

CWE-285, CWE-636

Impact:

Unauthorized Creation and Modification of 5G Traffic Influence Subscriptions

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

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 influenceId path segment validation (e.g., expecting subs-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 influenceId path segment.
  • Why exploitation is possible: The handler compares the influenceId path 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 (including notificationUri and 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 influenceId path 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 notificationUri endpoints.
  • An attacker can overwrite existing subscriptions, potentially disrupting legitimate traffic steering behavior.
  • Attacker-controlled notificationUri values 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 return or 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 influenceId and 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/Response calls without returns or if blocks 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 influenceId values 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, and notificationUri. 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.

Sources

SourceLink
github.comgithub.com/free5gc/free5gc/security/advisories/GHSA-jgq2-qv8v-5cmj

Frequently asked

questions

Exploitability depends on how the UDR SBI is exposed. If the SBI is reachable from untrusted or semi-trusted networks, an unauthenticated attacker can send crafted HTTP requests to create or overwrite Traffic Influence Subscriptions. In tightly segmented deployments where only specific, trusted NFs can reach the UDR, the risk is confined to compromise or misuse of those components.

Based on the described behavior, exploitation does not require valid credentials. The flaw occurs before meaningful authorization is enforced, so any party with network access to the UDR SBI endpoint can potentially trigger it.

The safest approach is to ensure that all negative authorization or validation outcomes immediately terminate request handling. After sending an error response (such as HTTP 404), the handler should not execute any state-changing logic. Centralizing authorization checks and adopting a fail-fast pattern greatly reduces the chance of this kind of fall-through bug.

Prevention typically involves a mix of secure coding practices and process: use standardized middleware for authentication/authorization, enforce strict control-flow patterns around error handling, add tests for invalid identifiers and error paths, and subject security-critical endpoints (like subscription management) to focused code review and static analysis rules that look for response-after-check-without-return patterns.

Find out what's already
exploitable in your codebase.