GHSA-qvp4-rpmr-xwrr: Github.com/ory/oathkeeper Possible Bypass Of Token Claim Vulnerability
HIGHGHSA-qvp4-rpmr-xwrr is a HIGH (CVSS 7.5) possible bypass of token claim vulnerability (CWE-863: Incorrect Authorization) affecting Github.com/ory/oathkeeper libraries in the Go ecosystem. The issue involves possible bypass of token claim validation when oauth2 introspection caching is enabled. Remediation is available by upgrading affected packages to version 0.38.12-beta.1.
GHSA-qvp4-rpmr-xwrr at a Glance
Security Impact
CVSS: 7.5
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:N/S:U/C:H/I:N/A:N).
How to Fix GHSA-qvp4-rpmr-xwrr
To remediate this vulnerability, upgrade all affected Github.com/ory/oathkeeper dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade github.com/ory/oathkeeper to 0.38.12-beta.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for github.com/ory/oathkeeper
How to Check if You Are Affected
To determine whether your application is affected by GHSA-qvp4-rpmr-xwrr, inspect your project dependencies for Github.com/ory/oathkeeper:
inspect dependencies for github.com/ory/oathkeeper
Analyze the terminal output to locate any version of Github.com/ory/oathkeeper in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.38.12-beta.1), 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-863: Incorrect Authorization, where the product performs an authorization check when an actor attempts to access a resource or perform an action, but it does not correctly perform the check. In Github.com/ory/oathkeeper, 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
GHSA-qvp4-rpmr-xwrr Affected Github.com/ory/oathkeeper Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
github.com/ory/oathkeeper
|
Go |
≥ 0.38.0-beta.2
< 0.38.12-beta.1
|
0.38.12-beta.1
|
References
Frequently Asked Questions
What is GHSA-qvp4-rpmr-xwrr?
Which Github.com/ory/oathkeeper versions are affected?
What version fixes GHSA-qvp4-rpmr-xwrr?
Is github.com/ory/oathkeeper affected?
What is the CVSS score of GHSA-qvp4-rpmr-xwrr?
What CWE is associated with GHSA-qvp4-rpmr-xwrr?
How can I check Go dependencies for GHSA-qvp4-rpmr-xwrr?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-qvp4-rpmr-xwrr",
"modified" : "2021-06-22T20:50:44Z",
"published" : "2021-06-23T18:00:20Z",
"aliases" : [ ],
"summary" : "Possible bypass of token claim validation when OAuth2 Introspection caching is enabled",
"details" : "### Impact\n\nWhen you make a request to an endpoint that requires the scope `foo` using an access token granted with that `foo` scope, introspection will be valid and that token will be cached. The problem comes when a second requests to an endpoint that requires the scope `bar` is made before the cache has expired. Whether the token is granted or not to the `bar` scope, introspection will be valid.\n\n### Patches\n\nA patch will be released with `v0.38.12-beta.1`.\n\n### Workarounds\n\nPer default, caching is disabled for the `oauth2_introspection` authenticator. When caching is disabled, this vulnerability does not exist.\n\n### Trace\n\nThe cache is checked in [`func (a *AuthenticatorOAuth2Introspection) Authenticate(...)`](https://github.com/ory/oathkeeper/blob/6a31df1c3779425e05db1c2a381166b087cb29a4/pipeline/authn/authenticator_oauth2_introspection.go#L152). From [`tokenFromCache()`](https://github.com/ory/oathkeeper/blob/6a31df1c3779425e05db1c2a381166b087cb29a4/pipeline/authn/authenticator_oauth2_introspection.go#L97) it seems that it only validates the token expiration date, but ignores whether the token has or not the proper scopes.\n\n### Post-Mortem\n\nThe vulnerability was introduced in PR #424. During review, we failed to require appropriate test coverage by the submitter which is the primary reason that the vulnerability passed the review process.\n\nTo avoid this from happening again we enabled codecov with a strict policy on the Ory Oathkeeper repository: Without an increase in code coverage the PR can not be merged.\n\nTo address this issue and any regressions we have added a test suite ensuring that the cache behaviour is correct in the different scenarios:\n\n- Scope strategy is `none`, cache is enabled, and `requested_scope` is not empty -> cache will not be used;\n- Scope strategy is `none`, cache is enabled, and `requested_scope` is empty -> cache will be used;\n- Scope strategy is not `none`, cache is enabled, and `requested_scope` is not empty -> cache will be used;\n\nas well as validating if `iss`, `aud`, `exp`, `token_use`, and scope are validated.\n\nAdditionally, we added [CodeQL scanning](https://github.com/ory/oathkeeper/commit/64ac7562669287d391cd72dfd43c5d71ff9f89a1) to the CI.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Go",
"name" : "github.com/ory/oathkeeper"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0.38.0-beta.2"
}, {
"fixed" : "0.38.12-beta.1"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 0.38.11-beta.1"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/ory/oathkeeper/security/advisories/GHSA-qvp4-rpmr-xwrr"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-863" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2021-06-22T20:50:44Z",
"nvd_published_at" : null
}
}