GHSA-Q735-3FFP-VV6J
Authorized-applications endpoints act on a nil resource owner
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:L
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-Q735-3FFP-VV6J divulgada · CVSS 6.5 (GitHub) | |
| Divulgación | Modificada | Última actualización del registro | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
`Doorkeeper::AuthorizedApplicationsController` guards its actions with
`before_action :authenticate_resource_owner!`, but that helper merely evaluates the configured
`resource_owner_authenticator` and ignores its return value. When the authenticator returns `nil` without halting
the request — which is what Doorkeeper's own default authenticator does — the actions proceed with
`current_resource_owner == nil`. Since `nil` matches every record whose `resource_owner_id` is `NULL`, an
unauthenticated caller can list and revoke all `client_credentials` tokens issued by the server.
Description
Code path
# lib/doorkeeper/helpers/controller.rb
def authenticate_resource_owner!
current_resource_owner
endThe helper evaluates `current_resource_owner` (which instance-evals the configured
`resource_owner_authenticator` block) and discards the result. Nothing inspects it, and no `before_action` chain is
halted unless the block itself renders, redirects or raises.
Doorkeeper's default for that option is:
option :resource_owner_authenticator,
as: :authenticate_resource_owner,
default: (lambda do |_routes|
::Rails.logger.warn(I18n.t("doorkeeper.errors.messages.resource_owner_authenticator_not_configured"))
nil
end)It logs a warning and returns `nil`. The request continues.
`AuthorizedApplicationsController` then calls:
- `index` → `application_model.authorized_for(current_resource_owner)` →
- `destroy` → `application_model.revoke_tokens_and_grants_for(params[:id], current_resource_owner)` →
`resource_owner_id IS NULL` is exactly the set of tokens issued through the `client_credentials` grant, which has no
resource owner by definition. A `nil` owner therefore does not select "nothing"; it selects **every machine-to-machine
token on the server**.
Note the generated initializer template `raise`s in its `resource_owner_authenticator` block, and the commented
example redirects — both halt correctly. The vulnerable states are (a) the block deleted entirely, which falls back to
the nil-returning default, and (b) a custom block that returns `nil` for unauthenticated callers instead of halting.
Deleting the block is a natural thing to do in a `client_credentials`-only machine-to-machine API: there is no
end-user session to authenticate, and the consent screen is never rendered, so the option looks inapplicable.
Doorkeeper mounts `/oauth/authorized_applications` anyway.
Attack scenario
Against a deployment running `api_only` with `grant_flows %w[client_credentials]` and a plain `use_doorkeeper`
(no `skip_controllers`), with the `resource_owner_authenticator` block absent or nil-returning:
- `GET /oauth/authorized_applications.json` returns `200` with the list of applications holding active tokens
- `DELETE /oauth/authorized_applications/:id.json` returns `204` and revokes every active `client_credentials`
No credentials, no session and no user interaction are involved. In `api_only` mode there is no CSRF protection on
these routes either, so the request can also be made cross-site.
The same missing return-value check applies to `authenticate_admin!` and
`Doorkeeper::ApplicationsController`: an `admin_authenticator` block that returns `nil` without halting (including
an empty block) leaves the application-management screens — which expose client identifiers and, with plain secret
storage, client secrets — open in the same way.
*(No proof-of-concept or exploit code is included in this advisory.)*
Impact
A deployment is affected when all of the following hold:
- Doorkeeper's `authorized_applications` routes are mounted — the default for `use_doorkeeper` since v5.5.0,
- the configured `resource_owner_authenticator` returns `nil` for an unauthenticated caller without rendering,
- tokens exist with no resource owner, i.e. the `client_credentials` grant is enabled.
An unauthenticated network attacker can then enumerate the applications holding active machine-to-machine tokens and
revoke all of their access tokens and grants, causing a denial of service against every integration that relies on
them until new tokens are obtained. Where the host application logs or alerts on token revocation, the attacker also
controls when those alerts fire.
Deployments whose authenticator raises, redirects, renders or calls `head` — including every deployment that kept the
generated initializer's block — are not affected. Deployments that mount Doorkeeper with
`use_doorkeeper { skip_controllers :authorized_applications }` are not affected.
Remediation
No patched release is available yet.
Planned fix: refuse the request when the authenticator produced no resource owner and did not halt on its own,
rather than continuing with `nil`. Because a `nil` resource owner is meaningful in other parts of the engine, the
change is expected to be scoped to the controllers that use the resource owner as an authorization boundary.
Workarounds available today, without upgrading:
- Configure `resource_owner_authenticator` so that it always halts when there is no authenticated user
- If the deployment has no end users at all, do not mount the routes:
- Apply the same rule to `admin_authenticator` and never leave it as an empty block.
References
- RFC 6749 Section 4.4 (Client Credentials Grant — no resource owner is involved)
- RFC 6819 Section 5.1.5.3 (token revocation as an availability-relevant operation)
- Commit `9391bf4e` — authorized applications endpoint (v0.2.0)
- Commit `c7269011` — nil-returning default `resource_owner_authenticator` (v0.5.0.rc1)
- Commit `f4c02592` / PR #1448 — applications and authorized applications routes mounted in `api_only` mode (v5.5.0)
- GHSA-h5m9-42h9-vcq6 — earlier improper-authorization issue on the revocation endpoint (distinct endpoint and
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-q735-3ffp-vv6jLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
