CVE-2026-16729: Undici Undici Vulnerable To Cookie Attribute Vulnerability

MODERATE
Advisory Identifier: GHSA-v3r7-h72x-cjcm
CVSS 4.8
CWE-74
Published
Advisory Summary

CVE-2026-16729 is a MODERATE (CVSS 4.8) undici vulnerable to cookie attribute vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting Undici libraries in the npm ecosystem. The issue involves undici vulnerable to cookie attribute injection via unsanitized domain and unparsed setcookie fields. Remediation is available by upgrading affected packages to version 6.28.0, 7.29.0, 8.9.0.

CVE-2026-16729 at a Glance

CVE Identifier CVE-2026-16729
GHSA Identifier GHSA-v3r7-h72x-cjcm
Severity MODERATE
CVSS v3.1 Base Score 4.8
CWE Classification CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
Affected Product Undici
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 4.8

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

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

How to Fix CVE-2026-16729

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

undici fixed: 6.28.0
npm install undici@6.28.0
undici fixed: 7.29.0
npm install undici@7.29.0
undici fixed: 8.9.0
npm install undici@8.9.0
Verify Direct and Transitive Dependencies

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

npm ls undici

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-16729, inspect your project dependencies using npm:

npm ls undici

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

Note: The npm ls undici command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In Undici, 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

## Impact The `setCookie` function has two attribute injection paths. `validateCookieDomain` does not reject semicolons (`validateCookiePath` already does at 0x3B), so a `domain` value like `example.com; SameSite=None` lands verbatim as `Domain=example.com; SameSite=None`. The `unparsed` array's loop only checks each entry contains `=` and does not sanitize values, so an entry like `X-Custom=val; HttpOnly` lands unchanged, injecting `HttpOnly` without the caller setting `cookie.httpOnly = true`. Applications that pass user-controlled input to these fields, typically multi-tenant or reverse-proxy servers that scope session cookies to a tenant-supplied domain, can have SameSite CSRF protections bypassed, `Secure` or `HttpOnly` forced or stripped, or the intended SameSite tier overridden. ## Patches Patched in undici v6.28.0, v7.29.0, and v8.9.0. ## Workarounds - Sanitize `domain` values against the RFC 1034 letter-digit-hyphen set before passing to `setCookie`. - Do not pass user-controlled data to the `unparsed` field.

CVE-2026-16729 Affected Undici Versions

3 component(s)
Fixed Versions:
6.28.07.29.08.9.0
Product / Package Ecosystem Affected Versions Fixed Version
undici
npm
< 6.28.0
6.28.0
undici
npm
≥ 7.0.0
< 7.29.0
7.29.0
undici
npm
≥ 8.0.0
< 8.9.0
8.9.0

References

Frequently Asked Questions

What is CVE-2026-16729?
CVE-2026-16729 is a security vulnerability in Undici involving undici vulnerable to cookie attribute injection via unsanitized domain and unparsed setCookie fields under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection').
Which Undici versions are affected?
Affected versions include releases prior to 6.28.0, 7.29.0, 8.9.0 across affected packages: undici.
What version fixes CVE-2026-16729?
Upgrading to 6.28.0, 7.29.0, 8.9.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is undici affected?
Yes, undici is affected in releases prior to 6.28.0, 7.29.0, 8.9.0. Upgrade your dependency to 6.28.0, 7.29.0, 8.9.0 or later.
What is the CVSS score of CVE-2026-16729?
CVE-2026-16729 has a CVSS v3.1 base score of 4.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N.
What CWE is associated with CVE-2026-16729?
CVE-2026-16729 is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection') (The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component.).
How can I check npm dependencies for CVE-2026-16729?
Run the dependency tree command: 'npm ls undici'. 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-v3r7-h72x-cjcm",
  "modified" : "2026-08-03T19:30:52Z",
  "published" : "2026-08-03T19:30:52Z",
  "aliases" : [ "CVE-2026-16729" ],
  "summary" : "undici vulnerable to cookie attribute injection via unsanitized domain and unparsed setCookie fields",
  "details" : "## Impact\n\nThe `setCookie` function has two attribute injection paths. `validateCookieDomain` does not reject semicolons (`validateCookiePath` already does at 0x3B), so a `domain` value like `example.com; SameSite=None` lands verbatim as `Domain=example.com; SameSite=None`. The `unparsed` array's loop only checks each entry contains `=` and does not sanitize values, so an entry like `X-Custom=val; HttpOnly` lands unchanged, injecting `HttpOnly` without the caller setting `cookie.httpOnly = true`.\n\nApplications that pass user-controlled input to these fields, typically multi-tenant or reverse-proxy servers that scope session cookies to a tenant-supplied domain, can have SameSite CSRF protections bypassed, `Secure` or `HttpOnly` forced or stripped, or the intended SameSite tier overridden.\n\n## Patches\n\nPatched in undici v6.28.0, v7.29.0, and v8.9.0.\n\n## Workarounds\n\n- Sanitize `domain` values against the RFC 1034 letter-digit-hyphen set before passing to `setCookie`.\n- Do not pass user-controlled data to the `unparsed` field.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "undici"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.28.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "undici"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "7.0.0"
      }, {
        "fixed" : "7.29.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "undici"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "8.0.0"
      }, {
        "fixed" : "8.9.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/undici/security/advisories/GHSA-v3r7-h72x-cjcm"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-16729"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/undici/commit/10d93fc332f2c8c161982dec3833201de29891b5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/undici/commit/3bf91ddb493e853957f3a58e155326a668ab8aef"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/undici/commit/af7484043ee075a6f216da0ad77e1dac55199235"
  }, {
    "type" : "WEB",
    "url" : "https://cna.openjsf.org/security-advisories.html"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nodejs/undici"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/undici/releases/tag/v6.28.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/undici/releases/tag/v7.29.0"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/undici/releases/tag/v8.9.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-74" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-03T19:30:52Z",
    "nvd_published_at" : "2026-07-29T17:16:51Z"
  }
}