Sep 16, 2026·5 min read·28 visits
The http4s CookieJar client middleware accepted arbitrary cookie Domain attributes verbatim without verifying if they matched the issuing server's origin. This enables rogue servers to inject cookies for unrelated target domains in applications utilizing shared CookieJar instances.
A validation flaw exists in the CookieJar client middleware of the http4s library. Prior to versions 0.23.35 and 1.0.0-M47, the middleware trusts server-supplied Domain attributes in HTTP Set-Cookie response headers without confirming that the domain matches the origin host. A malicious server can leverage this to register unauthorized cookies targeting different domains, creating potential session fixation or cookie poisoning vectors.
The http4s library provides minimal, idiomatic Scala interfaces for HTTP services, including client-side middleware utilities. One such utility is the CookieJar client middleware, which allows applications to programmatically maintain and manage HTTP cookies across sequential HTTP requests.
Prior to the security fixes implemented in versions 0.23.35 and 1.0.0-M47, the CookieJar middleware failed to perform proper domain matching checks when processing the Set-Cookie header in HTTP responses. According to security specifications, client agents must prevent servers from setting cookies for domains outside of their immediate authority (e.g., attacker.com setting a cookie for targetbank.com).
Because the middleware unconditionally accepted the server-provided Domain attribute, any system using a shared CookieJar instance to access multi-tenant environments, web scraping endpoints, or proxy destinations was vulnerable to cookie injection. Attackers could plant custom session states or bypass integrity protection on critical target domains.
The vulnerability stems from a violation of RFC 6265 Section 5.3 Step 6. Under this specification, a client user-agent must reject cookie Domain attributes that do not domain-match the origin host that supplied the cookie. The purpose of this check is to prevent hostile servers from registering cookies targeting arbitrary scopes.
In the vulnerable http4s implementation, the extractFromResponseCookie function parsed incoming response cookies and registered them using the following logic:
c.domain.orElse(uri.host.map(_.value)) match {
case Some(domainS) =>
val key = CookieKey(c.name, domainS, c.path)
val newCookie = c.copy(domain = domainS.some)
m + (key -> CookieValue(newCookie, httpDate))
}If the cookie parsed from the response (c.domain) contained a custom Domain attribute, the code assigned it directly as the storage key's domain (domainS), skipping any validation against the actual origin host (uri.host). Consequently, an HTTP client querying multiple destinations could have its state polluted by a single compromised or malicious server.
The vulnerability was mitigated in commit 87535f7288f3baaf6736e2735087e473762b5b2f by validating the parsed cookie domain against the origin host prior to storage.
// Patched logic in CookieJar.scala
private[middleware] def extractFromResponseCookie(
m: Map[CookieKey, CookieValue]
)(c: ResponseCookie, httpDate: HttpDate, uri: Uri): Map[CookieKey, CookieValue] = {
val storedDomain = c.domain match {
case Some(d) =>
// Confirm that the response host exists and domain-matches the attribute
if (uri.host.exists(domainMatches(_, d))) Some(d) else None
case None =>
uri.host.map(_.value)
}
storedDomain match {
case Some(domainS) =>
val key = CookieKey(c.name, domainS, c.path)
val newCookie = c.copy(domain = domainS.some)
m + (key -> CookieValue(newCookie, httpDate))
case None => // Ignore Cookies We Can't get a domain for
m
}
}The patched version checks if the target domain (d) matches the host using domainMatches. If the domain is not authoritative for the current origin host, it is set to None, which safely discards the unauthorized cookie registration.
Despite this fix, a key security limitation remains. The library does not implement Public Suffix List (PSL) validation. Therefore, a server hosted on a shared public suffix (such as victim.github.io) is still technically capable of planting a cookie for the entire public suffix wildcard (github.io). Multi-tenant application designs must remain cautious when sharing a single CookieJar context across tenant boundaries.
To execute this attack, the client must use a single CookieJar instance to send requests to both the attacker-controlled server and the victim domain. This is common in automation platforms, crawlers, or services routing traffic for multiple users.
First, the attacker provisions a session identifier (attacker_id) on the target web application (target.com). Next, when the victim's client makes an outbound connection to attacker.com, the attacker's server responds with an unauthorized cookie instruction specifying the target domain:
HTTP/1.1 200 OK
Set-Cookie: session=attacker_id; Domain=target.com; Path=/; Secure; HttpOnlyBecause the vulnerable client registers this cookie without validating the origin, the local cookie jar maps session=attacker_id under target.com. When the client subsequently requests resource paths on target.com, the client transmits the injected cookie, completing the session fixation vector.
To resolve this security issue, software developers must update their project dependencies to the appropriate patched releases. The official fixes have been backported to standard release lines.
For systems utilizing the 0.23.x release series, update the dependency to 0.23.35:
libraryDependencies += "org.http4s" %% "http4s-client" % "0.23.35"For systems utilizing the 1.0.x pre-release series, update the dependency to 1.0.0-M47:
libraryDependencies += "org.http4s" %% "http4s-client" % "1.0.0-M47"If upgrading dependencies is not immediately feasible, developers must isolate CookieJar instances. Avoid sharing a single client context across requests to different administrative domains. Instantiating distinct client instances or unique cookie jars per remote target host isolates states and prevents cross-origin data pollution.
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:N| Product | Affected Versions | Fixed Version |
|---|---|---|
http4s-client http4s | < 0.23.35 | 0.23.35 |
http4s-client http4s | >= 1.0.0-M1, < 1.0.0-M47 | 1.0.0-M47 |
| Attribute | Detail |
|---|---|
| CWE ID | CWE-384 / CWE-565 |
| Attack Vector | Network |
| CVSS v3.1 Score | 6.8 (Medium) |
| Exploit Maturity | None (No public exploit modules) |
| CISA KEV Status | Not Listed |
| Impact | Session Fixation / Cookie Tampering |
Session Fixation occurs when an attacker establishes a known session identifier on a victim's system, and then tricks the victim's browser into using that identifier when authenticating to a target application.
CVE-2026-55622 (GHSA-qx75-2p3r-pwm5) is an improper access control vulnerability (CWE-284) in Canonical LXD and LXC Incus (tracked as GHSA-c9f5-j9c3-mhrg). In multi-tenant deployments utilizing project-based isolation, the REST API handler for instance creation via POST /1.0/instances verifies that the authenticated user has authorization in the destination project specified by the query parameter, but fails to verify whether the user holds read or view permissions for the source instance when executing a copy operation across projects. Consequently, an authenticated client restricted to a single project can clone instances or snapshots from unauthorized projects into their own project, resulting in complete disclosure of the target instance filesystem and embedded credentials.
An authorization bypass vulnerability in Canonical LXD (tracked as GHSA-7mr3-28h5-m5vx and CVE-2026-55621, and as GHSA-64f3-v33m-w89f in Linux Containers Incus) allows an authenticated user with restricted project access to copy custom storage volumes and volume snapshots from unauthorized projects. The flaw resides in the storagePoolVolumesPost REST API handler, which verifies permissions on the destination project but fails to check whether the caller holds view entitlements on the source project or volume specified in the request body.
A missing authorization and configuration validation vulnerability in Canonical LXD and LXC Incus allows authenticated users within restricted projects to bypass project security boundaries. By smuggling prohibited low-level configuration directives (such as raw.lxc or raw.qemu) inside instance snapshots or backup archives, an attacker can restore these configurations within a restricted project and execute arbitrary commands with root privileges on the underlying host operating system.
A symbolic link traversal vulnerability (CWE-59) in Canonical LXD and Linux Containers Incus allows an authenticated user with image import permissions to read and write arbitrary files on the host filesystem. During image archive unpacking, the daemon fails to reject top-level symbolic links for the instance `templates` directory. Subsequent requests to the instance template API endpoints follow this symbolic link outside the instance storage directory with root privileges, enabling complete host compromise.
CVE-2026-12411 is a broken access control vulnerability in the DevLXD interface of Canonical LXD versions 6.6 through 6.8. The flaw resides in the devLXDInstancePatchHandler component, which fails to verify storage volume ownership when an instance attaches a new disk device via the /dev/lxd guest socket. When the security.devlxd.management.volumes configuration option is enabled, an untrusted guest or DevLXD identity can issue a crafted HTTP PATCH request referencing another tenant's custom storage volume. The LXD host daemon subsequently mounts the target volume into the requesting guest, permitting unauthorized cross-tenant read and write operations.
CVE-2026-105769 (GHSA-5q7h-w9jf-cx97, GO-2026-6225) is an origin validation error and credential exfiltration vulnerability affecting Kaniko prior to version 1.25.20. The flaw stems from an unanchored regular expression in the integrated Azure Container Registry (ACR) credential helper (github.com/chrismellard/docker-credential-acr-env). When Kaniko processes a Dockerfile containing an image reference hosted on a lookalike domain containing an ACR suffix as a substring (e.g., x.azurecr.io.attacker.com), the credential helper acquires a Microsoft Entra ID access token for Azure Resource Manager and transmits it via HTTP POST to the attacker-controlled host.