GHSA-4q9j-6299-gxmr Dragonfly Manager OAuth provider client_secret disclosure via unauthenticated GET /api/v1/oauth
SummaryThe Dragonfly Manager exposes `GET /api/v1/oauth` and `GET /api/v1/oauth/:id` to unauthenticated clients. The response body deserializes the entire `manager/models.Oauth` struct, which includes the `client_secret` field. Any network-reachable attacker can read the OAuth client secrets configured for `github` or `google` providers, defeating the confidentiality guarantee of those secrets and enabling subsequent abuse against the connected identity providers.Affected versions`github.com/dragonflyoss/dragonfly` `<= v2.4.3` (and current `main` at commit `46a8f1e`). The vulnerable wiring is present back to the introduction of OAuth GET handlers and was not addressed by GHSA-j8hf-cp34-g4j7 / CVE-2026-24124, whose remediation only added `jwt + rbac` middleware to the `/jobs` group.Privilege requiredUnauthenticated. The only precondition is that an administrator has registered at least one OAuth provider via `POST /api/v1/oauth` (a one-time setup for tenants that enable GitHub / Google sign-in).Vulnerable code[`manager/router/router.go:134-140`](https://github.com/dragonflyoss/dragonfly/blob/e1491bf6134fe307b09e82e11fa94b0587dcd323/manager/router/router.go#L134-L140) (v2.4.3) — the `/oauth` group registration:Note the asymmetry inside the same `oa` route group: `POST`, `PATCH`, and `DELETE` explicitly attach `jwt.MiddlewareFunc(), rbac` as per-route middleware, but the two `GET` handlers omit both. Compare with the sibling group three lines below at [`manager/router/router.go:143-148`](https://github.com/dragonflyoss/dragonfly/blob/e1491bf6134fe307b09e82e11fa94b0587dcd323/manager/router/router.go#L143-L148), the `/clusters` group:Here the middleware pair is attached once at the group level, so every verb on `/clusters` is guarded. The OAuth GETs are an unguarded sibling of the same primitive that GHSA-j8hf-cp34-g4j7 (Jan 2026) patched on the `/jobs` group. This is `sibling-method-dispatch-target` of the AP-012 sub-shape lens: same module, same router file, same anchor primitive ("group lacking JWT + RBAC"), parallel GET methods missed.The handler at [`manager/handlers/oauth.go:127-141`](https://github.com/dragonflyoss/dragonfly/blob/e1491bf6134fe307b09e82e11fa94b0587dcd323/manager/handlers/oauth.go#L127-L141) returns the model directly:[`manager/handlers/oauth.go:155-171`](https://github.com/dragonflyoss/dragonfly/blob/e1491bf6134fe307b09e82e11fa94b0587dcd323/manager/handlers/oauth.go#L155-L171) has the parallel list handler:[`manager/models/oauth.go:19-26`](https://github.com/dragonflyoss/dragonfly/blob/e1491bf6134fe307b09e82e11fa94b0587dcd323/manager/models/oauth.go#L19-L26) declares `ClientSecret` with no `json:"-"` tag, so it is serialized into every response:How an unauthenticated request reaches the OAuth client_secret`gin.Engine` routes `GET /api/v1/oauth/:id` to the `oa` group registered at [`manager/router/router.go:135`](https://github.com/dragonflyoss/dragonfly/blob/e1491bf6134fe307b09e82e11fa94b0587dcd323/manager/router/router.go#L135). Because no middleware is attached at the group level and none is attached at the per-route level, the request bypasses `jwt.MiddlewareFunc()` (which would have set or rejected `c.Get("id")`) and `middlewares.RBAC()` (which would have called Casbin enforcement).The request enters `h.GetOauth` ([`manager/handlers/oauth.go:127`](https://github.com/dragonflyoss/dragonfly/blob/e1491bf6134fe307b09e82e11fa94b0587dcd323/manager/handlers/oauth.go#L127)), which binds the `:id` path parameter and calls `h.service.GetOauth`.`service.GetOauth` ([`manager/service/oauth.go`](https://github.com/dragonflyoss/dragonfly/blob/e1491bf6134fe307b09e82e11fa94b0587dcd323/manager/service/oauth.go)) does `s.db.First(&oauth, id)` and returns the populated `models.Oauth`.The handler calls `ctx.JSON(http.StatusOK, oauth)`. The `ClientSecret` field is serialized as `client_secret` in the response body.There is no PVR-style validator, no schema filter, no `omitempty`, and no DTO projection on the way. The audit middleware records the request as `actor=unknown`.Proof of conceptBoth calls return `HTTP 200` with a JSON body that includes `client_secret`.End-to-end reproduction (against `dragonflyoss/manager:v2.4.3` on docker compose)Boot the deployment with the project's stock `deploy/docker-compose` stack reduced to the Manager + its MySQL + Redis dependencies:Bootstrap one administrator and register an OAuth provider whose secret we plant as a sentinel:Captured run output of the actual attack (unauthenticated client):Interpretation: `/api/v1/clusters` and `/api/v1/jobs` both reject the unauthenticated curl with `401 Unauthorized` (the JWT + RBAC stack engages). The OAuth GETs return `200 OK` plus the full row including `client_secret`. The Manager's own RBAC enforcement that exists for every other admin resource is bypassed for these two routes.Fix verification (after applying the patch in the next section), the same harness must return `401 Unauthorized` for both attack steps.ImpactThe OAuth sign-in feature is `not actually used in practice within the Dragonfly project itself`.Unauthenticated disclosure of OAuth `client_secret` for GitHub / Google providers. A `client_secret` permits an attacker to mint OAuth tokens against the configured IdP for arbitrary callback URLs (subject to the provider's redirect-URI allowlist on that client), to impersonate the Manager during the OAuth handshake, and to construct phishing pages that look identical to the Manager's own redirect URL.The same row also exposes `client_id` and `redirect_url`, both of which are useful for a follow-up account-takeover against any Manager user who relies on the OAuth sign-in flow.Tenants who exposed the Manager's REST port (`8080/tcp`, default in the project's `docker-compose.yaml` and Helm chart) to a corporate network or the internet leak the secret to every host that can reach the port. Network-policy or ingress filtering does not mitigate this for in-cluster attackers.CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor) compounded by CWE-306 (Missing Authentication for Critical Function).Suggested fixMove the JWT and RBAC middleware to the route-group level, matching every other admin resource in the same file (`/clusters`, `/scheduler-clusters`, `/seed-peers`, `/configs`, `/jobs` after GHSA-j8hf, etc.). Additionally, drop `ClientSecret` from any read response by marking it `json:"-"` on the model, so even a future router regression cannot leak it.The first hunk mirrors exactly the shape applied for `/clusters`, `/scheduler-clusters`, `/seed-peer-clusters`, `/seed-peers`, `/peers`, `/configs`, `/applications`, `/personal-access-tokens`, `/persistent-cache-tasks`, `/audits`, and (post-GHSA-j8hf-cp34-g4j7) `/jobs`. The second hunk adds a defense-in-depth pin so that if the OAuth registration handler is ever consumed by a future routing change, the secret stays out of the JSON contract.Fix PRhttps://github.com/dragonflyoss/dragonfly-ghsa-4q9j-6299-gxmr/pull/1 (temp private fork PR opened on the advisory's embargo-private fork).WorkaroundsThe OAuth sign-in feature is `not actually used in practice within the Dragonfly project itself`.CreditReported by tonghuaroot.
CVSS v4.0 score: 2.9