- Notifications
You must be signed in to change notification settings - Fork1.6k
`CookieStore` replaces explicitly defined `Cookie`s
Description
Summary
When making any HTTP request, the automatically enabled and self-managedCookieStore (aka cookie jar) will silently replace explicitly definedCookies with any that have the same name from the cookie jar. For services that operate with multiple users, this can result in one user'sCookie being used for another user's requests.
Details
This issue is described without security warnings here:
I already have a PR to fix this issue:
PoC
- Add an auth
Cookieto theCookieStore- This is identical to receiving an HTTP response that uses
Set-Cookie, as shown in issue#1964 above.
- This is identical to receiving an HTTP response that uses
- Handle a different user's request where the same
Cookieis provided as a passthrough, like a JWT, and attempt to use it by explicitly providing it. - 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 bysetting a cookie in the response, theCookieStore 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.