undici vulnerable to cookie attribute injection via unsanitized domain and unparsed setCookie fields
Package
Affected versions
< 6.28.0
>= 7.0.0, < 7.29.0
>= 8.0.0, < 8.9.0
Patched versions
6.28.0
7.29.0
8.9.0
Description
Published by the National Vulnerability Database
Jul 29, 2026
Published to the GitHub Advisory Database
Aug 3, 2026
Reviewed
Aug 3, 2026
Last updated
Aug 3, 2026
Impact
The
setCookiefunction has two attribute injection paths.validateCookieDomaindoes not reject semicolons (validateCookiePathalready does at 0x3B), so adomainvalue likeexample.com; SameSite=Nonelands verbatim asDomain=example.com; SameSite=None. Theunparsedarray's loop only checks each entry contains=and does not sanitize values, so an entry likeX-Custom=val; HttpOnlylands unchanged, injectingHttpOnlywithout the caller settingcookie.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,
SecureorHttpOnlyforced or stripped, or the intended SameSite tier overridden.Patches
Patched in undici v6.28.0, v7.29.0, and v8.9.0.
Workarounds
domainvalues against the RFC 1034 letter-digit-hyphen set before passing tosetCookie.unparsedfield.References