CVE-2020-15222: Github.com/ory/fosite Token Reuse Vulnerability

HIGH
Advisory Identifier: GHSA-v3q9-2p3m-7g43
CVSS 8.1
CWE-287 CWE-345
Published
Advisory Summary

CVE-2020-15222 is a HIGH (CVSS 8.1) token reuse vulnerability (CWE-287: Improper Authentication) affecting Github.com/ory/fosite libraries in the Go ecosystem. The issue involves token reuse in ory fosite. Remediation is available by upgrading affected packages to version 0.31.0.

CVE-2020-15222 at a Glance

CVE Identifier CVE-2020-15222
GHSA Identifier GHSA-v3q9-2p3m-7g43
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-287: Improper Authentication
Affected Product Github.com/ory/fosite
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2020-15222

To remediate this vulnerability, upgrade all affected Github.com/ory/fosite dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/ory/fosite fixed: 0.31.0
Upgrade github.com/ory/fosite to 0.31.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/ory/fosite

How to Check if You Are Affected

To determine whether your application is affected by CVE-2020-15222, inspect your project dependencies for Github.com/ory/fosite:

inspect dependencies for github.com/ory/fosite

Analyze the terminal output to locate any version of Github.com/ory/fosite in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.31.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-287: Improper Authentication, where when an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct. In Github.com/ory/fosite, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact When using client authentication method "private_key_jwt" [[1]](https://openid.net/specs/openid-connect-core-1_0.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 'grant_type=client_credentials' \ --data-urlencode 'client_id=c001d00d-5ecc-beef-ca4e-b00b1e54a111' \ --data-urlencode 'scope=application openid' \ --data-urlencode 'client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer' \ --data-urlencode 'client_assertion=eyJhb [...] jTw' {"access_token":"zeG0NoqOtlACl8q5J6A-TIsNegQRRUzqLZaYrQtoBZQ.VR6iUcJQYp3u_j7pwvL7YtPqGhtyQe5OhnBE2KCp5pM","expires_in":3599,"scope":"application openid","token_type":"bearer"}⏎ $ curl --insecure --location --request POST 'https://localhost/_/oauth2/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=client_credentials' \ --data-urlencode 'client_id=c001d00d-5ecc-beef-ca4e-b00b1e54a111' \ --data-urlencode 'scope=application openid' \ --data-urlencode 'client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer' \ --data-urlencode 'client_assertion=eyJhb [...] jTw' {"access_token":"wOYtgCLxLXlELORrwZlmeiqqMQ4kRzV-STU2_Sollas.mwlQGCZWXN7G2IoegUe1P0Vw5iGoKrkOzOaplhMSjm4","expires_in":3599,"scope":"application openid","token_type":"bearer"} ``` ### Patches This issue is patched in 0.31.0. ### Workarounds Do not allow clients to use `private_key_jwt`. ### References https://openid.net/specs/openid-connect-core-1_0.html#ClientAuthentication

CVE-2020-15222 Affected Github.com/ory/fosite Versions

1 component(s)
Fixed Versions:
0.31.0
Product / Package Ecosystem Affected Versions Fixed Version
github.com/ory/fosite
Go
< 0.31.0
0.31.0

References

Frequently Asked Questions

What is CVE-2020-15222?
CVE-2020-15222 is a security vulnerability in Github.com/ory/fosite involving Token reuse in Ory fosite under CWE-287: Improper Authentication.
Which Github.com/ory/fosite versions are affected?
Affected versions include releases prior to 0.31.0 across affected packages: github.com/ory/fosite.
What version fixes CVE-2020-15222?
Upgrading to 0.31.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/ory/fosite affected?
Yes, github.com/ory/fosite is affected in releases prior to 0.31.0. Upgrade your dependency to 0.31.0 or later.
What is the CVSS score of CVE-2020-15222?
CVE-2020-15222 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2020-15222?
CVE-2020-15222 is classified under CWE-287: Improper Authentication (When an actor claims to have a given identity, the product does not prove or insufficiently proves that the claim is correct.).
How can I check Go dependencies for CVE-2020-15222?
Run the dependency tree command: 'inspect dependencies for github.com/ory/fosite'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-v3q9-2p3m-7g43",
  "modified" : "2023-08-29T23:07:22Z",
  "published" : "2021-05-24T16:57:52Z",
  "aliases" : [ "CVE-2020-15222" ],
  "summary" : "Token reuse in Ory fosite",
  "details" : "### Impact\n\nWhen using client authentication method \"private_key_jwt\" [[1]](https://openid.net/specs/openid-connect-core-1_0.html#ClientAuthentication), OpenId specification says the following about assertion `jti`:\n\n> 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\n\nHydra 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:\n\n```\n$ curl --insecure --location --request POST 'https://localhost/_/oauth2/token' \\\n   --header 'Content-Type: application/x-www-form-urlencoded' \\\n   --data-urlencode 'grant_type=client_credentials' \\\n   --data-urlencode 'client_id=c001d00d-5ecc-beef-ca4e-b00b1e54a111' \\\n   --data-urlencode 'scope=application openid' \\\n   --data-urlencode 'client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer' \\\n   --data-urlencode 'client_assertion=eyJhb [...] jTw'\n{\"access_token\":\"zeG0NoqOtlACl8q5J6A-TIsNegQRRUzqLZaYrQtoBZQ.VR6iUcJQYp3u_j7pwvL7YtPqGhtyQe5OhnBE2KCp5pM\",\"expires_in\":3599,\"scope\":\"application openid\",\"token_type\":\"bearer\"}⏎\n$ curl --insecure --location --request POST 'https://localhost/_/oauth2/token' \\\n   --header 'Content-Type: application/x-www-form-urlencoded' \\\n   --data-urlencode 'grant_type=client_credentials' \\\n   --data-urlencode 'client_id=c001d00d-5ecc-beef-ca4e-b00b1e54a111' \\\n   --data-urlencode 'scope=application openid' \\\n   --data-urlencode 'client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer' \\\n   --data-urlencode 'client_assertion=eyJhb [...] jTw'\n{\"access_token\":\"wOYtgCLxLXlELORrwZlmeiqqMQ4kRzV-STU2_Sollas.mwlQGCZWXN7G2IoegUe1P0Vw5iGoKrkOzOaplhMSjm4\",\"expires_in\":3599,\"scope\":\"application openid\",\"token_type\":\"bearer\"}\n```\n\n### Patches\n\nThis issue is patched in 0.31.0.\n\n### Workarounds\n\nDo not allow clients to use `private_key_jwt`.\n\n### References\n\nhttps://openid.net/specs/openid-connect-core-1_0.html#ClientAuthentication",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/ory/fosite"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.31.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ory/fosite/security/advisories/GHSA-v3q9-2p3m-7g43"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-15222"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ory/fosite/commit/0c9e0f6d654913ad57c507dd9a36631e1858a3e9"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ory/fosite"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ory/fosite/releases/tag/v0.31.0"
  }, {
    "type" : "WEB",
    "url" : "https://openid.net/specs/openid-connect-core-1_0.html#ClientAuthentication"
  }, {
    "type" : "WEB",
    "url" : "https://pkg.go.dev/vuln/GO-2021-0110"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-287", "CWE-345" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2021-05-24T12:52:00Z",
    "nvd_published_at" : "2020-09-24T17:15:00Z"
  }
}