Summary
free5GC's NEF component exposes the 3gpp-pfd-management API without enforcing OAuth2/bearer-token authorization, allowing requests with arbitrary or forged bearer tokens to be accepted.
An attacker who can reach the NEF over the Service-Based Interface (SBI) may create, read, or delete PFD management transaction state, even when operators believe the service is disabled via configuration.
Affected context
This vulnerability affects deployments of free5GC NEF prior to version 4.2.2 where:
- The NEF is reachable on the SBI from untrusted or semi-trusted network segments.
- The 3gpp-pfd-management API route group is mounted internally regardless of the ServiceList configuration.
- OAuth2 or bearer-token enforcement is expected but not actually applied to the PFD-management endpoints.
Environments that rely solely on configuration-based service disabling or assume that bearer tokens are validated at the NEF boundary are particularly exposed.
Exploit preconditions
- Attack surface: NEF's 3gpp-pfd-management HTTP endpoints exposed on the SBI.
- Required access: Network-level ability to send HTTP requests to the NEF from within the SBI-connected domain (e.g., from another NF, compromised host, or misconfigured network segment).
- Authentication/authorization: No valid OAuth2 or real bearer token required; any
Authorization: Bearer ...header (or even arbitrary string) may be accepted. - Trigger point: Direct invocation of PFD-management APIs (create, read, delete transactions) via standard HTTP methods.
- Why exploitation is possible: The route group is mounted without inbound authorization middleware, and it remains active even when the ServiceList configuration omits or "disables" the corresponding service, leaving the endpoints unprotected.
Why this happens
The core issue is a missing authorization check on a sensitive API surface.
Within the NEF, the 3gpp-pfd-management route group is registered without attaching the expected OAuth2/bearer-token validation middleware. As a result, the presence of an Authorization header is not coupled with any verification of token authenticity, scope, or client identity.
Compounding this, the registration of the route group is not governed strictly by the runtime ServiceList configuration. Even when operators believe the service is disabled via configuration, the API remains reachable. This aligns with CWE-862: Missing Authorization, where an application exposes functionality that should require access control but does not actually enforce it.
Abstractly, the insecure pattern is:
- Exposing management or control-plane endpoints.
- Assuming that configuration or token presence implies protection.
- Failing to systematically apply consistent authorization checks at every entry point.
Potential impact
- Attackers can create arbitrary PFD-management transaction state, potentially inserting malicious or incorrect traffic descriptors.
- Attackers can read existing PFD-management transactions, leading to exposure of internal network policies or traffic classification logic.
- Attackers can delete or corrupt PFD-management transactions, causing traffic misclassification, service disruption, or degraded performance.
- Attackers may pivot via inconsistent policies to influence packet handling at downstream network functions that consume PFD information.
- Operators' assumptions about disabled services may be invalidated, increasing the attack surface unexpectedly.
General mitigation guidance
Effective mitigations focus on consistent, centralized authorization and defensive service exposure patterns:
- Enforce strict authorization middleware for all SBI-exposed endpoints, especially management and control-plane APIs. Route registration should require explicit attachment of authentication and authorization filters.
- Treat OAuth2/bearer tokens as untrusted input until validated against an authorization server, checking signature, expiry, audience, and scopes.
- Align API route enablement strictly with configuration: if a service is disabled via config, the corresponding routes should not be registered or reachable.
- Adopt a "deny by default" posture for API exposure, where new routes are not accessible unless explicitly enabled and protected.
- Restrict NEF network exposure using segmentation, firewall rules, and mutual TLS between trusted NFs, reducing who can reach the SBI endpoints.
- Apply least-privilege principles for NEF interactions, limiting what each calling NF or client is permitted to perform on PFD-management APIs.
How teams detect issues like this
Organizations can use a combination of design-time and runtime techniques to detect and monitor similar authorization gaps:
- Static analysis and code review:
- Search for route or handler registration patterns that lack attached authorization/authentication middleware.
- Use linters or custom rules to flag handlers that accept
Authorizationheaders but never verify tokens. - Review configuration-to-routing wiring to ensure disabled services do not leave their handlers active.
- Security testing:
- Perform API penetration testing against SBI interfaces, sending requests with invalid or dummy bearer tokens and confirming they are rejected.
- Continuously validate that disabling a service in config genuinely removes or protects the corresponding endpoints.
- Policy enforcement:
- Introduce gateway or service-mesh policies (e.g., at an API gateway or sidecar) that enforce token validation and mTLS independently of application code.
- Use automated CI/CD checks to assert that new APIs pass an authorization checklist before deployment.
- Runtime monitoring:
- Log all access to PFD-management and other sensitive NEF APIs, including token validation results, and alert on anomalies such as requests with obviously fake tokens that are accepted.

