Skip to content
Heist/ feed
Back to feed
MediumFix available

Oauthlib: Timing Attack Vulnerability in PKCE code_verifier Comparison (CWE-208)

Type: advisorySources: OSV2 source records

## Summary A timing side-channel vulnerability exists in the PKCE (RFC 7636) implementation of the Authorization Code Grant flow. The `code_challenge_method_plain` function uses Python's standard `==` operator for string comparison instead of a constant-time comparison function, potentially allowing timing-based attacks. ## Affected Component - File: `oauthlib/oauth2/rfc6749/grant_types/authorization_code.py` - Functions: `code_challenge_method_plain`, `code_challenge_method_s256` - Vulnerability Type: CWE-208 (Observable Timing Discrepancy) ## Technical Details Python's `==` operator uses short-circuit evaluation when comparing strings: 1. Returns `False` immediately if lengths differ 2. Compares characters left-to-right, stopping at first mismatch This means comparison time varies linearly with the length of the common prefix between the attacker-supplied verifier and the stored challenge, creating a measurable timing oracle. ## Proof of Concept Tested locally against oauthlib source (network jitter eliminated to isolate pure Python execution time): | Input | Result | Time (10M iterations) | |---|---|---| | Wrong first char (`B` + `A`*49) | Fast reject | 0.34106s | | 49 chars correct (`A`*49 + `B`) | Deep compare | 0.37847s | | **Difference** | | **0.03741s** | The ~37ms delta over 10M iterations corresponds to nanosecond-level differences per call, which are statistically exploitable under controlled conditions. ## Attack Scenario 1. Attacker intercepts `authorization_code

Products
oauthlib
Affected versions
3.0.0, 3.0.1, 3.0.2, 3.1.0, 3.1.1, 3.2.0, 3.2.1, 3.2.2, 3.3.0, 3.3.1
Fixed versions
4.0.0
CVEs
CVE-2026-49265
Confirmed fixed CVEs
Not specified
Updated in this feed
30 Oct 2026, 10:32 UTC · Revision 1

Source evidence

Oauthlib: Timing Attack Vulnerability in PKCE code_verifier Comparison (CWE-208)

core-osv · Original source

Published 29 Sept 2026, 17:56 UTC

## Summary A timing side-channel vulnerability exists in the PKCE (RFC 7636) implementation of the Authorization Code Grant flow. The `code_challenge_method_plain` function uses Python's standard `==` operator for string comparison instead of a constant-time comparison function, potentially allowing timing-based attacks. ## Affected Component - File: `oauthlib/oauth2/rfc6749/grant_types/authorization_code.py` - Functions: `code_challenge_method_plain`, `code_challenge_method_s256` - Vulnerability Type: CWE-208 (Observable Timing Discrepancy) ## Technical Details Python's `==` operator uses short-circuit evaluation when comparing strings: 1. Returns `False` immediately if lengths differ 2. Compares characters left-to-right, stopping at first mismatch This means comparison time varies linearly with the length of the common prefix between the attacker-supplied verifier and the stored challenge, creating a measurable timing oracle. ## Proof of Concept Tested locally against oauthlib source (network jitter eliminated to isolate pure Python execution time): | Input | Result | Time (10M iterations) | |---|---|---| | Wrong first char (`B` + `A`*49) | Fast reject | 0.34106s | | 49 chars correct (`A`*49 + `B`) | Deep compare | 0.37847s | | **Difference** | | **0.03741s** | The ~37ms delta over 10M iterations corresponds to nanosecond-level differences per call, which are statistically exploitable under controlled conditions. ## Attack Scenario 1. Attacker intercepts `authorization_code

osv:GHSA-xpv3-w29h-x7cv

oauthlib

Fixed versions: 4.0.0

Complete source record
{
  "id": "6330a8fdfd019226fe5f8c9359332bf7677f7014eb4bc0d885b1294a2f832caa",
  "url": "https://osv.dev/vulnerability/GHSA-xpv3-w29h-x7cv",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Oauthlib: Timing Attack Vulnerability in PKCE code_verifier Comparison (CWE-208)",
    "summary": "## Summary A timing side-channel vulnerability exists in the PKCE (RFC 7636) implementation of the Authorization Code Grant flow. The `code_challenge_method_plain` function uses Python's standard `==` operator for string comparison instead of a constant-time comparison function, potentially allowing timing-based attacks. ## Affected Component - File: `oauthlib/oauth2/rfc6749/grant_types/authorization_code.py` - Functions: `code_challenge_method_plain`, `code_challenge_method_s256` - Vulnerability Type: CWE-208 (Observable Timing Discrepancy) ## Technical Details Python's `==` operator uses short-circuit evaluation when comparing strings: 1. Returns `False` immediately if lengths differ 2. Compares characters left-to-right, stopping at first mismatch This means comparison time varies linearly with the length of the common prefix between the attacker-supplied verifier and the stored challenge, creating a measurable timing oracle. ## Proof of Concept Tested locally against oauthlib source (network jitter eliminated to isolate pure Python execution time): | Input | Result | Time (10M iterations) | |---|---|---| | Wrong first char (`B` + `A`*49) | Fast reject | 0.34106s | | 49 chars correct (`A`*49 + `B`) | Deep compare | 0.37847s | | **Difference** | | **0.03741s** | The ~37ms delta over 10M iterations corresponds to nanosecond-level differences per call, which are statistically exploitable under controlled conditions. ## Attack Scenario 1. Attacker intercepts `authorization_code",
    "evidence": "osv:GHSA-xpv3-w29h-x7cv",
    "products": [
      {
        "name": {
          "value": "oauthlib",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "4.0.0",
            "evidence": "/affected/0/ranges"
          }
        ],
        "affected_versions": [
          {
            "value": "3.0.0",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.0.1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.0.2",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.1.0",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.1.1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.2.0",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.2.1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.2.2",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.3.0",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.3.1",
            "evidence": "/affected/0/versions"
          }
        ]
      }
    ],
    "severity": "medium",
    "structured": {
      "id": "GHSA-xpv3-w29h-x7cv",
      "aliases": [
        "CVE-2026-49265",
        "GHSA-xpv3-w29h-x7cv",
        "PYSEC-2026-4114"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "3.0.0"
                },
                {
                  "fixed": "4.0.0"
                }
              ]
            }
          ],
          "package": {
            "name": "oauthlib",
            "purl": "pkg:pypi/oauthlib",
            "ecosystem": "PyPI"
          },
          "versions": [
            "3.0.0",
            "3.0.1",
            "3.0.2",
            "3.1.0",
            "3.1.1",
            "3.2.0",
            "3.2.1",
            "3.2.2",
            "3.3.0",
            "3.3.1"
          ],
          "database_specific": {
            "source": "https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/09/GHSA-xpv3-w29h-x7cv/GHSA-xpv3-w29h-x7cv.json"
          }
        }
      ],
      "modified": "2026-10-13T16:00:32.097492414Z",
      "provider": "osv",
      "references": [
        "https://github.com/oauthlib/oauthlib/security/advisories/GHSA-xpv3-w29h-x7cv",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-49265",
        "https://github.com/oauthlib/oauthlib/pull/963",
        "https://github.com/oauthlib/oauthlib/commit/40b0ab56da3682c2484a4b78bbff309f8025d950",
        "https://github.com/oauthlib/oauthlib",
        "https://github.com/pypa/advisory-database/tree/main/vulns/oauthlib/PYSEC-2026-4114.yaml"
      ],
      "provider_metadata": {
        "cwe_ids": [
          "CWE-208"
        ],
        "severity": "MODERATE",
        "github_reviewed": true,
        "nvd_published_at": null,
        "github_reviewed_at": "2026-09-29T17:56:31Z"
      }
    },
    "related_cves": [
      {
        "value": "CVE-2026-49265",
        "evidence": "/aliases"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 311822,
  "published_at": "2026-09-29T17:56:31+00:00"
}

Oauthlib: Timing Attack Vulnerability in PKCE code_verifier Comparison (CWE-208)

core-osv · Original source

Published 1 Oct 2026, 16:38 UTC

## Summary A timing side-channel vulnerability exists in the PKCE (RFC 7636) implementation of the Authorization Code Grant flow. The `code_challenge_method_plain` function uses Python's standard `==` operator for string comparison instead of a constant-time comparison function, potentially allowing timing-based attacks. ## Affected Component - File: `oauthlib/oauth2/rfc6749/grant_types/authorization_code.py` - Functions: `code_challenge_method_plain`, `code_challenge_method_s256` - Vulnerability Type: CWE-208 (Observable Timing Discrepancy) ## Technical Details Python's `==` operator uses short-circuit evaluation when comparing strings: 1. Returns `False` immediately if lengths differ 2. Compares characters left-to-right, stopping at first mismatch This means comparison time varies linearly with the length of the common prefix between the attacker-supplied verifier and the stored challenge, creating a measurable timing oracle. ## Proof of Concept Tested locally against oauthlib source (network jitter eliminated to isolate pure Python execution time): | Input | Result | Time (10M iterations) | |---|---|---| | Wrong first char (`B` + `A`*49) | Fast reject | 0.34106s | | 49 chars correct (`A`*49 + `B`) | Deep compare | 0.37847s | | **Difference** | | **0.03741s** | The ~37ms delta over 10M iterations corresponds to nanosecond-level differences per call, which are statistically exploitable under controlled conditions. ## Attack Scenario 1. Attacker intercepts `authorization_code

osv:PYSEC-2026-4114

oauthlib

Fixed versions: 4.0.0

Complete source record
{
  "id": "a1e02041063479354fa9e5b91cc9488eb0ae74f768bd4617da84563ada76340e",
  "url": "https://osv.dev/vulnerability/PYSEC-2026-4114",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "Oauthlib: Timing Attack Vulnerability in PKCE code_verifier Comparison (CWE-208)",
    "summary": "## Summary A timing side-channel vulnerability exists in the PKCE (RFC 7636) implementation of the Authorization Code Grant flow. The `code_challenge_method_plain` function uses Python's standard `==` operator for string comparison instead of a constant-time comparison function, potentially allowing timing-based attacks. ## Affected Component - File: `oauthlib/oauth2/rfc6749/grant_types/authorization_code.py` - Functions: `code_challenge_method_plain`, `code_challenge_method_s256` - Vulnerability Type: CWE-208 (Observable Timing Discrepancy) ## Technical Details Python's `==` operator uses short-circuit evaluation when comparing strings: 1. Returns `False` immediately if lengths differ 2. Compares characters left-to-right, stopping at first mismatch This means comparison time varies linearly with the length of the common prefix between the attacker-supplied verifier and the stored challenge, creating a measurable timing oracle. ## Proof of Concept Tested locally against oauthlib source (network jitter eliminated to isolate pure Python execution time): | Input | Result | Time (10M iterations) | |---|---|---| | Wrong first char (`B` + `A`*49) | Fast reject | 0.34106s | | 49 chars correct (`A`*49 + `B`) | Deep compare | 0.37847s | | **Difference** | | **0.03741s** | The ~37ms delta over 10M iterations corresponds to nanosecond-level differences per call, which are statistically exploitable under controlled conditions. ## Attack Scenario 1. Attacker intercepts `authorization_code",
    "evidence": "osv:PYSEC-2026-4114",
    "products": [
      {
        "name": {
          "value": "oauthlib",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [
          {
            "value": "4.0.0",
            "evidence": "/affected/0/ranges"
          }
        ],
        "affected_versions": [
          {
            "value": "3.0.0",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.0.1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.0.2",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.1.0",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.1.1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.2.0",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.2.1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.2.2",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.3.0",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "3.3.1",
            "evidence": "/affected/0/versions"
          }
        ]
      }
    ],
    "severity": "unknown",
    "structured": {
      "id": "PYSEC-2026-4114",
      "aliases": [
        "CVE-2026-49265",
        "GHSA-xpv3-w29h-x7cv",
        "PYSEC-2026-4114"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:N"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "3.0.0"
                },
                {
                  "fixed": "4.0.0"
                }
              ]
            }
          ],
          "package": {
            "name": "oauthlib",
            "purl": "pkg:pypi/oauthlib",
            "ecosystem": "PyPI"
          },
          "versions": [
            "3.0.0",
            "3.0.1",
            "3.0.2",
            "3.1.0",
            "3.1.1",
            "3.2.0",
            "3.2.1",
            "3.2.2",
            "3.3.0",
            "3.3.1"
          ],
          "database_specific": {
            "source": "https://github.com/pypa/advisory-database/blob/main/vulns/oauthlib/PYSEC-2026-4114.yaml"
          }
        }
      ],
      "modified": "2026-10-01T17:45:10.985894602Z",
      "provider": "osv",
      "references": [
        "https://github.com/oauthlib/oauthlib/security/advisories/GHSA-xpv3-w29h-x7cv",
        "https://github.com/oauthlib/oauthlib/pull/963",
        "https://github.com/oauthlib/oauthlib/commit/40b0ab56da3682c2484a4b78bbff309f8025d950",
        "https://github.com/oauthlib/oauthlib",
        "https://pypi.org/project/oauthlib",
        "https://github.com/advisories/GHSA-xpv3-w29h-x7cv",
        "https://nvd.nist.gov/vuln/detail/CVE-2026-49265"
      ]
    },
    "related_cves": [
      {
        "value": "CVE-2026-49265",
        "evidence": "/aliases"
      }
    ],
    "security_relevant": true,
    "severity_evidence": null
  },
  "source_id": "core-osv",
  "document_id": 71432,
  "published_at": "2026-10-01T16:38:40.027+00:00"
}