Http4s: CookieJar middleware accepts arbitrary Set-Cookie domain
http4s
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| org.http4s:http4s-client_2.12 Maven |
|
|
| org.http4s:http4s-client_2.13 Maven |
|
|
http4s
| Product | Affected | Fixed in |
|---|---|---|
| org.http4s:http4s-client_2.12 Maven |
|
|
| org.http4s:http4s-client_2.13 Maven |
|
|
| org.http4s:http4s-client_3 Maven |
|
|
Http4s is a Scala interface for HTTP services. Prior to 0.23.35 and 1.0.0-M47, The CookieJar client middleware stores a response cookie’s Domain attribute without checking that it domain-matches the host that supplied the cookie or rejecting public suffixes. A malicious or compromised server contacted through the same CookieJar can plant a cookie for another domain, and the jar later sends that cookie to the victim domain, enabling session fixation or overwriting security-sensitive cookies. The patch validates the Set-Cookie domain against the response origin, although public-suffix rejection remains unimplemented. This issue is fixed in versions 0.23.35 and 1.0.0-M47.
From the CVE record · GitHub_M
The http4s CookieJar client middleware accepts a response cookie’s Domain attribute without checking whether it matches the server that supplied it. When a client using the same CookieJar contacts a malicious or compromised server, that server can plant a cookie that is later sent to another domain, potentially fixing a session or overwriting a security-sensitive cookie. The patch validates the domain against the response origin, but does not reject public suffixes.
Engineers using Maven org.http4s:http4s-client_2.12 below 0.23.35, or org.http4s:http4s-client_2.13 or org.http4s:http4s-client_3 below 0.23.35 or from 1.0.0-M1 through versions before 1.0.0-M47, should check their dependencies.