/

CVE-2026-49272

Severity:

HIGH RISK

(8.5)

Authentication Bypass (CWE-287) in OAuthLib Device Flow

CVE-2026-49272

Received

Vulnerability type

Category:

Authentication Bypass

CWE:

CWE-287

Impact:

Unauthorized bearer token issuance

Severity:

HIGH RISK

(8.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

OAuthLib's device authorization workflow can issue a bearer token without verifying that a token request includes a valid device code. A client whose request is accepted by the configured validator and that knows a client ID enabled for the device workflow may be able to obtain a token without completing device authorization.

OAuthLib's device authorization workflow can issue a bearer token without verifying that a token request includes a valid device code. A client whose request is accepted by the configured validator and that knows a client ID enabled for the device workflow may be able to obtain a token without completing device authorization.

Affected context

The issue affects OAuthLib's RFC 8628 device workflow in versions from 3.3.0 up to, but not including, 4.0.1. It becomes relevant when the device-flow token endpoint accepts a client request through its configured validator but does not require DeviceCodeGrant.validate_token_request to verify that the device_code parameter is present and valid.

The issue affects OAuthLib's RFC 8628 device workflow in versions from 3.3.0 up to, but not including, 4.0.1. It becomes relevant when the device-flow token endpoint accepts a client request through its configured validator but does not require DeviceCodeGrant.validate_token_request to verify that the device_code parameter is present and valid.

Exploit preconditions

  • Attack surface: The OAuth device-flow token endpoint
  • Required access: A client request accepted by the configured validator and knowledge of a valid client ID enabled for the device workflow
  • Trigger point: A token request that omits or supplies an invalid device_code
  • Why exploitation is possible: The workflow does not ensure the device code is present and valid before issuing a bearer token
  • Attack surface: The OAuth device-flow token endpoint
  • Required access: A client request accepted by the configured validator and knowledge of a valid client ID enabled for the device workflow
  • Trigger point: A token request that omits or supplies an invalid device_code
  • Why exploitation is possible: The workflow does not ensure the device code is present and valid before issuing a bearer token

Why this happens

The device-flow token request validation does not enforce the required device-code check. This is an authentication bypass mapped to CWE-287: Improper Authentication: a token may be issued without verifying that the requester completed the device authorization associated with a valid code.

The device-flow token request validation does not enforce the required device-code check. This is an authentication bypass mapped to CWE-287: Improper Authentication: a token may be issued without verifying that the requester completed the device authorization associated with a valid code.

Potential impact

  • An unauthorized client could obtain a bearer token without completing device authorization.
  • A token holder could access resources permitted by the token's scope and privileges.
  • Affected services could face unauthorized data access or actions performed under the token's authority.
  • An unauthorized client could obtain a bearer token without completing device authorization.
  • A token holder could access resources permitted by the token's scope and privileges.
  • Affected services could face unauthorized data access or actions performed under the token's authority.

General mitigation guidance

Defensive patterns include requiring every device-flow token request to contain a valid, active device code and binding that code to the intended client and authorization state. Treat client identifiers as identifiers rather than proof of authorization, and apply consistent validation before issuing tokens. Limit token scopes and privileges, and ensure invalid or incomplete requests fail closed.

Defensive patterns include requiring every device-flow token request to contain a valid, active device code and binding that code to the intended client and authorization state. Treat client identifiers as identifiers rather than proof of authorization, and apply consistent validation before issuing tokens. Limit token scopes and privileges, and ensure invalid or incomplete requests fail closed.

How teams detect issues like this

  • Review token-grant validation paths for device-code presence, validity, client binding, and authorization-state checks.
  • Use static analysis or automated code review to flag token issuance paths that do not enforce grant-specific validation.
  • Monitor for device-flow token requests with missing, malformed, or invalid device codes, especially when followed by successful token issuance.
  • Enforce policy checks requiring grant-specific validation before any token is issued.
  • Review token-grant validation paths for device-code presence, validity, client binding, and authorization-state checks.
  • Use static analysis or automated code review to flag token issuance paths that do not enforce grant-specific validation.
  • Monitor for device-flow token requests with missing, malformed, or invalid device codes, especially when followed by successful token issuance.
  • Enforce policy checks requiring grant-specific validation before any token is issued.

Sources

SourceLink
github.comgithub.com/oauthlib/oauthlib/commit/77a5f1c8ce00da2b0b8c5f6e9cc129920085f114
github.comgithub.com/oauthlib/oauthlib/pull/954
github.comgithub.com/oauthlib/oauthlib/releases/tag/v4.0.1
github.comgithub.com/oauthlib/oauthlib/security/advisories/GHSA-3jp2-3mrg-2vxc

Frequently asked

questions

The attack surface is the device-flow token endpoint, so exploitation may be possible over the network when that endpoint is accessible and the stated client and validator conditions are met.

The requester must have a request accepted by the configured validator and know a valid client ID enabled for the device workflow; completing device authorization is not required.

Require and validate the device code, including its relationship to the client and authorization state, before issuing a token.

Apply grant-specific validation consistently, fail closed on missing or invalid authorization data, and test token issuance paths for incomplete or unauthorized requests.

The attack surface is the device-flow token endpoint, so exploitation may be possible over the network when that endpoint is accessible and the stated client and validator conditions are met.

The requester must have a request accepted by the configured validator and know a valid client ID enabled for the device workflow; completing device authorization is not required.

Require and validate the device code, including its relationship to the client and authorization state, before issuing a token.

Apply grant-specific validation consistently, fail closed on missing or invalid authorization data, and test token issuance paths for incomplete or unauthorized requests.

Find out what's already
exploitable in your codebase.