CVE-2022-31151: undici before v5.8.0 vulnerable to uncleared cookies on cross-host / cross-origin redirect
3.7
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.40196%
CWE
Published
7/21/2022
Updated
1/30/2023
KEV Status
No
Technology
JavaScript
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
undici | npm | < 5.8.0 | 5.8.0 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from undici's redirect handler not clearing cookies during cross-origin redirects. The commit diff shows the vulnerable shouldRemoveHeader
function in redirect.js lacked a check for 'cookie' headers (only checked 'authorization'). The patch added a new condition to detect 'cookie' headers (length 6) when origin changes, confirming this was the missing security check. Tests were added to verify cookie header removal, directly linking this function to the vulnerability.