oauth2: Resolves possible session fixation attack #770
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch resolves a vulnerability in the consent flow. This vulnerability
affects versions 0.10.0 ~ 0.11.5 only. Versions < 0.10.0 are not affected.
The vulnerability can be exploited as follows:
https://hydra/oauth2/auth?client=...
id "example-id": https://consent-app/?consent=example-id
and authorize the access request.
https://hydra/oauth2/auth?client=...&consent=example-id
. However,through some means, Malice is able to prevent redirection of Bob's
user agent.
https://hydra/oauth2/auth?client=...&consent=example-id
user agent contains the valid CSRF token, Malice receives an authorize
code that is meant to be issued to Bob.
For this attack to work, the following preconditions must be met:
successful consent request acceptance.
of the consent request.
For these reasons, an exploit for this vulnerability is not likely,
but possible.
This patch closes the described vulnerability by requiring a
consent_csrf
value additional to theconsent
value in the queryparameters of the authorization url. Without that value, the authorization
code flow will not be successful. The
consent_csrf
is transmitted out-of-bandto the consent app and not accessible to Malice. Let's revisit the example
from above:
https://hydra/oauth2/auth?client=...
which is stored in the database and the encrypted cookie. Malice
is not able to see the CSRF token.
id "example-id": https://consent-app/?consent=example-id
and authorize the access request.
https://hydra/oauth2/auth?client=...&consent=example-id&consent_csrf=csrf_token
.The redirection URL is only accessible to the consent app and Bob's user agent.
However, through some means, Malice is able to prevent redirection of Bob's
user agent.
consent_csrf
, accessinghttps://hydra/oauth2/auth?client=...&consent=example-id
withoutsetting
consent_csrf
causes the request to fail and the consent tobe revoked.
This patch does not introduce breaking changes. Upgrading to the version
which contains this patch does not require any code changes or deployment
changes.