CVE-2022-31027: Oauthenticator Authorization Bypass Through User-Controlled Key Vulnerability
MODERATECVE-2022-31027 is a MODERATE (CVSS 4.2) authorization bypass through user-controlled key vulnerability (CWE-639: Authorization Bypass Through User-Controlled Key) affecting Oauthenticator libraries in the PyPI ecosystem. The issue involves authorization bypass through user-controlled key when using cilogonoauthenticator oauthenticator. Remediation is available by upgrading affected packages to version 15.0.0.
CVE-2022-31027 at a Glance
Security Impact
CVSS: 4.2
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N).
How to Fix CVE-2022-31027
To remediate this vulnerability, upgrade all affected Oauthenticator dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install oauthenticator>=15.0.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show oauthenticator
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2022-31027, inspect your installed packages using pip:
pip show oauthenticator
Analyze the terminal output to locate any version of Oauthenticator in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 15.0.0), your application is affected.
Note: The pip show oauthenticator command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-639: Authorization Bypass Through User-Controlled Key, where the system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. In Oauthenticator, 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
CVE-2022-31027 Affected Oauthenticator Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
oauthenticator
|
PyPI |
< 15.0.0
|
15.0.0
|
References
Frequently Asked Questions
What is CVE-2022-31027?
Which Oauthenticator versions are affected?
What version fixes CVE-2022-31027?
Is oauthenticator affected?
What is the CVSS score of CVE-2022-31027?
What CWE is associated with CVE-2022-31027?
How can I check PyPI dependencies for CVE-2022-31027?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-r7v4-jwx9-wx43",
"modified" : "2022-06-06T21:21:40Z",
"published" : "2022-06-06T21:21:40Z",
"aliases" : [ "CVE-2022-31027" ],
"summary" : "Authorization Bypass Through User-Controlled Key when using CILogonOAuthenticator oauthenticator",
"details" : "# Background\n\nCILogon is a federated auth provider that allows users to authenticate\nthemselves via a number of Identity Providers (IdP), focused primarily on educational and\nresearch institutions (such as Universities). More traditional and open IdPs\nsuch as GitHub, ORCID, Google, Microsoft, etc are also supported.\n\nCILogonOAuthenticator is provided by the OAuthenticator package, and lets users log\nin to a JupyterHub via CILogon. This is primarily used to restrict a JupyterHub\nonly to users of a given institute. The allowed_idps configuration trait of\nCILogonOAuthenticator is documented to be a list of domains that indicate the\ninstitutions whose users are authorized to access this JupyterHub. This authorization\nis validated by ensuring that the *email* field provided to us by CILogon has a\n*domain* that matches one of the domains listed in `allowed_idps`.\n\n# Impact\n\nIf `allowed_idps` contains `berkeley.edu`, you might expect only users with valid\ncurrent credentials provided by University of California, Berkeley to be able to\naccess the JupyterHub. However, CILogonOAuthenticator does *not* verify which provider\nis used by the user to login, only the email address provided. So a user can login\nwith a GitHub account that has email set to `<something>@berkeley.edu`, and that will\nbe treated exactly the same as someone logging in using the UC Berkeley official\nIdentity Provider. This has two consequences:\n\n1. Since GitHub (and most other providers we tested) only require you to verify\n your email once, a user can access a JupyterHub even if their access to\n the institution's IdP has been revoked or expired.\n2. CILogon supports hundreds of identity providers - if even one of them allows\n users to set any email ids without verifying, that can be used to impersonate\n *any* user on any other identity provider! While CILogon itself has a stellar\n security record, this particular method of doing authorization means an attacker\n would only need to compromise a single identity provider to compromise all of\n CILogon\n\nWe currently do not know of any identity provider that provides *unverified*\nemail addresses to CILogon, so this is not a severe known vulnerability. However,\nthere are hundreds of IdPs, and we could not try them all.\n\n# Patches\n\nThis patch makes a *breaking change* in how `allowed_idps` is interpreted. It's\nno longer a list of domains, but configuration representing the `EntityID` of the\nIdPs that are allowed, picked from the [list maintained by CILogon](https://cilogon.org/idplist/).\nSo instead of `berkeley.edu`, you would specify `urn:mace:incommon:berkeley.edu` to\nallow logins from users currently with `berkeley.edu` accounts. GitHub users\nwith a verified `berkeley.edu` email will no longer be allowed to log in.\n\nFor details on how to transition your CILogonOAuthenticator configuration to the patched version 15.0.0 or above, see [the migration](https://oauthenticator.readthedocs.io/en/latest/migrations.html) documentation.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "oauthenticator"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "15.0.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/jupyterhub/oauthenticator/security/advisories/GHSA-r7v4-jwx9-wx43"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31027"
}, {
"type" : "WEB",
"url" : "https://github.com/jupyterhub/oauthenticator/commit/5cd2d1816f90dc5c946e6e38fd2d0ba535624c5c"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/jupyterhub/oauthenticator"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/oauthenticator/PYSEC-2022-206.yaml"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-639" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-06-06T21:21:40Z",
"nvd_published_at" : "2022-06-09T13:15:00Z"
}
}