{"id":"CVE-2026-58422","aliases":["CVE-2026-58422","GHSA-g9g6-qhrc-p3qc","GO-2026-6056"],"related":[],"kind":"vulnerability","state":"published","title":"Improper authorization on OAuth sign-in callback silently re-enables administrator-disabled accounts","summary":"Improper authorization on OAuth sign-in callback silently re-enables administrator-disabled accounts","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Improper authorization on OAuth sign-in callback silently re-enables administrator-disabled accounts","source":"cvelist"},{"lang":"en","text":"### Summary\n\nThe OAuth2 sign-in callback in Gitea 1.26.1 unconditionally re-enables a locally-disabled account whenever the user authenticates through a linked external identity provider, silently undoing any administrator-initiated `Disable Account` action and issuing a fresh authenticated session in the same response. Once a user has linked any external IdP, the administrator's disable toggle becomes non-binding — the user can re-enable themselves on demand by completing one OAuth callback, regaining full read and write access to their repositories, organizations, and access tokens.\n\n### Details\n\nImproper Authorization is present on the `code` and `state` parameters of the `/user/oauth2/{source-name}/callback` endpoint in Gitea version 1.26.1. The handler `routers/web/auth/oauth.go::handleOAuth2SignIn` reads the local user's `IsActive` flag at lines 350-352 and, when it is `false`, sets `opts.IsActive = optional.Some(true)` before calling `user_service.UpdateUser` and immediately establishing a session. The active-state precondition that the request middleware `routers/web/web.go::verifyAuthWithOptions` enforces for every other request is therefore evaluated against the freshly-flipped row on the next request, so a site administrator's \"disable user\" action is silently undone the next time the user authenticates through any linked external identity provider.\n\nThe root cause is that the callback path treats the local `IsActive` flag as stale bookkeeping to reconcile against the external identity, rather than as an authoritative administrative override. The local-credential sign-in path correctly renders `IsErrUserInactive` in the same condition; only the OAuth callback path flips the flag and proceeds.\n\n### PoC\n\n1. As a site administrator, configure an OAuth2 authentication source via `Site Administration -> Authentication Sources -> Add Authentication Source`. Any external provider works (a self-hosted Keycloak, an upstream Gitea acting as OIDC, GitHub, GitLab, Microsoft, Google).\n2. Have a normal user (`alice` in the example) sign in through that source at least once. The callback creates the row in `external_login_user` linking alice's local account to the IdP identity.\n3. As the site administrator, disable alice's account: `Site Administration -> User Accounts -> alice -> \"Disable Account\"`. Confirm the flag is set with the admin API.\n\n#### HTTP REQUEST\n\n```http\nGET /api/v1/admin/users/alice HTTP/1.1\nHost: <HOST>\nAuthorization: token <ADMIN_TOKEN>\nAccept: application/json\n```\n\n#### HTTP RESPONSE\n\n```http\nHTTP/1.1 200 OK\nContent-Type: application/json;charset=utf-8\n\n{\"id\":2,\"login\":\"alice\",\"active\":false,...}\n```\n\n4. Have alice click \"Sign in with <source-name>\" on the Gitea login page and complete the OAuth dance with the IdP. The callback handler runs, observes `IsActive=false`, sets `opts.IsActive=true`, calls `UpdateUser`, and issues a session on the same response. Alice lands on `/`.\n5. Re-read the same admin API endpoint and observe that `active` has flipped back to `true` without administrator action.\n\n#### HTTP REQUEST\n\n```http\nGET /api/v1/admin/users/alice HTTP/1.1\nHost: <HOST>\nAuthorization: token <ADMIN_TOKEN>\nAccept: application/json\n```\n\n#### HTTP RESPONSE\n\n```http\nHTTP/1.1 200 OK\nContent-Type: application/json;charset=utf-8\n\n{\"id\":2,\"login\":\"alice\",\"active\":true,...}\n```\n\n### Impact\n\nOnce a user has linked any external identity provider, the site administrator's \"disable user\" toggle becomes non-binding on that account: the user can re-enable themselves on demand by completing one OAuth callback, regaining full read and write access to their repositories, organizations, and tokens. In SSO-fronted Gitea deployments where the disable toggle is the documented incident-response action for compromised accounts or departed employees, this defeats the only short-term remediation available before the identity provider can revoke the underlying federated identity.","format":"markdown","source":"ghsa"},{"lang":"en","text":"Gitea: Improper authorization on OAuth sign-in callback silently re-enables administrator-disabled accounts in code.gitea.io/gitea","format":"markdown","source":"go"},{"lang":"es","text":"Autorización indebida en el callback de inicio de sesión de OAuth rehabilita silenciosamente las cuentas deshabilitadas por el administrador","source":"nvd"}],"published":"2026-07-03T20:54:52.236Z","modified":"2026-10-25T15:10:00.147Z","severity":{"scorer":"CISA-ADP","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},"severities":[{"scorer":"CISA-ADP","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N","rating":"HIGH"}],"cwes":["CWE-284"],"affected":[{"ranges":[{"type":"semver","introduced":"0","lastAffected":"1.26.1","status":"affected"}],"vendor":"Gitea","product":"Gitea Open Source Git Server","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.26.4"}],"ecosystem":"Go","package":"code.gitea.io/gitea","purl":"pkg:golang/code.gitea.io/gitea","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.26.4"}],"ecosystem":"Go","package":"code.gitea.io/gitea","purl":"pkg:golang/code.gitea.io/gitea","source":"go"}],"references":[{"url":"https://github.com/go-gitea/gitea/security/advisories/GHSA-g9g6-qhrc-p3qc","tags":["advisory","exploit","vendor-advisory","web"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/go-gitea/gitea/pull/38009","tags":["patch","web"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/go-gitea/gitea/releases/tag/v1.26.4","tags":["release-notes","web"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://blog.gitea.com/release-of-1.26.3-and-1.26.4/","tags":["release-notes"],"sources":["cvelist","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-58422","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/go-gitea/gitea/commit/c43eb7c33a100ffc7b2367adf165f7085e0ccdc5","tags":["web"],"sources":["ghsa","go"]},{"url":"https://blog.gitea.com/release-of-1.26.3-and-1.26.4","tags":["web"],"sources":["ghsa","go"]},{"url":"https://github.com/go-gitea/gitea","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"Gitea","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2026-07-06T15:11:15.992Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-58422","url":"https://www.cve.org/CVERecord?id=CVE-2026-58422","licence":"CVE Terms of Use","modified":"2026-07-06T15:11:20.064Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-g9g6-qhrc-p3qc","url":"https://github.com/advisories/GHSA-g9g6-qhrc-p3qc","licence":"CC-BY-4.0","modified":"2026-07-22T21:11:29.389Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-6056","url":"https://pkg.go.dev/vuln/GO-2026-6056","licence":"CC-BY-4.0","modified":"2026-07-22T21:00:28.328Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-58422","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-58422","licence":"Public domain","modified":"2026-10-25T15:10:00.147Z"}],"updatedAt":"2026-11-25T22:59:27.130Z","epss":{"score":0.0043,"percentile":0.39152,"date":"2026-12-01T12:00:22.000Z"}}