Summary
free5GC's NEF component exposes the nnef-callback route group without enforcing OAuth2/bearer-token authorization prior to version 4.2.2.
Because callbacks are accepted and dispatched into NEF business logic even with forged or arbitrary bearer tokens, an attacker who can guess or obtain a valid NotifId can send fake callbacks that act on real subscription state.
Affected context
The vulnerability appears in free5GC deployments where the NEF (Network Exposure Function) is reachable over its SBI/HTTP interface and the nnef-callback route group is mounted without inbound authentication middleware.
It specifically affects callback handling paths that interact with SMF-related subscription state, even when the runtime ServiceList does not explicitly advertise the nnef-callback service.
Environments where NEF interfaces are exposed to less-trusted networks, test harnesses, or shared control planes are more exposed than tightly isolated, internal-only deployments.
Exploit preconditions
- Attack surface: NEF SBI/HTTP endpoint exposing the
nnef-callbackroute group. - Required access: Network-level ability to send HTTP requests to the NEF callback URL; no valid bearer token is required.
- Authentication state: The route group accepts arbitrary or forged bearer tokens (e.g.,
Authorization: Bearer not-a-real-token), effectively bypassing OAuth2 checks. - Trigger point: Submission of a crafted callback request whose body matches the expected NEF callback format and references an existing
NotifIdor subscription context. - Why exploitation is possible: The route group is mounted without inbound auth middleware, so NEF does not verify the producer NF identity or token validity before parsing and dispatching the callback body into business logic.
Why this happens
The core issue is that a sensitive route group (nnef-callback) is mounted without any inbound authentication/authorization middleware, creating a gap between the intended security model (OAuth2-protected SBI interfaces) and the actual implementation.
This maps to CWE-306: Missing Authentication for Critical Function, because critical NEF operations that act on subscription state are accessible without proper identity verification.
It also aligns with CWE-862: Missing Authorization, as the system fails to enforce that only legitimate producer NFs are permitted to trigger callbacks tied to subscriber or session state.
Concretely, the NEF accepts HTTP callbacks with any bearer token, parses the body, and routes it into internal business logic based solely on fields like NotifId, rather than verifying the caller's NF identity and permissions at the boundary.
Potential impact
- Attackers could send forged callbacks that modify, terminate, or otherwise interfere with active SMF-related subscriptions.
- NEF subscription state may be manipulated, leading to inconsistent policy enforcement or session handling.
- Service disruption or denial of service for affected subscribers due to unauthorized state changes.
- Potential abuse of exposed APIs to influence charging, routing, or traffic steering decisions, depending on how callbacks are used.
- Confusion or mis-correlation in operational logs and monitoring due to callbacks appearing to originate from legitimate NFs.
General mitigation guidance
Effective mitigation typically focuses on restoring a strict authentication and authorization boundary around NEF callback handling.
Useful defensive patterns include:
- Ensuring all SBI route groups, including
nnef-callback, are consistently wrapped with OAuth2/bearer-token authentication middleware as a default. - Implementing explicit authorization checks that bind callbacks to specific producer NF identities and roles before any state updates occur.
- Treating identifiers like
NotifIdas opaque correlation tokens that are never sufficient on their own to authorize actions; they should always be validated in combination with authenticated NF identity. - Applying a "deny-by-default" policy for new route groups so unprotected endpoints cannot be added without explicit security configuration.
- Restricting NEF network exposure using segmentation, firewalls, and service meshes so only legitimate NFs can reach callback endpoints.
- Using least-privilege principles for NEF internal operations, limiting what any single callback can change in subscription or session state.
How teams detect issues like this
Detection and verification can combine code-level checks with runtime monitoring:
- Static analysis / code review:
- Search for NEF HTTP route registrations where authentication middleware is not applied or is conditionally bypassed.
- Flag route groups that diverge from the standard SBI security configuration, particularly for callback or state-mutating handlers.
- Review logic that relies on identifiers like
NotifIdwithout verifying the associated caller identity or permissions. - Configuration and policy checks:
- Enforce policies that all SBI endpoints must require valid OAuth2/bearer tokens, validated against a trusted authorization server.
- Integrate automated checks in CI/CD pipelines that fail builds if new routes are added without security middleware.
- Runtime monitoring:
- Log all callback invocations with both the presented bearer token metadata and the derived NF identity.
- Alert on callbacks that either lack valid tokens or appear from unexpected network segments or client identities.
- Automated API security tools, WAFs, or service mesh policies can also be configured to require valid tokens and restrict which principals can access NEF callback paths.

