{"schema":"threatline.record/2","record":{"id":"CVE-2026-49272","aliases":["GHSA-3jp2-3mrg-2vxc"],"summary":"OAuthLib: Bearer token can be retrieved as long as client knows a valid client ID for device workflow","details":"### 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.","categories":["Libraries & packages"],"product":"oauthlib","vendor":"","ecosystem":"pip","affected_ranges":[{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-3jp2-3mrg-2vxc","source_modified_at":"2026-10-27T13:30:19Z","fetched_at":"2026-10-27T16:27:21.584480Z","package":{"ecosystem":"pip","name":"oauthlib"},"range":">= 3.3.0, < 4.0.0"},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-3jp2-3mrg-2vxc","source_modified_at":"2026-10-27T13:45:03.096035248Z","fetched_at":"2026-10-27T16:27:21.584480Z","package":{"name":"oauthlib","ecosystem":"PyPI","purl":"pkg:pypi/oauthlib"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"3.3.0"},{"fixed":"4.0.0"}]}],"versions":["3.3.0","3.3.1"]}],"fixed_versions":[{"source":"GitHub Advisory Database","source_url":"https://github.com/advisories/GHSA-3jp2-3mrg-2vxc","source_modified_at":"2026-10-27T13:30:19Z","fetched_at":"2026-10-27T16:27:21.584480Z","package":{"ecosystem":"pip","name":"oauthlib"},"version":"4.0.0"},{"source":"OSV","source_url":"https://osv.dev/vulnerability/GHSA-3jp2-3mrg-2vxc","source_modified_at":"2026-10-27T13:45:03.096035248Z","fetched_at":"2026-10-27T16:27:21.584480Z","package":{"name":"oauthlib","ecosystem":"PyPI","purl":"pkg:pypi/oauthlib"},"version":"4.0.0"}],"cvss":8.5,"severity":"High","kev":{"listed":false},"epss":{"probability":null,"percentile":null,"score_date":null},"published_at":"2026-10-27T13:30:17Z","modified_at":"2026-10-27T13:45:03.096035248Z","provenance":[{"source":"GitHub Advisory Database","url":"https://github.com/advisories/GHSA-3jp2-3mrg-2vxc","fetched_at":"2026-10-27T16:27:21.584480Z","source_modified_at":"2026-10-27T13:30:19Z"},{"source":"OSV","url":"https://osv.dev/vulnerability/GHSA-3jp2-3mrg-2vxc","fetched_at":"2026-10-27T16:27:21.584480Z","source_modified_at":"2026-10-27T13:45:03.096035248Z"}],"sources":["GitHub Advisory Database","OSV"],"references":[{"url":"https://github.com/oauthlib/oauthlib/security/advisories/GHSA-3jp2-3mrg-2vxc","source":"GitHub Advisory Database"},{"url":"https://github.com/oauthlib/oauthlib/releases/tag/v4.0.0","source":"GitHub Advisory Database"},{"url":"https://github.com/advisories/GHSA-3jp2-3mrg-2vxc","source":"GitHub Advisory Database"}],"locations":[],"motoko_assessment":{"status":"requires_architecture_review","automatic_remediation":false},"classification":{"method":"product-first software-layer rules","rules_version":"2.1","matched_on":"ecosystem","confidence":"heuristic","reviewed":false},"change_timestamp":"2026-10-27T13:45:03.096035248Z","content_hash":"7c8eb27810c244dc408eb6a30904688c8fe1d4152a9b4853b9aa384870c390d4"}}
