CVE-2023-45143: Undici Undici's Cookie Header Not Cleared Vulnerability

LOW
Advisory Identifier: GHSA-wqq4-5wpv-mx2g
CVSS 3.9
CWE-200
Published
Advisory Summary

CVE-2023-45143 is a LOW (CVSS 3.9) undici's cookie header not cleared vulnerability (CWE-200: Exposure of Sensitive Information to an Unauthorized Actor) affecting Undici libraries in the npm ecosystem. The issue involves undici's cookie header not cleared on cross-origin redirect in fetch. Remediation is available by upgrading affected packages to version 5.26.2.

CVE-2023-45143 at a Glance

CVE Identifier CVE-2023-45143
GHSA Identifier GHSA-wqq4-5wpv-mx2g
Severity LOW
CVSS v3.1 Base Score 3.9
CWE Classification CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
Affected Product Undici
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 3.9

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

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

How to Fix CVE-2023-45143

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: 5.26.2
npm install undici@5.26.2
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-2023-45143, 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 5.26.2), 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-200: Exposure of Sensitive Information to an Unauthorized Actor, where the product exposes sensitive information to an actor that is not explicitly authorized to have access to that information. 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 Undici clears Authorization headers on cross-origin redirects, but does not clear `Cookie` headers. By design, `cookie` headers are [forbidden request headers](https://fetch.spec.whatwg.org/#forbidden-request-header), disallowing them to be set in `RequestInit.headers` in browser environments. Since Undici handles headers more liberally than the specification, there was a disconnect from the assumptions the spec made, and Undici's implementation of fetch. As such this may lead to accidental leakage of cookie to a 3rd-party site or a malicious attacker who can control the redirection target (ie. an open redirector) to leak the cookie to the 3rd party site. ### Patches This was patched in [e041de359221ebeae04c469e8aff4145764e6d76](https://github.com/nodejs/undici/commit/e041de359221ebeae04c469e8aff4145764e6d76), which is included in version 5.26.2.

CVE-2023-45143 Affected Undici Versions

1 component(s)
Fixed Versions:
5.26.2
Product / Package Ecosystem Affected Versions Fixed Version
undici
npm
< 5.26.2
5.26.2

References

GitHub Advisory / Wiki ADVISORY
https://github.com/nodejs/undici/security/advisories/GHSA-q768-x9m6-m9qp
GitHub Advisory / Wiki ADVISORY
https://github.com/nodejs/undici/security/advisories/GHSA-wqq4-5wpv-mx2g
NVD — CVE-2023-45143 NVD
https://nvd.nist.gov/vuln/detail/CVE-2023-45143
Security Fix Commit FIX COMMIT
https://github.com/nodejs/undici/commit/e041de359221ebeae04c469e8aff4145764e6d76
hackerone.com/reports/2166948 WEB
https://hackerone.com/reports/2166948
Undici Source Repository REPOSITORY
https://github.com/nodejs/undici
Undici Release RELEASE
https://github.com/nodejs/undici/releases/tag/v5.26.2
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/3N4NJ7FR4X4FPZUGNTQAPSTVB2HB2Y4A
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/E72T67UPDRXHIDLO3OROR25YAMN4GGW5
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/FNA62Q767CFAFHBCDKYNPBMZWB7TWYVU
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/HT7T2R4MQKLIF4ODV4BDLPARWFPCJ5CZ
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LKYHSZQFDNR7RSA7LHVLLIAQMVYCUGBG
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/X6QXN4ORIVF6XBW4WWFE7VNPVC74S45Y

Frequently Asked Questions

What is CVE-2023-45143?
CVE-2023-45143 is a security vulnerability in Undici involving Undici's cookie header not cleared on cross-origin redirect in fetch under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor.
Which Undici versions are affected?
Affected versions include releases prior to 5.26.2 across affected packages: undici.
What version fixes CVE-2023-45143?
Upgrading to 5.26.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is undici affected?
Yes, undici is affected in releases prior to 5.26.2. Upgrade your dependency to 5.26.2 or later.
What is the CVSS score of CVE-2023-45143?
CVE-2023-45143 has a CVSS v3.1 base score of 3.9 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:L/I:L/A:L.
What CWE is associated with CVE-2023-45143?
CVE-2023-45143 is classified under CWE-200: Exposure of Sensitive Information to an Unauthorized Actor (The product exposes sensitive information to an actor that is not explicitly authorized to have access to that information.).
How can I check npm dependencies for CVE-2023-45143?
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-wqq4-5wpv-mx2g",
  "modified" : "2024-02-16T22:37:23Z",
  "published" : "2023-10-16T14:05:37Z",
  "aliases" : [ "CVE-2023-45143" ],
  "summary" : "Undici's cookie header not cleared on cross-origin redirect in fetch",
  "details" : "### Impact\n\nUndici clears Authorization headers on cross-origin redirects, but does not clear `Cookie` headers. By design, `cookie` headers are [forbidden request headers](https://fetch.spec.whatwg.org/#forbidden-request-header), disallowing them to be set in `RequestInit.headers` in browser environments. Since Undici handles headers more liberally than the specification, there was a disconnect from the assumptions the spec made, and Undici's implementation of fetch.\n\nAs such this may lead to accidental leakage of cookie to a 3rd-party site or a malicious attacker who can control the redirection target (ie. an open redirector) to leak the cookie to the 3rd party site.\n\n### Patches\n\nThis was patched in [e041de359221ebeae04c469e8aff4145764e6d76](https://github.com/nodejs/undici/commit/e041de359221ebeae04c469e8aff4145764e6d76), which is included in version 5.26.2.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:H/UI:R/S:U/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "undici"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "5.26.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/undici/security/advisories/GHSA-q768-x9m6-m9qp"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/undici/security/advisories/GHSA-wqq4-5wpv-mx2g"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-45143"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/undici/commit/e041de359221ebeae04c469e8aff4145764e6d76"
  }, {
    "type" : "WEB",
    "url" : "https://hackerone.com/reports/2166948"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nodejs/undici"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nodejs/undici/releases/tag/v5.26.2"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/3N4NJ7FR4X4FPZUGNTQAPSTVB2HB2Y4A"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/E72T67UPDRXHIDLO3OROR25YAMN4GGW5"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/FNA62Q767CFAFHBCDKYNPBMZWB7TWYVU"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/HT7T2R4MQKLIF4ODV4BDLPARWFPCJ5CZ"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LKYHSZQFDNR7RSA7LHVLLIAQMVYCUGBG"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/X6QXN4ORIVF6XBW4WWFE7VNPVC74S45Y"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-200" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-10-16T14:05:37Z",
    "nvd_published_at" : "2023-10-12T17:15:10Z"
  }
}