GHSA-86WH-7QGJ-4PX7
Open redirect in the authorization endpoint's deny path
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-86WH-7QGJ-4PX7 divulgada · CVSS 4.7 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
`DELETE /oauth/authorize` (the "deny" action of `Doorkeeper::AuthorizationsController`) builds and sends its `access_denied` error response without validating `client_id`, `redirect_uri` or `response_type` first. An authenticated resource owner can therefore be redirected — or `form_post`-submitted — to an arbitrary, unregistered URI supplied in the request, and a missing `redirect_uri` raises an unhandled exception (HTTP 500).
Description
Code path
`Doorkeeper::AuthorizationsController#destroy` is:
def destroy
redirect_or_render(authorization.deny)
rescue Doorkeeper::Errors::InvalidTokenStrategy => e
# ...
end- The `validate_client` before-action added in 6.0 is declared `only: :new` and is itself opt-in (`validate_client_before_resource_owner_authentication`), so it never runs for `destroy`.
- `#create` routes through `#authorize_response`, which refuses unless `pre_auth.authorizable?`. `#destroy` calls neither `authorizable?` nor `client_valid?`.
- `OAuth::CodeRequest#deny` (and `TokenRequest#deny`) only sets `pre_auth.error = Errors::AccessDenied` and returns `pre_auth.error_response`.
- `OAuth::ErrorResponse.from_request` copies `request.redirect_uri` — the raw request parameter — into the response, and `#redirectable?` is true because `access_denied` is not in `NON_REDIRECTABLE_STATES`.
- `#redirect_or_render` then performs `redirect_to auth.redirect_uri, allow_other_host: true`, renders the `form_post` view (`form_tag @pre_auth.redirect_uri`), or, in `api_only` mode, returns the URI in a JSON body.
Observed behaviour (authorization server default configuration, logged-in resource owner):
| Request | Result |
|---|---|
| `redirect_uri` pointing at an attacker origin, no `client_id` at all | `302` to that origin, carrying `error=access_denied`, `error_description` and the attacker-chosen `state` |
| Registered `client_id` + unregistered `redirect_uri` | `302` to the unregistered URI |
| `response_mode=form_post` | `200` with an auto-submitting form whose `action` is the attacker URI |
| `redirect_uri` omitted | `URI::InvalidURIError` — unhandled, HTTP 500 |
| `api_only` mode | `400` with `{"status":"redirect","redirect_uri":"<attacker URI>…"}` in the body |
This contradicts RFC 6749 Section 3.1.2.4, which requires the authorization server not to automatically redirect the user agent to an invalid redirection URI, and Section 4.1.2.1, which requires the server to validate the client identifier and redirection URI before deciding whether to redirect an error back to the client.
Related: unvalidated `response_type` on the same path
`#strategy` resolves `server.authorization_request(pre_auth.response_type)` from the same unvalidated parameters. `Doorkeeper::Request.authorization_strategy` falls back to `"Doorkeeper::Request::#{response_type.camelize}".constantize` when no registered authorization flow matches. Unlike `token_strategy`, this fallback carries no allow-list check, so a value such as `password` or `client_credentials` resolves to a token-endpoint strategy at the authorization endpoint.
The resulting object does not respond to `#deny`, so the request ends in a 500 — but the strategy's request object is built first, and building the password strategy request evaluates the host application's `resource_owner_from_credentials` block. The consequence is that a host application's credential-checking code runs from the authorization endpoint even when the password grant is disabled entirely: it sits outside any rate limiting applied to `/oauth/token`, and with Devise `:lockable` it advances the failed-attempt counter for an arbitrary username. The uniform 500 response means it is not a credential oracle.
Attack scenarios
- API-only deployments. `Doorkeeper::ApplicationController` applies `protect_from_forgery` only `unless Doorkeeper.config.api_only`, so in `api_only` mode there is no CSRF protection on this route at all. A single-page application that forwards the authorization query parameters into its own "deny" call will forward an attacker-supplied `redirect_uri` with them; the victim only has to open the attacker's authorization URL and press the deny button. The response carries `error=access_denied` (and, on 6.0, the provider's RFC 9207 `iss` value), so it looks like a genuine authorization-server response.
- Deployments that relax CSRF protection. Host applications that call `skip_forgery_protection` on Doorkeeper's controllers — a pattern that occurs in public deployments, usually to support mobile web views — turn this into a plain cross-site open redirect reachable from any page the victim visits. Note that Rails' default `SameSite=Lax` session cookie prevents cross-site form POSTs from carrying the session, so this variant requires `SameSite=None` or a same-site attacker origin.
- Any authenticated user can trigger the unhandled `URI::InvalidURIError` by issuing the deny request without a `redirect_uri`, producing a 500 and filling the error tracker.
Under the default (non-`api_only`) configuration, CSRF protection is the only control preventing a cross-site request, and the consent screen's own deny form always carries a validated redirect URI — so the default configuration is not trivially exploitable. The finding is that no OAuth-layer validation exists on this path at all.
*(No proof-of-concept or exploit code is included in this advisory.)*
Impact
Affected deployments are those where a cross-site or parameter-forwarded `DELETE /oauth/authorize` can reach Doorkeeper with attacker-chosen parameters:
- `api_only` deployments (no CSRF protection on Doorkeeper routes), especially with an SPA that forwards authorization parameters into the deny call;
- deployments that skip forgery protection for Doorkeeper's controllers;
- deployments that override the consent view and post the deny form with attacker-influenced parameters.
A successful request redirects an authenticated user from the authorization server's own domain to an attacker-controlled origin, with the OAuth `state` (and, on 6.0, the issuer identifier) attached. This is the classic phishing and token-theft stepping stone an open redirect on an OAuth endpoint provides: the victim sees the provider's domain in the link, and the landing page can impersonate the provider's login or consent screen. Any authenticated user can additionally cause unhandled 500 responses.
Deployments that keep Rails' CSRF protection on Doorkeeper's controllers and do not forward request parameters into the deny call are not believed to be exploitable from a third-party origin.
Remediation
No patched release is available yet.
Planned fix: validate the client and the redirect URI before producing the deny response, and render — never redirect — when that validation fails, matching the treatment already given to `invalid_client` and `invalid_redirect_uri` elsewhere in the authorization endpoint. Reject unregistered `response_type` values on the authorization endpoint rather than resolving them through the retro-compatibility `constantize` fallback.
Workarounds available today, without upgrading:
- Keep Rails CSRF protection enabled for Doorkeeper's controllers; do not call `skip_forgery_protection` on them. In `api_only` mode, place the authorization endpoint behind the host application's own CSRF or origin check.
- If the host application forwards query parameters into its deny request, forward only parameters it has itself validated against the registered client.
- Override `Doorkeeper::AuthorizationsController#destroy` in the host application to refuse the request unless the `client_id` resolves to a registered application whose registered redirect URI matches the submitted one.
References
- RFC 6749 Section 3.1.2.4 (Invalid Endpoint) and Section 4.1.2.1 (Error Response)
- RFC 6819 Section 4.1.5 / Section 5.2.3.5 (open redirect on the authorization endpoint)
- RFC 9207 Section 2 (issuer identifier in authorization responses)
- Commit `52c02464` — introduction of the deny action (v0.1.0)
- Commit `c76711bd` / PR #1816 — redirect URI validation moved before `client_supports_grant_flow` in the `new`/`create` path (6.0.0.beta1 and later only; not backported to 5.9.x)
- PR #1910 — `validate_client` before resource owner authentication, `only: :new`
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
rubygemsdoorkeeper |
Sin parche | — | — | 5.9.9 afectada |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/doorkeeper-gem/doorkeeper/security/advisories/GHSA-86wh-7qgj-4px7Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
