CVE-2026-40343: free5GC UDR Fail-open Handling Vulnerability

MODERATE
Advisory Identifier: GHSA-jwch-w7wh-gqjm
CVSS 5.8
CWE-754
Published
Advisory Summary

CVE-2026-40343 is a MODERATE (CVSS 5.8) fail-open handling vulnerability (CWE-754: Improper Check for Unusual or Exceptional Conditions) affecting free5GC UDR libraries in the Go ecosystem. The issue involves fail-open handling in policydatasubstonotifypost allows unintended subscription creation. Remediation is available in the latest vendor maintenance releases.

CVE-2026-40343 at a Glance

CVE Identifier CVE-2026-40343
GHSA Identifier GHSA-jwch-w7wh-gqjm
Severity MODERATE
CVSS v3.1 Base Score 5.8
CWE Classification CWE-754: Improper Check for Unusual or Exceptional Conditions
Affected Product free5GC UDR
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.8

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:C/C:N/I:L/A:N).

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

How to Fix CVE-2026-40343

To remediate this vulnerability, upgrade all affected free5GC UDR 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/udr fixed: Latest secure release
Upgrade github.com/free5gc/udr to Latest secure release
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/udr

How to Check if You Are Affected

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

inspect dependencies for github.com/free5gc/udr

Analyze the terminal output to locate any version of free5GC UDR in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), 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-754: Improper Check for Unusual or Exceptional Conditions, where the product does not check or incorrectly checks for unusual or exceptional conditions that are not expected to occur frequently during day to day operation of the product. In free5GC UDR, 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 fail-open request handling flaw in the UDR service causes the `/nudr-dr/v2/policy-data/subs-to-notify` POST handler to continue processing requests even after request body retrieval or deserialization errors. This may allow unintended creation of Policy Data notification subscriptions with invalid, empty, or partially processed input, depending on downstream processor behavior. ### Details The endpoint `POST /nudr-dr/v2/policy-data/subs-to-notify` is intended to create a Policy Data notification subscription only after the HTTP request body has been successfully read and parsed into a valid `PolicyDataSubscription` object. [file:93] In the free5GC UDR implementation, the function `HandlePolicyDataSubsToNotifyPost` in `NFs/udr/internal/sbi/api_datarepository.go` does not terminate execution after input-processing failures. [file:93] The request flow is: 1. The handler calls `c.GetRawData()` to read the HTTP request body. [file:93] 2. If `GetRawData()` fails, the handler sends an HTTP 500 error response, but **does not return**. [file:93] 3. The handler then calls `openapi.Deserialize(policyDataSubscription, reqBody, "application/json")`. [file:93] 4. If deserialization fails, the handler sends an HTTP 400 error response, but again **does not return**. [file:93] 5. Execution continues and the handler still invokes `s.Processor().PolicyDataSubsToNotifyPostProcedure(c,policyDataSubscription)`. [file:93] As a result, the endpoint operates in a fail-open manner: request processing may continue after fatal input validation or body handling errors, instead of being safely aborted. [file:93] This differs from safer handlers in the same file, which use a helper pattern that explicitly returns on body read or deserialization failure before calling the corresponding processor routine. [file:93] ### Security Impact This issue affects a write-capable API that creates Policy Data notification subscriptions. [file:93] Because execution continues after body read or parsing failure, the processor may receive an uninitialized, partially initialized, or otherwise unintended `PolicyDataSubscription` object. [file:93] The exact runtime impact depends on downstream processor behavior and storage validation. [file:93] At minimum, this is a security-relevant robustness flaw that can lead to inconsistent request handling; under certain runtime conditions it may allow creation of invalid or unintended subscription state. [file:93] ### Reproduction Status The code path has been statically confirmed. [file:93] A complete runtime proof of unintended subscription creation after `GetRawData()` or deserialization failure has not yet been established. [file:93] ### Patch The handler should immediately terminate after sending an error response for body read or deserialization failure. [file:93] A minimal fix is to add missing `return` statements in `HandlePolicyDataSubsToNotifyPost`: ```go reqBody, err := c.GetRawData() if err != nil { logger.DataRepoLog.Errorf("Get Request Body error: %+v", err) pd := openapi.ProblemDetailsSystemFailure(err.Error()) c.Set(sbi.IN_PB_DETAILS_CTX_STR, pd.Cause) c.JSON(http.StatusInternalServerError, pd) return } err = openapi.Deserialize(&policyDataSubscription, reqBody, "application/json") if err != nil { logger.DataRepoLog.Errorf("Deserialize Request Body error: %+v", err) pd := util.ProblemDetailsMalformedReqSyntax(err.Error()) c.Set(sbi.IN_PB_DETAILS_CTX_STR, pd.Cause) c.JSON(http.StatusBadRequest, pd) return } ``` Additionally, the deserialization call should pass a pointer to the destination object so that the parsed body is written into the intended structure. [file:93] ###Details The issue is compounded by the handler's deserialization call, which passes `policyDataSubscription` directly to `openapi.Deserialize(...)` instead of passing a pointer to the destination object. This inconsistent usage further increases the risk that request processing continues with an empty, partially initialized, or otherwise unintended subscription object. [file:93]

CVE-2026-40343 Affected free5GC UDR Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
github.com/free5gc/udr
Go
≤ 1.4.2

References

Frequently Asked Questions

What is CVE-2026-40343?
CVE-2026-40343 is a security vulnerability in free5GC UDR involving Fail-open handling in PolicyDataSubsToNotifyPost allows unintended subscription creation under CWE-754: Improper Check for Unusual or Exceptional Conditions.
Which free5GC UDR versions are affected?
Affected versions include releases prior to current release patches across affected packages: github.com/free5gc/udr.
What version fixes CVE-2026-40343?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/free5gc/udr affected?
Yes, github.com/free5gc/udr is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2026-40343?
CVE-2026-40343 has a CVSS v3.1 base score of 5.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:N.
What CWE is associated with CVE-2026-40343?
CVE-2026-40343 is classified under CWE-754: Improper Check for Unusual or Exceptional Conditions (The product does not check or incorrectly checks for unusual or exceptional conditions that are not expected to occur frequently during day to day operation of the product.).
How can I check Go dependencies for CVE-2026-40343?
Run the dependency tree command: 'inspect dependencies for github.com/free5gc/udr'. 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-jwch-w7wh-gqjm",
  "modified" : "2026-04-24T21:11:11Z",
  "published" : "2026-04-21T19:05:18Z",
  "aliases" : [ "CVE-2026-40343" ],
  "summary" : "free5GC UDR: Fail-open handling in PolicyDataSubsToNotifyPost allows unintended subscription creation",
  "details" : "### Summary\nA fail-open request handling flaw in the UDR service causes the `/nudr-dr/v2/policy-data/subs-to-notify` POST handler to continue processing requests even after request body retrieval or deserialization errors.\n\nThis may allow unintended creation of Policy Data notification subscriptions with invalid, empty, or partially processed input, depending on downstream processor behavior.\n\n### Details\nThe endpoint `POST /nudr-dr/v2/policy-data/subs-to-notify` is intended to create a Policy Data notification subscription only after the HTTP request body has been successfully read and parsed into a valid `PolicyDataSubscription` object. [file:93]\n\nIn the free5GC UDR implementation, the function `HandlePolicyDataSubsToNotifyPost` in `NFs/udr/internal/sbi/api_datarepository.go` does not terminate execution after input-processing failures. [file:93]\n\nThe request flow is:\n\n1. The handler calls `c.GetRawData()` to read the HTTP request body. [file:93]\n2. If `GetRawData()` fails, the handler sends an HTTP 500 error response, but **does not return**. [file:93]\n3. The handler then calls `openapi.Deserialize(policyDataSubscription, reqBody, \"application/json\")`. [file:93]\n4. If deserialization fails, the handler sends an HTTP 400 error response, but again **does not return**. [file:93]\n5. Execution continues and the handler still invokes `s.Processor().PolicyDataSubsToNotifyPostProcedure(c,policyDataSubscription)`. [file:93]\n\nAs a result, the endpoint operates in a fail-open manner: request processing may continue after fatal input validation or body handling errors, instead of being safely aborted. [file:93]\n\nThis differs from safer handlers in the same file, which use a helper pattern that explicitly returns on body read or deserialization failure before calling the corresponding processor routine. [file:93]\n\n### Security Impact\nThis issue affects a write-capable API that creates Policy Data notification subscriptions. [file:93]  \nBecause execution continues after body read or parsing failure, the processor may receive an uninitialized, partially initialized, or otherwise unintended `PolicyDataSubscription` object. [file:93]\n\nThe exact runtime impact depends on downstream processor behavior and storage validation. [file:93]  \nAt minimum, this is a security-relevant robustness flaw that can lead to inconsistent request handling; under certain runtime conditions it may allow creation of invalid or unintended subscription state. [file:93]\n\n### Reproduction Status\nThe code path has been statically confirmed. [file:93]  A complete runtime proof of unintended subscription creation after `GetRawData()` or deserialization failure has not yet been established. [file:93]\n\n### Patch\nThe handler should immediately terminate after sending an error response for body read or deserialization failure. [file:93]\n\nA minimal fix is to add missing `return` statements in `HandlePolicyDataSubsToNotifyPost`:\n\n```go\nreqBody, err := c.GetRawData()\nif err != nil {\n    logger.DataRepoLog.Errorf(\"Get Request Body error: %+v\", err)\n    pd := openapi.ProblemDetailsSystemFailure(err.Error())\n    c.Set(sbi.IN_PB_DETAILS_CTX_STR, pd.Cause)\n    c.JSON(http.StatusInternalServerError, pd)\n    return\n}\n\nerr = openapi.Deserialize(&policyDataSubscription, reqBody, \"application/json\")\nif err != nil {\n    logger.DataRepoLog.Errorf(\"Deserialize Request Body error: %+v\", err)\n    pd := util.ProblemDetailsMalformedReqSyntax(err.Error())\n    c.Set(sbi.IN_PB_DETAILS_CTX_STR, pd.Cause)\n    c.JSON(http.StatusBadRequest, pd)\n    return\n}\n```\nAdditionally, the deserialization call should pass a pointer to the destination\nobject so that the parsed body is written into the intended structure. [file:93]\n\n###Details\nThe issue is compounded by the handler's deserialization call, which passes\n`policyDataSubscription` directly to `openapi.Deserialize(...)` instead of\npassing a pointer to the destination object. This inconsistent usage further\nincreases the risk that request processing continues with an empty, partially\ninitialized, or otherwise unintended subscription object. [file:93]",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:N/I:L/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:L/VA:N/SC:N/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/free5gc/udr"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "1.4.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/free5gc/free5gc/security/advisories/GHSA-jwch-w7wh-gqjm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-40343"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/free5gc/free5gc"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-754" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-21T19:05:18Z",
    "nvd_published_at" : "2026-04-22T00:16:27Z"
  }
}