NewApp Monitoring is liveSign up free
AgentbeamBeta
Open-source package vulnerability · Maven

CVE-2024-53990: AsyncHttpClient (AHC) library's `CookieStore` replaces explicitly defined `Cookie`s

criticalCVSS 4.0 9.2GHSA-mfj5-cf8g-g2fv

Summary When making any HTTP request, the automatically enabled and self-managed CookieStore (aka cookie jar) will silently replace explicitly defined Cookies with any that have the same name from the cookie jar. For services that operate with multiple users, this can result in one user's Cookie being used for another user's requests.

Published Dec 2, 2024 · Updated Dec 18, 2024

Affected packages

org.asynchttpclient:async-http-client

Ecosystem
Maven
Affected
>= 2.1.0, < 2.12.4
Fixed in
2.12.4
Check
mvn dependency:tree -Dincludes=org.asynchttpclient:async-http-client

org.asynchttpclient:async-http-client

Ecosystem
Maven
Affected
>= 3.0.0.Beta1, < 3.0.1
Fixed in
3.0.1
Check
mvn dependency:tree -Dincludes=org.asynchttpclient:async-http-client

Advisory details

From the GitHub Advisory Database (CC BY 4.0).

Summary

When making any HTTP request, the automatically enabled and self-managed CookieStore (aka cookie jar) will silently replace explicitly defined Cookies with any that have the same name from the cookie jar. For services that operate with multiple users, this can result in one user's Cookie being used for another user's requests.

Details

This issue is described without security warnings here:

https://github.com/AsyncHttpClient/async-http-client/issues/1964

A PR to fix this issue has been made:

https://github.com/AsyncHttpClient/async-http-client/pull/2033

PoC

  1. Add an auth Cookie to the CookieStore
  2. This is identical to receiving an HTTP response that uses Set-Cookie, as shown in issue #1964 above.
  3. Handle a different user's request where the same Cookie is provided as a passthrough, like a JWT, and attempt to use it by explicitly providing it.
  4. Observe that the user's cookie in step 2 is passed as the Cookie in step 1.

Impact

This is generally going to be a problem for developers of backend services that implement third party auth features and use other features like token refresh. The moment a third party service responds by _setting_ a cookie in the response, the CookieStore will effectively break almost every follow-up request (hopefully by being rejected, but possibly by revealing a different user's information).

If your service sets cookies based on the response that happens here, it's possible to lead to even greater levels of exposure.

Workaroud

You can avoid this issue by disabling the CookieStore during client creation:

DefaultAsyncHttpClientConfig.Builder clientBuilder = Dsl.config()
 .setCookieStore(null)
 // other configuration
 ;

Credited to pickypg.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. No analysis has been written for this entry yet. Methodology

More Maven vulnerabilities

All Maven entries