A public OAuth client ("Robodog CLI", client_id b889d2968aaee9169fc6981dcf175c2f63af8cddf1bfdce0a431fa1757534502) uses the authorization code grant with a loopback redirect_uri of http:
Description
This is CWE-1211 (weakness in OAuth 2.0 client/authorization server). The client has no secret (it is public), and the authorization request carries no code_challenge; the token exchange requires no code_verifier. RFC 8252 section 8.1 requires PKCE for public native-app clients using a loopback redirect_uri. Without PKCE, a second local process can register port 8080 (plain HTTP, no TLS), receive the code, and redeem it for a token with no proof of possession.
Step by step reproduction
1. Start the authorization request with no PKCE parameters. The server accepts it and shows the consent prompt.
GET /login?client_id=b889d2968aaee9169fc6981dcf175c2f63af8cddf1bfdce0a431fa1757534502&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Fcallback&response_type=code&scope=notes%3Aread&state=CAPTURETEST
Result: the "Authorize Robodog CLI" consent screen (screenshot attached). No code_challenge was sent, and none was required.
2. Confirm the client is public. A token request without a secret returns invalid_grant rather than invalid_client, proving no client_secret is enforced.
POST /oauth/token
{"grant_type":"authorization_code","code":"placeholder","client_id":"b889d2968aaee9169fc6981dcf175c2f63af8cddf1bfdce0a431fa1757534502","redirect_uri":"http://localhost:8080/callback"}
Response: {"error":"invalid_grant",...}
3. Complete the authorization and capture the code on the loopback redirect:
http:
4. Exchange the code with no secret and no PKCE verifier. It succeeds and issues tokens.
POST /oauth/token
{"grant_type":"authorization_code","code":"4d7cd29b9ae5157a41e2a6445c530f226ead7eee9e15dc0e56dcd732022f1d94","client_id":"b889d2968aaee9169fc6981dcf175c2f63af8cddf1bfdce0a431fa1757534502","redirect_uri":"http://localhost:8080/callback"}
Response: HTTP 200
{"access_token":"cdc7a699981e26fcefb0c...34e6","refresh_token":"571923f6...9b7c","token_type":"Bearer","expires_in":7200,"scope":"notes:read","id_token":"eyJhbG..."}
5. Use the token to read the account's notes:
GET https:
Authorization: Bearer cdc7a699981e26fcefb0cf87b6d26f255bb21d663dad43dbbd69373500b334e6
Response: HTTP 200, 7 notes returned (titles and UUIDs, see attached evidence).
Impact
A single authorization code that leaks to a local observer turns into full API access to the victim's account. The access token (7200s) and the refresh token provide ongoing access, and the same flow works for write scopes (notes:write, notes:create, notes:create-content-action) and account scopes. The one-time code is the only secret protecting the exchange, and with PKCE missing there is nothing binding that code to the legitimate client.
As attacker I can run a listener on localhost:8080, route a victim through the authorize link, capture the code in the redirect, and immediately redeem it for access and refresh tokens that read and write the victim's notes.
Remediation
Require PKCE for every public client using the authorization code grant. Reject authorization requests that omit code_challenge, and require the matching code_verifier at the token endpoint for public clients.
Note
I tested against the production API using two disposable accounts I created for this engagement (fzsusanto+amptest01@gmail.com, fzsusanto+amptest02@gmail.com). The code and token above are from my own throwaway account. I did not access any other user's data. The redirect_uri is validated (a foreign redirect_uri is rejected), which is good; the gap is the missing PKCE on a secret-less client. Full evidence is in the attachment.