High

OAuthLib: Bearer token can be retrieved as long as client knows a valid client ID for device workflow

  • Disclosed: 27.10.2026
  • Updated: 05.11.2026 23:17

The source advisory has changed since this explanation was prepared. Check the current technical data and original advisory below.

Summary

A call to the token endpoint with a grant type of "urn:ietf:params:oauth:grant-type:device_code" and a bogus device_code is able to get a bearer token as long as they know a valid client ID enabled for the device workflow.

Details

Section 3.4 of the RFC 8628 spec states that the token endpoint should take in device_code as a required parameter. DeviceCodeGrant.validate_token_request does not perform any validation of device_code. DeviceCodeGrant.validate_token_request should be validating that device_code was passed in as a parameter and that it is valid, similar to how AuthorizationCodeGrant.validate_token_request performs checks here and here..

A new method was proposed to be added to RequestValidator called validate_device_code that is similar to the validate_code method and is called inside of DeviceCodeGrant.validate_token_request.

PoC

Create an implementation of RequestValidation.authenticate_client that returns True if the client's client_type is "public". You would find yourself in this scenario because there is another issue with DeviceCodeGrant.validate_token_request where it does not properly handle public clients (see https://github.com/oauthlib/oauthlib/issues/919).).

Create a client that has a client_type of "public" and set its grant_type to "urn:ietf:params:oauth:grant-type:device_code".

With this implementation of RequestValidation.authenticate_client done, use that validator for your token endpoint. Call the token endpoint with a body of:

{
  "client_id": <ID of the public client you made>,
  "grant_type": "urn:ietf:params:oauth:grant-type:device_code",
  "device_code": <anything you want since it's not validated>
}

You now have a bearer token for the client without a valid device_code.

Impact

Anyone using the RFC 8628 device workflow in oauthlib where the device_code parameter is not being validated.

What to do

Upgrade oauthlib to version 4.0.0 or later.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Python (PyPI) oauthlib >= 3.3.0, < 4.0.1 4.0.1

References

CVSS score 8.5/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:N
Weakness (CWE)
CWE-287
Platform
Python (PyPI)
Package
oauthlib
Disclosed
27.10.2026
Updated
05.11.2026 23:17

Sources and licenses · Edited or translated by DockRay; source rights and applicable licenses are retained.

OSV / GitHub Advisory Database - GHSA-3jp2-3mrg-2vxc - CC BY 4.0

Vulnerability history: oauthlib

All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.

Total entries
5
First → latest
09.2022 10.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • High 2
  • Medium 3

Disclosures per year

  1. 2022: 1
  2. 2023: 0
  3. 2024: 0
  4. 2025: 0
  5. 2026: 4
  1. OAuthLib: Bearer token can be retrieved as long as client knows a valid client ID for device workflow this entry
    High · 8.5 CVE-2026-49272 >= 3.3.0, < 4.0.1 4.0.1
  2. Medium · 6.8 CVE-2026-49265 >= 3.0.0, < 4.0.0 4.0.0
  3. Medium · 5.7 CVE-2022-36087 >= 3.1.1, < 3.2.2 3.2.2

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.