Undici's cookie header not cleared on cross-origin redirect in fetch
Published 16 Oct 2023 · Updated 4 Feb 2026
Affected package
- Affected
- <5.26.2
- Fixed in
- 5.26.2
npm install undici@5.26.2Details
Impact
Undici clears Authorization headers on cross-origin redirects, but does not clear Cookie headers. By design, cookie headers are forbidden request headers, 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, which is included in version 5.26.2.
Is GHSA-wqq4-5wpv-mx2g in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected undici, and gives you the command that fixes it.
References
- Linkgithub.com/nodejs/undici/security/advisories/GHSA-q768-x9m6-m9qp
- Linkgithub.com/nodejs/undici/security/advisories/GHSA-wqq4-5wpv-mx2g
- Advisorynvd.nist.gov/vuln/detail/CVE-2023-45143
- Linkgithub.com/nodejs/undici/commit/e041de359221ebeae04c469e8aff4145764e6d76
- Linkhackerone.com/reports/2166948
- Packagegithub.com/nodejs/undici
- Linkgithub.com/nodejs/undici/releases/tag/v5.26.2
- Linklists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/3N4NJ7FR4X4FPZUGNTQAPSTVB2HB2Y4A
- Linklists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/E72T67UPDRXHIDLO3OROR25YAMN4GGW5
- Linklists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/FNA62Q767CFAFHBCDKYNPBMZWB7TWYVU
- Linklists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/HT7T2R4MQKLIF4ODV4BDLPARWFPCJ5CZ
- Linklists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LKYHSZQFDNR7RSA7LHVLLIAQMVYCUGBG
- Linklists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/X6QXN4ORIVF6XBW4WWFE7VNPVC74S45Y
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.