Vulnerability GHSA-7qh7-rghh-698h
Summary
http4s: Set-Cookie rendering does not escape attribute delimiters
Details
Summary
ResponseCookie.render writes the cookie name, content, domain, path, and extension fields verbatim, with no sanitization of ; or control characters. An application that places attacker-controlled data into any of these fields lets the attacker inject additional cookie attributes (Domain=, Path=, SameSite=None, etc.) by embedding ; , widening a cookie's scope or downgrading its protections.
Impact
Cookie attribute injection: scope widening (Domain), SameSite downgrade, or overriding security-relevant attributes for applications that render attacker-influenced data in a ResponseCookie field. CR/LF in a field also threatens header splitting on backends that do not strip them.
Preconditions
- Application constructs a
ResponseCookiewith attacker-influencedcontent,name,path,domain, orextension. - The application does not independently validate the value.
Workarounds
Validate cookie field values against the RFC6265 grammar before constructing ResponseCookie, rejecting ; and control characters.
Patch
- Control characters are stripped from
content,name,path,domain, andextension. - Semi-colons are stripped from
content,name,path, anddomain. Becauseextensionis a single value, the semi-colon must be allowed as a delimiter, and sanitizing untrusted values remains the caller's responsibility.
Resources
- RFC6265 §4.1: Set-Cookie syntax
Related Vulnerabilities
Other vulnerabilities affecting the same packages