GHSA-m452-q8c9-rg2f: CSRF
Impact A cookie tossing / cookie injection issue (CWE-1275). ThreadSafeCookieStore stored a cookie under the value of its Domain attribute without verifying that the responding host is allowed to set a cookie for that domain (RFC 6265 §5.3 step 6). A host the client connects to can therefore plant a cookie scoped to an unrelated domain, and the client will then send that cookie on later requests to that domain.
Who is Impacted Applications that use a single AsyncHttpClient instance - and thus the default, shared CookieStore - to reach both an attacker-influenced host and a trusted host. Typical exposure: crawlers, link-preview / webhook fetchers, SSRF-style "fetch this URL" features, multi-backend aggregators, or following redirects to an attacker-controlled host. The attacker can write a cookie the client presents to the victim host (session fixation, overwriting a session id / CSRF-token cookie); they cannot read the victim host's cookies. Applications that talk only to a fixed trusted backend, or that disable/scope the cookie store, are not exposed.
Patches Fixed in 3.0.11 and 2.16.0
Workarounds - Disable the cookie store (setCookieStore(null)) when cookies are not needed; or - Use a separate AsyncHttpClient (separate cookie store) per trust domain so an attacker-influenced host and a trusted host never share a jar - Supply a custom CookieStore whose add(Uri, Cookie) rejects cookies whose Domain is not domain-matched by the request host.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
maven/org.asynchttpclient:async-http-clientto a version that resolves this vulnerability.Fixed in 2.16.0 - Upgrade
Upgrade
maven/org.asynchttpclient:async-http-clientto a version that resolves this vulnerability.Fixed in 3.0.11 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 3.0.11 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 2.16.0 - Configuration
Disable the cookie store when cookies are not needed by calling setCookieStore(null).
AsyncHttpClient CookieStore (setCookieStore(null)) = null - Configuration
Supply a custom CookieStore where add(Uri, Cookie) rejects cookies whose Domain is not domain-matched by the request host.
AsyncHttpClient CookieStore.add(Uri, Cookie) = Reject non-domain-matched cookies - Configuration
Use a separate AsyncHttpClient (separate cookie store) per trust domain so an attacker-influenced host and a trusted host never share a jar.
AsyncHttpClient CookieStore sharing across trust domains = Use separate AsyncHttpClient instances per trust domain
Event History
Frequently Asked Questions
Which deployments are realistically exposed?
Exposure requires one AsyncHttpClient instance using the shared default CookieStore to contact both an attacker-influenced host and a trusted host. Common affected patterns include crawlers, link-preview or webhook fetchers, SSRF-style URL fetching, multi-backend aggregators, and redirect flows that can reach an attacker-controlled host.
What can an attacker do with this issue?
An attacker-controlled host can cause the client to store a cookie for an unrelated trusted domain, which the client may later send to that domain. This can support session fixation or overwriting session ID or CSRF-token cookies, but does not let the attacker read existing cookies for the trusted host.
Are applications that only call a fixed trusted backend affected?
No. Applications that communicate only with a fixed trusted backend, or that disable or appropriately scope the cookie store, are not exposed under the described conditions.
What can be done if updating is not immediately possible?
Disable the cookie store by setting it to null, or scope cookie storage so that untrusted and trusted destinations do not share the same store. This prevents cookies received from an attacker-influenced host from being reused for trusted hosts.
Which releases contain the fix?
The issue is fixed in AsyncHttpClient versions 3.0.11 and 2.16.0.