Back

MEDIUM

undici vulnerable to HTTP header injection via Set-Cookie percent-decoding

Published Jun 17, 2026

Description

Impact: undici's cookie parser in parseSetCookie percent-decodes cookie values via qsUnescape, turning encoded sequences like %0D%0A, %00, %3B, and %3D into their literal byte equivalents. RFC 6265 §5.4 does not specify any decoding and browsers do not decode either.

Applications that parse a Set-Cookie header and then forward the parsed value into a response header (proxies, middleware, SSR frameworks) become vulnerable to HTTP response header injection: an attacker-controlled upstream can inject arbitrary Set-Cookie, Location, or Cache-Control headers into the application's downstream response, enabling session fixation, open redirect, or cache poisoning.

Affected applications are those that use undici's cookie parsing (parseSetCookie, parseCookie, getSetCookies) and forward the parsed cookie value into a response header.

This was introduced in undici 7.0.0 via PR #3789.

Patches: Upgrade to undici v6.26.0, v7.28.0 or v8.5.0.

Workarounds: If upgrade is not immediately possible, do not forward values returned by parseSetCookie/parseCookie/getSetCookies directly into response headers; sanitize the value first to strip or reject CR, LF, NUL, ;, and = bytes.

Affected products

Remediation

Red Hat statement

Moderate: A flaw in the `undici` library's cookie parser can lead to HTTP response header injection. This occurs when applications, such as proxies or middleware, incorrectly forward percent-decoded cookie values from upstream into downstream response headers. Successful exploitation could result in session fixation, open redirects, or cache poisoning.

Red Hat mitigation

Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base or stability.

Metrics

Weaknesses (1)

References (7)

Change history (0)

No recorded changes yet.

Sources
CVE.org / MITRE
Status PUBLISHED
Assigner openjs
Published Jun 17, 2026
Updated Jun 23, 2026
Reserved May 27, 2026
CISA Vulnrichment
Updated Jun 17, 2026
NVD
Status Analyzed
Modified Jun 25, 2026
Red Hat
Severity Moderate
Public date Jun 17, 2026
GHSA-P88M-4JFJ-68FV