Oauthlib: Incorrect Authorization (CVE-2026-118669)
Published Last modified Sources: OSV, Hersteller, CVE.org
What is affected, what to do
Update Oauthlib to version 4.0.0.
- Affected
- Oauthlib
lt *..4.0.0
- Oauthlib
- Fixed in
- Oauthlib
4.0.0
- Oauthlib
Not sure whether and how you are affected? Ask a question about this vulnerability
Metrics
8.4
Priority
XIEM Effective CVSS: highest available CVSS rating from NVD and vendor data.
Source: Vendor (CNA), CVSS v4
8.4
CVSS v4
Severity High on the scale from 0 to 10.
Source: OSV, Hersteller, CVE.org
0.3 %
EPSS score
Low — model estimates < 1% exploitation likelihood.
Source: FIRST EPSS, percentile 24.2
Show all metrics
- Severity
- High
Priority (0–325)
The priority score is a consolidated metric that condenses several individual signals into a single, action-guiding ranking: technical severity (CVSS), exploitation likelihood (EPSS), known-exploited status (KEV) and the context of the affected asset. The aim is to answer the only truly important question in vulnerability management: what first?
Read in glossary- 76.67 Methodology
Exploit maturity
An exploit is code or a technique that specifically uses a concrete vulnerability to force unintended behaviour — such as executing code or escalating privileges. It is the tool that turns a theoretical flaw into a practical attack.
Read in glossary- no public PoC known
XIEM Effective CVSS
XIEM® is the tiered managed-security operating model from NEOSEC and a registered trademark of NEOSEC GmbH. It extends classic SIEM — the central collection, normalisation and correlation of security-relevant events — with endpoint forensics, network visibility and deception technology, and consolidates them into three building tiers: Sentry, Orchestrate and Command.
Read in glossary- 8.4 Methodology
CVSS v4
CVSS is the globally established, open standard for assessing the technical severity of a vulnerability on a scale from 0 to 10. It describes how easily a flaw can be exploited and what damage it can cause — but not how likely its actual exploitation is. CVSS and the complementary EPSS deliberately answer different questions.
Read in glossary- 8.4
EPSS score
The EPSS score is the absolute model output for an individual vulnerability: the estimated probability of real-world exploitation within the next 30 days, expressed as a value between 0 and 1 (i.e. 0 % to 100 %). A score of 0.42 means „the model estimates a 42 % chance of real-world exploitation within 30 days“.
Read in glossary- 0.3 %
- Low — model estimates < 1% exploitation likelihood.
EPSS percentile
The EPSS percentile is the relative position of a vulnerability within all EPSS-scored CVEs, expressed as a value between 0 and 1. A percentile of 0.90 means „this CVE has a higher EPSS score than 90 % of all other scored CVEs“. Unlike the EPSS score, it is not a probability — but a positioning within a ranking.
Read in glossary- 24.2
- Elevated — this CVE ranks above at least 10% of all CVEs scored today.
KEV status
The KEV catalogue is a list maintained by the US authority CISA of vulnerabilities for which active exploitation in the wild has been confirmed. It answers not the question „how severe?“ but „is it already being attacked?“ — thereby sharply prioritising patching.
Read in glossary- —
- Published
CWE
CWE is a catalogue of typical weakness types in software and hardware — such as flawed input validation, unsafe memory handling or poor authentication. Where a CVE names a concrete vulnerability in a concrete product, a CWE describes the underlying class of defect.
Read in glossary- CWE-863
Detection rules
No NEOSEC detection rule is available for this vulnerability yet.
Classification under NIS2 and CRA
Rule-based classification from exploitation status and severity. It does not replace a case-by-case assessment.
NIS2
NIS2 is EU Directive (EU) 2022/2555 to raise the level of cybersecurity across the Union. It substantially broadens obligations compared with the first NIS directive: more sectors, mandatory risk management, staged reporting duties and personal accountability of senior management.
Read in glossary- High technical severity: assess and remediate the vulnerability in vulnerability handling under Art. 21(2)(e) NIS2 and document the decision.
CRA
The CRA is EU Regulation (EU) 2024/2847 setting horizontal cybersecurity requirements for „products with digital elements“ — from industrial controllers and software to connected consumer devices. For the first time manufacturers must ensure security across the entire product lifecycle, handle vulnerabilities and provide security updates.
Read in glossary- From 11.12.2027, Annex I Part II CRA requires manufacturers of affected products with digital elements to handle vulnerabilities without delay and provide security updates.
ISO/IEC 27001
ISO/IEC 27001 is the internationally leading standard for an information security management system (ISMS). It describes a risk-based, process-oriented framework to systematically plan, implement, review and improve information security.
Read in glossary- Control A.8.8, management of technical vulnerabilities: assess relevance to your systems, plan remediation and keep evidence.
Description
Summary
OAuthlib's token grant handlers can authenticate one client while authorizing the grant type and requested scopes using a different, attacker-supplied client_id from the request body.
In affected token grant flows, authenticate_client(request) sets request.client to the authenticated client object, but OAuthlib does not require request.client_id to match request.client.client_id. If the request body already contains client_id=..., OAuthlib keeps that value and passes it to validate_grant_type() and validate_scopes().
As a result, an authenticated low-privilege confidential client can authenticate as itself, submit another client's client_id in the token request body, and cause grant and scope validation to run under that other client identity.
Affected Surface
The affected public surface is the OAuth2 token endpoint handling for:
client_credentialspassword/ Resource Owner Password Credentials
The issue is relevant to OAuthlib provider deployments where:
- the attacker has credentials for one valid lower-privilege confidential client;
- another client has broader grants or scopes;
- the application validator uses the
client_idargument passed by OAuthlib invalidate_grant_type()orvalidate_scopes(), as theRequestValidatorAPI is designed to support.
Deployments whose validators ignore the client_id argument and authorize only from request.client may not be affected.
Details
Request parses query and body parameters into request attributes, including client_id:
The RequestValidator.authenticate_client() contract requires the integrator to authenticate the client and set request.client:
For the client_credentials grant, OAuthlib authenticates the client, verifies that request.client has a client_id, then performs grant and scope validation before normalizing request.client_id from request.client.client_id:
The problematic order is:
if not self.request_validator.authenticate_client(request):
...
elif not hasattr(request.client, 'client_id'):
...
self.validate_grant_type(request)
request.client_id = request.client_id or request.client.client_id
self.validate_scopes(request)
Because OAuthlib only fills request.client_id when it is missing, an attacker-supplied body value such as client_id=high survives even when request.client.client_id == "low".
The shared grant helper then authorizes using request.client_id, while passing the authenticated client object separately:
validate_grant_type(request.client_id, request.grant_type, request.client, request): https://github.com/oauthlib/oauthlib/blob/b3f9edffed6b370e3eb92721cea0da22ec7e18b9/oauthlib/oauth2/rfc6749/grant_types/base.py#L152-L162validate_scopes(request.client_id, request.scopes, request.client, request): https://github.com/oauthlib/oauthlib/blob/b3f9edffed6b370e3eb92721cea0da22ec7e18b9/oauthlib/oauth2/rfc6749/grant_types/base.py#L164-L176
The same identity split exists in the Resource Owner Password Credentials flow. After client authentication and user validation, OAuthlib validates the grant and scopes before replacing a missing request.client_id from request.client.client_id:
- https://github.com/oauthlib/oauthlib/blob/b3f9edffed6b370e3eb92721cea0da22ec7e18b9/oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py#L87-L97
- https://github.com/oauthlib/oauthlib/blob/b3f9edffed6b370e3eb92721cea0da22ec7e18b9/oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py#L178-L195
This creates an inconsistent identity state:
request.client.client_id == "low" # authenticated client
request.client_id == "high" # attacker-supplied request parameter
OAuthlib then calls application authorization hooks with both values, but uses the attacker-controlled request.client_id as the first-class client_id argument.
Impact
An authenticated lower-privilege confidential client can obtain tokens authorized under another client's grant and scope policy if the application's validator follows the RequestValidator API and authorizes by the client_id argument.
Concrete impact can include:
- issuing access tokens with scopes not assigned to the authenticated client;
- allowing a low-privilege client to use a grant type reserved for a higher-privilege client;
- persisting tokens under a spoofed
client_idwhile the authenticated client object is different.
This is a token authorization bypass, not an unauthenticated attack. The attacker needs valid credentials for one client.
PoC
Create the following files in an empty directory.
requirements.txt:
oauthlib==3.3.1
repro.py:
import base64
import json
from oauthlib.oauth2 import (
BearerToken,
ClientCredentialsGrant,
RequestValidator,
ResourceOwnerPasswordCredentialsGrant,
TokenEndpoint,
)
class Client:
def __init__(self, client_id):
self.client_id = client_id
CLIENTS = {
"low": {
"secret": "low-secret",
"grants": {"client_credentials", "password"},
"scopes": {"read"},
},
"high": {
"secret": "high-secret",
"grants": {"client_credentials", "password"},
"scopes": {"read", "admin"},
},
}
class DemoValidator(RequestValidator):
def __init__(self):
self.saved_tokens = []
def authenticate_client(self, request, *args, **kwargs):
authorization = request.headers.get("Authorization", "")
prefix = "Basic "
if not authorization.startswith(prefix):
return False
decoded = base64.b64decode(authorization[len(prefix):]).decode("utf-8")
client_id, secret = decoded.split(":", 1)
record = CLIENTS.get(client_id)
if record is None or record["secret"] != secret:
return False
# This is the authenticated client identity.
request.client = Client(client_id)
return True
def client_authentication_required(self, request, *args, **kwargs):
return True
def validate_grant_type(self, client_id, grant_type, client, request, *args, **kwargs):
record = CLIENTS.get(client_id)
return record is not None and grant_type in record["grants"]
def validate_scopes(self, client_id, scopes, client, request, *args, **kwargs):
record = CLIENTS.get(client_id)
return record is not None and set(scopes or []) <= record["scopes"]
def get_default_scopes(self, client_id, request, *args, **kwargs):
return []
def validate_user(self, username, password, client, request, *args, **kwargs):
if username == "alice" and password == "wonderland":
request.user = username
return True
return False
def save_bearer_token(self, token, request, *args, **kwargs):
self.saved_tokens.append({
"token": dict(token),
"authenticated_client_id": request.client.client_id,
"request_client_id": request.client_id,
"scopes": list(request.scopes or []),
})
validator = DemoValidator()
token = BearerToken(validator, expires_in=3600)
endpoint = TokenEndpoint(
default_grant_type="client_credentials",
default_token_type=token,
grant_types={
"client_credentials": ClientCredentialsGrant(validator),
"password": ResourceOwnerPasswordCredentialsGrant(validator),
},
)
def low_client_headers():
value = base64.b64encode(b"low:low-secret").decode("ascii")
return {"Authorization": f"Basic {valu
Source: OSV (Open Source Vulnerabilities), GitHub Security Advisories, cvelistv5, NVD (NIST)
Affected products
The following versions are affected. Older releases of the same product line are also vulnerable unless stated otherwise.
| Affected versions | Fixed in | ||
|---|---|---|---|
| oauthlib | oauthlib |
|
|
| pip | oauthlib |
|
|
| pypi | oauthlib |
|
|
Vendors and products
Weakness classes (CWE)
CWE-863Incorrect Authorization
Class
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.
Entry at MITRE CWE-863
References & sources
- github.comoauthlib/oauthlib/commit/c951a1d09f99f14e3240973fa83c4f4287d475…x_refsource_MISC, web
- github.comoauthlib/oauthlib/pull/920x_refsource_MISC, web
- github.comoauthlib/oauthlib/releases/tag/v4.0.0x_refsource_MISC, web
- github.comoauthlib/oauthlib/security/advisories/GHSA-7984-qgvg-3j9cx_refsource_CONFIRM, web
- NVD (NIST)vuln/detail/CVE-2026-118669advisory
- github.comoauthlib/oauthlibpackage
Changes to this CVE
Who changed this CVE and when: NVD (analysis, affected products, CVSS), the CVE publisher (CNA) and additional providers such as CISA (ADP).
ReceivedGitHub
CVSS V4.0: AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:N/SC:H/SI:H/SA:N
Weakness type: CWE-863
Description added or changed
Show 8 original changes
Individual changes of this event as published by NVD Type Action Before After Description added —OAuthLib is an implementation of the OAuth request-signing logic for Python 3.6+. Prior to 4.0.0, the client_credentials and Resource Owner Password Credentials token grant handlers can authenticate request.client as one confidential client while retaining an attacker-supplied request.client_id for validate_grant_type and validate_scopes. A lower-privilege authenticated client can therefore cause grant and scope authorization to use another client's identity when an application validator relies on the documented client_id argument, potentially issuing tokens with unauthorized grants or scopes. Validators that authorize exclusively from request.client may not be affected. This issue is fixed in version 4.0.0.CVSS added —AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:N/SC:H/SI:H/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:XWeakness type (CWE) added —CWE-863Affected versions (publisher) added —New affected value received. <a href="https://github.com/CVEProject/cvelistV5/blob/main/cves/2026/118xxx/CVE-2026-118669.json">CVE-2026-118669</a>Reference added —https://github.com/oauthlib/oauthlib/commit/c951a1d09f99f14e3240973fa83c4f4287d4753dReference added —https://github.com/oauthlib/oauthlib/pull/920Reference added —https://github.com/oauthlib/oauthlib/releases/tag/v4.0.0Reference added —https://github.com/oauthlib/oauthlib/security/advisories/GHSA-7984-qgvg-3j9cSource identifier: security-advisories@github.com
Embed badge
Show the severity and KEV status of this vulnerability on your site – with a link back here. The image is updated hourly.
<a href="https://intel.neosec.eu/en/cve/CVE-2026-118669"><img src="https://intel.neosec.eu/badge/cve/CVE-2026-118669.svg?lang=en" alt="CVE-2026-118669 – NEOSEC Intel" height="20"></a>