GHSA-3jp2-3mrg-2vxc: High severity pip/oauthlib vulnerability

Published Oct 27, 2026
·
Updated

Summary A call to the token endpoint with a grant type of "urn:ietf:params:oauth:grant-type:devicecode" and a bogus devicecode 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 says that the token endpoint should take in devicecode as a required parameter.DeviceCodeGrant.validatetokenrequest does not perform any validation of devicecode. DeviceCodeGrant.validatetokenrequest should be validating that devicecode was passed in as a parameter and that it is valid, similar to how AuthorizationCodeGrant.validatetokenrequest does the checks here and here.

I would like to propose a new method be added to RequestValidator called validatedevicecode that is similar to the validatecode method and is called inside of DeviceCodeGrant.validatetokenrequest.

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

Create a client that has a clienttype of "public" and set it's granttype to "urn:ietf:params:oauth:grant-type:devicecode".

With this implementation of RequestValidation.authenticateclient done, use that validator for your token endpoint. Call the token endpoint with a body of { "clientid": <ID of the public client you made>, "granttype": "urn:ietf:params:oauth:grant-type:devicecode", "devicecode": <anything you want since it's not validated> }

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

Impact Anyone using the RFC 8628 device workflow in oauthlib that doesn't realize the devicecode parameter is not being validated.

Affected Software

1 affected componentFixes available
pip/oauthlib>=3.3.0<4.0.0
4.0.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/oauthlib to a version that resolves this vulnerability.

    Fixed in 4.0.0
  2. Compensating control

    Update DeviceCodeGrant.validate_token_request to require the device_code parameter and validate that it is valid, using a RequestValidator.validate_device_code method similar to validate_code.

Event History

Oct 27, 2026
Advisory Published
via GitHub·01:30 PM
Data Sourced
via GitHub·01:30 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Who is exposed to this issue?

Deployments using OAuthLib's device authorization grant workflow are exposed if an attacker can reach the token endpoint and knows a valid client ID that is enabled for that workflow.

2

What does an attacker need to exploit it?

The attacker needs a valid client ID enabled for the device workflow. They can submit a token request using the device-code grant type with a bogus device_code and obtain a bearer token.

3

Does exploitation require a legitimate device code or user interaction?

No. The issue occurs because the device_code is not validated; a bogus value can be used. The provided information does not indicate any user interaction requirement.

4

What should be checked to determine exposure?

Check whether your application uses OAuthLib for device authorization grants and whether its token endpoint accepts the urn:ietf:params:oauth:grant-type:device_code grant type for configured client IDs.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203