{"id":"CVE-2026-49272","aliases":["CVE-2026-49272","GHSA-3jp2-3mrg-2vxc"],"related":[],"kind":"vulnerability","state":"published","title":"OAuthLib: Bearer token can be retrieved as long as client knows a valid client ID for device workflow","summary":"OAuthLib is an implementation of the OAuth request-signing logic for Python 3.6+. From 3.3.0 until 4.0.1, OAuthLib's RFC 8628 device workflow does not require DeviceCodeGrant.validate_token_request to check that the device_code parameter is present and valid. A caller whose client request is accepted by the configured validator and who knows a valid client ID enabled for the device workflow can submit a missing or bogus device code to the token endpoint and obtain a bearer token without completing device authorization. This issue is fixed in version 4.0.1.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"OAuthLib is an implementation of the OAuth request-signing logic for Python 3.6+. From 3.3.0 until 4.0.1, OAuthLib's RFC 8628 device workflow does not require DeviceCodeGrant.validate_token_request to check that the device_code parameter is present and valid. A caller whose client request is accepted by the configured validator and who knows a valid client ID enabled for the device workflow can submit a missing or bogus device code to the token endpoint and obtain a bearer token without completing device authorization. This issue is fixed in version 4.0.1.","source":"cvelist"},{"lang":"en","text":"### Summary\nA 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.\n\n### Details\n\n[Section 3.4 of the RFC 8628 spec](https://datatracker.ietf.org/doc/html/rfc8628#section-3.4) says 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` does the checks [here](https://github.com/oauthlib/oauthlib/blob/a015b446622f2b925517501fe484c10eff7a83c0/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py#L446) and [here](https://github.com/oauthlib/oauthlib/blob/a015b446622f2b925517501fe484c10eff7a83c0/oauthlib/oauth2/rfc6749/grant_types/authorization_code.py#L483).\n\nI would like to propose a new method 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`.\n\n### PoC\nCreate 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's another issue with `DeviceCodeGrant.validate_token_request` where it doesn't properly handle public clients (see https://github.com/oauthlib/oauthlib/issues/919).\n\nCreate a client that has a `client_type` of `\"public\"` and set it's `grant_type` to `\"urn:ietf:params:oauth:grant-type:device_code\"`.\n\nWith this implementation of `RequestValidation.authenticate_client` done, use that validator for your token endpoint. Call the token endpoint with a body of \n```\n{\n  \"client_id\": <ID of the public client you made>,\n  \"grant_type\": \"urn:ietf:params:oauth:grant-type:device_code\",\n  \"device_code\": <anything you want since it's not validated>\n}\n```\n\nYou now have a bearer token for the client without a valid `device_code`.\n\n\n### Impact\nAnyone using the RFC 8628 device workflow in oauthlib that doesn't realize the `device_code` parameter is not being validated.","format":"markdown","source":"ghsa"}],"published":"2026-10-27T13:30:17.000Z","modified":"2026-11-12T20:04:52.377Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:N","score":8.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:N","score":8.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:N","score":8.5,"rating":"HIGH"}],"cwes":["CWE-287"],"affected":[{"ranges":[{"version":">= 3.3.0, < 4.0.1","status":"affected"}],"vendor":"oauthlib","product":"oauthlib","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"3.3.0","status":"affected","fixed":"4.0.1"}],"ecosystem":"PyPI","package":"oauthlib","purl":"pkg:pypi/oauthlib","source":"ghsa"}],"references":[{"url":"https://github.com/oauthlib/oauthlib/security/advisories/GHSA-3jp2-3mrg-2vxc","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/oauthlib/oauthlib/pull/954","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/oauthlib/oauthlib/commit/77a5f1c8ce00da2b0b8c5f6e9cc129920085f114","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/oauthlib/oauthlib/releases/tag/v4.0.1","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/oauthlib/oauthlib","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-11-05T21:14:28.774Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-49272","url":"https://www.cve.org/CVERecord?id=CVE-2026-49272","licence":"CVE Terms of Use","modified":"2026-11-05T21:14:43.982Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-3jp2-3mrg-2vxc","url":"https://github.com/advisories/GHSA-3jp2-3mrg-2vxc","licence":"CC-BY-4.0","modified":"2026-11-05T21:15:09.240Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-49272","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-49272","licence":"Public domain","modified":"2026-11-12T20:04:52.377Z"}],"updatedAt":"2026-11-25T22:59:49.186Z","epss":{"score":0.00363,"percentile":0.32147,"date":"2026-12-01T12:00:22.000Z"}}