CVE-2020-5300: Disallow replay of `private_key_jwt` by blacklisting JTIs in Hydra

Published Apr 6, 2020
·
Updated

Impact

When using client authentication method "privatekeyjwt" [1], 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"}

Severity

We rate the severity as medium because the following reasons make it hard to replay tokens without the patch:

- TLS protects against MITM which makes it difficult to intercept valid tokens for replay attacks - The expiry time of the JWT gives only a short window of opportunity where it could be replayed

Patches

This will be patched with v1.4.0+oryOS.17

Workarounds

Two workarounds have been identified:

- Do not allow clients to use privatekeyjwt - Use short expiry times for the JWTs

References

https://openid.net/specs/openid-connect-core-10.html#ClientAuthentication

Upstream

This issue will be resolved in the upstream repository https://github.com/ory/fosite

Other sources

In Hydra (an OAuth2 Server and OpenID Certified™ OpenID Connect Provider written in Go), before version 1.4.0+oryOS.17, when using client authentication method 'privatekeyjwt' [1], 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 check the uniqueness of this jti value. Exploiting this vulnerability is somewhat difficult because: - TLS protects against MITM which makes it difficult to intercept valid tokens for replay attacks - The expiry time of the JWT gives only a short window of opportunity where it could be replayed This has been patched in version v1.4.0+oryOS.17

Affected Software

2 affected componentsFixes available
go/github.com/ory/hydra<1.4.0
1.4.0
Ory Hydra<1.4.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade go/github.com/ory/hydra to a version that resolves this vulnerability.

    Fixed in 1.4.0
  2. Upgrade

    Upgrade oryOS/hydra to a version that resolves this vulnerability.

    Fixed in v1.4.0+oryOS.17
  3. Configuration

    Disallow clients from using the 'private_key_jwt' client authentication method (workaround: prevent replay by blocking this method).

    Hydra (OAuth2 Server / OIDC Provider) client authentication method private_key_jwt = disallowed
  4. Compensating control

    Disallow replay of 'private_key_jwt' assertions by blacklisting JTIs in Hydra.

Event History

Apr 6, 2020
CVE Published
via MITRE·04:30 PM
Data Sourced
via MITRE·04:30 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·05:15 PM
RemedyDescriptionSeverityWeaknessAffected Software
May 27, 2021
Advisory Published
06:43 PM

Frequently Asked Questions

1

What is the severity of CVE-2020-5300?

The severity of CVE-2020-5300 is classified as medium, as it can potentially expose tokens to reuse, impacting the security of user authentication.

2

How do I fix CVE-2020-5300?

To fix CVE-2020-5300, upgrade to version 1.4.0 or later of the ory/hydra package.

3

What is affected by CVE-2020-5300?

CVE-2020-5300 affects the ory/hydra package versions prior to 1.4.0.

4

What type of vulnerability is CVE-2020-5300?

CVE-2020-5300 is a token misuse vulnerability that arises from the improper implementation of the 'private_key_jwt' authentication method.

5

Can CVE-2020-5300 allow for token replay attacks?

Yes, CVE-2020-5300 could potentially allow for token replay attacks due to the lack of proper token uniqueness enforcement.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203