CVE-2022-36087: Oauthlib Denial of Service Vulnerability

MODERATE
Advisory Identifier: GHSA-3pgj-pg6c-r5p7
CVSS 5.7
CWE-20 CWE-601
Published
Advisory Summary

CVE-2022-36087 is a MODERATE (CVSS 5.7) denial of service vulnerability (CWE-20: Improper Input Validation) affecting Oauthlib libraries in the PyPI ecosystem. The issue involves oauthlib vulnerable to dos when attacker provides malicious ipv6 uri. Remediation is available by upgrading affected packages to version 3.2.2.

CVE-2022-36087 at a Glance

CVE Identifier CVE-2022-36087
GHSA Identifier GHSA-3pgj-pg6c-r5p7
Severity MODERATE
CVSS v3.1 Base Score 5.7
CWE Classification CWE-20: Improper Input Validation
Affected Product Oauthlib
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 5.7

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

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

How to Fix CVE-2022-36087

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

oauthlib fixed: 3.2.2
pip install oauthlib>=3.2.2
Verify Direct and Transitive Dependencies

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

pip show oauthlib

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2022-36087, inspect your installed packages using pip:

pip show oauthlib

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

Note: The pip show oauthlib command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Oauthlib, 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 - Attacker providing malicious redirect uri can cause DoS to oauthlib's web application. - Attacker can also leverage usage of `uri_validate` functions depending where it is used. _What kind of vulnerability is it? Who is impacted?_ Oauthlib applications using OAuth2.0 provider support or use directly `uri_validate` function. ### Patches _Has the problem been patched? What versions should users upgrade to?_ Issue fixed in 3.2.2 release. ### Workarounds _Is there a way for users to fix or remediate the vulnerability without upgrading?_ The `redirect_uri` can be verified in web toolkit (i.e `bottle-oauthlib`, `django-oauth-toolkit`, ...) before oauthlib is called. A sample check if `:` is present to reject the request can prevent the DoS, assuming no port or IPv6 is fundamentally required. ### References Attack Vector: - Attacker providing malicious redirect uri: https://github.com/oauthlib/oauthlib/blob/d4bafd9f1d0eba3766e933b1ac598cbbf37b8914/oauthlib/oauth2/rfc6749/grant_types/base.py#L232 - Vulnerable `uri_validate` functions: https://github.com/oauthlib/oauthlib/blob/2b8a44855a51ad5a5b0c348a08c2564a2e197ea2/oauthlib/uri_validate.py ### PoC ```python is_absolute_uri("http://[:::::::::::::::::::::::::::::::::::::::]/path") ``` ### Acknowledgement Special thanks to Sebastian Chnelik - PyUp.io

CVE-2022-36087 Affected Oauthlib Versions

1 component(s)
Fixed Versions:
3.2.2
Product / Package Ecosystem Affected Versions Fixed Version
oauthlib
PyPI
≥ 3.1.1
< 3.2.2
3.2.2

References

GitHub Advisory / Wiki ADVISORY
https://github.com/oauthlib/oauthlib/security/advisories/GHSA-3pgj-pg6c-r5p7
NVD — CVE-2022-36087 NVD
https://nvd.nist.gov/vuln/detail/CVE-2022-36087
Security Fix Commit FIX COMMIT
https://github.com/oauthlib/oauthlib/commit/2e40b412c844ecc4673c3fa3f72181f228bdbacd
Oauthlib Source Repository REPOSITORY
https://github.com/oauthlib/oauthlib
Oauthlib Source Repository REPOSITORY
https://github.com/oauthlib/oauthlib/blob/2b8a44855a51ad5a5b0c348a08c2564a2e197ea2/oauthlib/uri_validate.py
Oauthlib Source Repository REPOSITORY
https://github.com/oauthlib/oauthlib/blob/d4bafd9f1d0eba3766e933b1ac598cbbf37b8914/oauthlib/oauth2/rfc6749/grant_types/base.py#L232
Oauthlib Release RELEASE
https://github.com/oauthlib/oauthlib/releases/tag/v3.2.1
Oauthlib Source Repository REPOSITORY
https://github.com/pypa/advisory-database/tree/main/vulns/oauthlib/PYSEC-2022-269.yaml
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LXOPIA6M57CFQPUT6HHSNXCTV6QA3UDI
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NBCQJR3ZF7FVNTJYRVPVSQEQRAYZIUHU
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QRYLYHE5HWF6R2CRLJFUK4PILR47WXOE
lists.fedoraproject.org/archives/list/packa... WEB
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/X2CQZM5CKOUM4GW2GTAPQEQFPITQ6F7S

Frequently Asked Questions

What is CVE-2022-36087?
CVE-2022-36087 is a security vulnerability in Oauthlib involving OAuthLib vulnerable to DoS when attacker provides malicious IPV6 URI under CWE-20: Improper Input Validation.
Which Oauthlib versions are affected?
Affected versions include releases prior to 3.2.2 across affected packages: oauthlib.
What version fixes CVE-2022-36087?
Upgrading to 3.2.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is oauthlib affected?
Yes, oauthlib is affected in releases prior to 3.2.2. Upgrade your dependency to 3.2.2 or later.
What is the CVSS score of CVE-2022-36087?
CVE-2022-36087 has a CVSS v3.1 base score of 5.7 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H.
What CWE is associated with CVE-2022-36087?
CVE-2022-36087 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check PyPI dependencies for CVE-2022-36087?
Run the dependency tree command: 'pip show oauthlib'. 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-3pgj-pg6c-r5p7",
  "modified" : "2024-10-07T16:52:33Z",
  "published" : "2022-09-16T21:02:52Z",
  "aliases" : [ "CVE-2022-36087" ],
  "summary" : "OAuthLib vulnerable to DoS when attacker provides malicious IPV6 URI",
  "details" : "### Impact\n- Attacker providing malicious redirect uri can cause DoS to oauthlib's web application.\n- Attacker can also leverage usage of `uri_validate` functions depending where it is used.\n\n_What kind of vulnerability is it? Who is impacted?_\n\nOauthlib applications using OAuth2.0 provider support or use directly `uri_validate` function.\n\n### Patches\n_Has the problem been patched? What versions should users upgrade to?_\n\nIssue fixed in 3.2.2 release.\n\n### Workarounds\n_Is there a way for users to fix or remediate the vulnerability without upgrading?_\n\nThe `redirect_uri` can be verified in web toolkit (i.e `bottle-oauthlib`, `django-oauth-toolkit`, ...) before oauthlib is called. A sample check if `:` is present to reject the request can prevent the DoS, assuming no port or IPv6 is fundamentally required.\n\n### References\nAttack Vector:\n- Attacker providing malicious redirect uri:\nhttps://github.com/oauthlib/oauthlib/blob/d4bafd9f1d0eba3766e933b1ac598cbbf37b8914/oauthlib/oauth2/rfc6749/grant_types/base.py#L232\n- Vulnerable `uri_validate` functions:\nhttps://github.com/oauthlib/oauthlib/blob/2b8a44855a51ad5a5b0c348a08c2564a2e197ea2/oauthlib/uri_validate.py\n\n### PoC\n```python\nis_absolute_uri(\"http://[:::::::::::::::::::::::::::::::::::::::]/path\")\n```\n\n### Acknowledgement\nSpecial thanks to Sebastian Chnelik - PyUp.io",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "oauthlib"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.1.1"
      }, {
        "fixed" : "3.2.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/oauthlib/oauthlib/security/advisories/GHSA-3pgj-pg6c-r5p7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-36087"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/oauthlib/oauthlib/commit/2e40b412c844ecc4673c3fa3f72181f228bdbacd"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/oauthlib/oauthlib"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/oauthlib/oauthlib/blob/2b8a44855a51ad5a5b0c348a08c2564a2e197ea2/oauthlib/uri_validate.py"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/oauthlib/oauthlib/blob/d4bafd9f1d0eba3766e933b1ac598cbbf37b8914/oauthlib/oauth2/rfc6749/grant_types/base.py#L232"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/oauthlib/oauthlib/releases/tag/v3.2.1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/oauthlib/PYSEC-2022-269.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/LXOPIA6M57CFQPUT6HHSNXCTV6QA3UDI"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/NBCQJR3ZF7FVNTJYRVPVSQEQRAYZIUHU"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QRYLYHE5HWF6R2CRLJFUK4PILR47WXOE"
  }, {
    "type" : "WEB",
    "url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/X2CQZM5CKOUM4GW2GTAPQEQFPITQ6F7S"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-601" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-09-16T21:02:52Z",
    "nvd_published_at" : "2022-09-09T21:15:00Z"
  }
}