free5GC NEF, Nil-Pointer Dereference, N/A (Medium)

Listen to this Post

How the mentioned CVE works (around 20 lines):

The vulnerability resides in the `PatchIndividualApplicationPFDManagement` handler of free5GC’s NEF component (v4.2.1). When a PATCH request is sent to /3gpp-pfd-management/v1/{afId}/transactions/{transId}/applications/{appId}, the handler calls `Consumer().AppDataPfdsAppIdGet(appID)` to query the UDR. Under normal conditions, this returns data or a `problemDetails` object. However, when the upstream UDR access fails (e.g., NRF unreachable, UDR down, network partition), the call returns `errPfdData != nil` and problemDetails == nil. The handler then enters the `errPfdData != nil` branch, where it correctly constructs a local `problemDetailsErr` struct with status 500 and a detail message. But immediately after that, the code mistakenly reads `problemDetails.Cause` – `problemDetails` is still `nil` at this point because the previous `case problemDetails != nil` did not match. This causes a nil-pointer dereference (runtime panic). Gin’s recovery middleware catches the panic and returns an HTTP 500 with an empty body, while logging the stack trace. The panic does not crash the NEF process, but each such request fails with 500 instead of a controlled error response. The trigger requires a precondition: UDR access must already be failing (attack complexity: high). Once that precondition exists, a single unauthenticated PATCH request (no Authorization header is required in v4.2.1 due to missing auth middleware on the `/3gpp-pfd-management` route group) reproducibly triggers the panic. The issue is fixed in free5gc/nef22.

DailyCVE form:

Platform: free5GC NEF
Version: v4.2.1
Vulnerability: Nil-pointer dereference
Severity: Medium
Date: 2026-03-21

Prediction: Patch available 2026-03-22

What Undercode Say:

Below are analytics and bash commands related to the blog .

Check NEF container logs for panic signature
docker logs --since 2026-03-21T03:06:36Z nef | grep -E "panic:|pfd.go:622"
Simulate UDR failure by stopping NRF
docker stop nrf
Trigger the panic with unauthenticated PATCH
curl -i -X PATCH 'http://10.100.200.19:8000/3gpp-pfd-management/v1/afnpd3/transactions/1/applications/appnpd3' \
-H 'Content-Type: application/json' \
--data '{"externalAppId":"appnpd3","pfds":{"pfd1":{"pfdId":"pfd1","flowDescriptions":[]}}}'
Restore service after test
docker start nrf

Exploit:

An attacker needs to wait for or induce a UDR access failure (e.g., by exhausting NRF, causing network partition, or waiting for a transient outage). Once that condition is met, the attacker sends a single PATCH request to the vulnerable endpoint without any authentication. The request does not require special payload – any valid JSON body that reaches the vulnerable branch will cause the panic. The response is HTTP 500 with empty body, and NEF logs reveal the nil-dereference stack trace. The exploit is repeatable as long as UDR access remains broken.

Protection from this CVE

  • Upgrade to a patched version of free5GC (commit containing free5gc/nef22).
  • Apply the code fix: replace `problemDetails.Cause` with `problemDetailsErr.Cause` in the `errPfdData != nil` branch of pfd.go:622.
  • As a temporary workaround, enforce authentication on the `/3gpp-pfd-management` route group to limit exposure to trusted AFs only.
  • Monitor NEF logs for panic patterns indicating attempted exploitation.
  • Ensure NRF and UDR high availability to reduce the attack window (the precondition becomes harder to achieve).

Impact:

  • Confidentiality: None – response is empty 500.
  • Integrity: None – panic occurs before any state mutation.
  • Availability: Per-request degradation; the NEF process remains alive, but each affected PATCH returns 500 instead of proper error handling. The impact only manifests while UDR access is independently broken (AC:H). No remote code execution or privilege escalation.

🎯Let’s Practice Exploiting & Learn Patching For Free:

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top