GHSA-grh8-3p95-f9rr
Http4s: CookieJar middleware matches by substring, leaking cookies cross-origin
Quick fix
GHSA-grh8-3p95-f9rr — org.http4s:http4s-client_2.12: upgrade to the fixed version with the command below.
# pom.xml: bump <version>0.23.35</version> for org.http4s:http4s-client_2.12Details
The `CookieJar` client middleware decides whether to attach a cookie to an outgoing request using an unanchored substring test on the host and path, instead of the domain match specified by RFC6265 5.1.3. A cookie stored for `example.com` is therefore sent to any host whose name merely contains `example.com` (e.g. `evilexample.com`), leaking potentially sensitive cookies to an attacker-chosen host.
## Impact
Disclosure of session and authentication cookies to an attacker-controlled host, enabling session hijack of the application's outbound calls.
## Preconditions
- Application uses the `CookieJar` client middleware. - Application can be induced to make an outbound request to a host controlled by the attacker, where the hostname contains the targeted domain as a substring.
## Workarounds
- Do not use the `CookieJar` with clients that fetch attacker-influenced URLs - Apply a separate `CookieJar` per trusted origin.
Are you affected?
Enter the version of the package you're using.
Affected packages
0Fixed in: 0.23.35# pom.xml: bump <version>0.23.35</version> for org.http4s:http4s-client_2.120Fixed in: 0.23.35# pom.xml: bump <version>0.23.35</version> for org.http4s:http4s-client_2.130Fixed in: 0.23.35# pom.xml: bump <version>0.23.35</version> for org.http4s:http4s-client_31.0.0-M1Fixed in: 1.0.0-M47# pom.xml: bump <version>1.0.0-M47</version> for org.http4s:http4s-client_2.131.0.0-M1Fixed in: 1.0.0-M47# pom.xml: bump <version>1.0.0-M47</version> for org.http4s:http4s-client_3References
- https://github.com/http4s/http4s/security/advisories/GHSA-grh8-3p95-f9rr[WEB]
- https://github.com/http4s/http4s/commit/c0a37f38d5ee2a568ba57bd9da62f8d79b8b1fcc[WEB]
- https://github.com/http4s/http4s[PACKAGE]
- https://github.com/http4s/http4s/releases/tag/v0.23.35[WEB]
- https://github.com/http4s/http4s/releases/tag/v1.0.0-M47[WEB]