Sep 16, 2026·5 min read·27 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.
An OS command injection and argument injection vulnerability exists in the Nx build system and its official Maven (@nx/maven) and Gradle (@nx/gradle) plugins. When constructing the project dependency graph, the plugins invoke underlying Java build wrappers via subshells while interpolating unsanitized plugin options directly from nx.json into the command arguments. An attacker who supplies a crafted nx.json file via a repository or pull request can execute arbitrary shell commands with the privileges of the user or CI/CD runner invoking any Nx command that computes the project graph.
AdminNeo versions 4.6.2 through 5.4.1 contain an improper input validation vulnerability (CWE-20) in the version verification endpoint (?script=version). An unauthenticated remote attacker can submit a crafted HTTP POST request containing an array parameter for 'version', which is serialized into a shared server-side temporary cache file without type checking or authentication. On subsequent requests, the application deserializes this cached array and passes it to cookie() and rawurlencode(), triggering an uncaught fatal TypeError in PHP 8.x environments and causing a persistent 24-hour Denial of Service (DoS) for all users.
Charmbracelet Soft Serve versions 0.5.0 through 0.12.2 contain an authorization bypass and observable response discrepancy vulnerability in the HTTP Git server. Remote attackers can determine the existence, exact names, and clone URLs of private repositories by issuing crafted Go remote import path discovery requests (?go-get=1) or by observing differential HTTP status codes across Git Smart HTTP, Dumb HTTP, and Git LFS endpoints.
A Time-of-Check to Time-of-Use (TOCTOU) race condition in Charmbracelet Soft Serve versions 0.6.0 through 0.12.2 allows unauthenticated users to retain read access to repositories after their visibility is changed from public to private. The flaw stems from premature cache invalidation in the SetPrivate method prior to committing the visibility update to the underlying database. Concurrent read requests arriving during the database transaction window repopulate the non-expiring in-memory LRU cache with stale public metadata, bypassing access controls across HTTP, SSH, and Git protocols until the server process is restarted.
A resource consumption vulnerability exists in the Authlib joserfc Python library prior to version 1.7.5. When processing JSON Web Encryption (JWE) objects formatted using General JSON Serialization, the library fails to enforce an upper bound on the number of elements within the recipients array. An unauthenticated attacker can supply a JWE containing thousands of recipient entries targeting an RSA key management algorithm, forcing the server to perform an equivalent number of computationally expensive RSA private-key decryption operations per request and exhausting available CPU resources.
CVE-2026-119284 (GHSA-9pg5-8c7x-5hfx) is an uncontrolled resource consumption vulnerability (CWE-400) in the compact serialization deserialization routines of joserfc prior to version 1.7.6. The library enforced individual segment size limits only after invoking Python's bytes.split(b'.') on untrusted input tokens. By sending oversized compact JWS or JWE tokens, an unauthenticated remote attacker can force the Python interpreter to duplicate and allocate memory for every segment before size validation executes, resulting in memory exhaustion and an Endpoint Denial of Service (DoS).