Gitea
CVE-2026-55987
HIGH
Severity by source
AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
Attacker must control the deactivated user's provider login (PR:L), exploit is a low-complexity network login flow (AV:N/AC:L), reactivation alters authZ state and grants full account access (C:H/I:H), with no availability impact (A:N).
Primary rating from GitHub Advisory.
CVSS VectorGitHub Advisory
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
Lifecycle Timeline
3DescriptionGitHub Advisory
Description
Gitea's OAuth2 sign-in callback reactivates a deactivated user account (IsActive=false) when the user signs in through an authentication source that does not issue refresh tokens (notably GitHub, and any OIDC/OAuth2 source configured without offline_access). PR #38009 added a gate intended to reactivate users only when the OAuth2 auto-sync cron had disabled them, using "the stored refresh token is empty" as the signal. That signal is wrong: for sources that never issue refresh tokens, an empty refresh token is the normal state of every user, so the gate cannot distinguish a cron-disabled account from one an administrator deliberately deactivated. The next time the administrator-deactivated user signs in through the provider, Gitea sets IsActive=true and grants a full session, silently undoing the administrator's action. This is the exact behavior #38009 was written to prevent. (ProhibitLogin, the hard ban, is enforced separately and is not affected.)
No special privileges are required beyond being the deactivated user and being able to sign in through the source.
Root Cause
routers/web/auth/oauth.go (the handleOAuth2SignIn reactivation gate):
if !u.IsActive {
extLogin, hasExt, err := user_model.GetExternalLogin(ctx, authSource.ID, gothUser.UserID)
if err != nil { ctx.ServerError("GetExternalLogin", err); return }
isDisabledByAutoSync := hasExt && extLogin.RefreshToken == "" // wrong signal
if isDisabledByAutoSync {
opts.IsActive = optional.Some(true) // reactivates the account
}
}The assumption that RefreshToken == "" is produced only by the auto-sync cron is false:
- The cron's disable path is unreachable for sources without refresh tokens.
services/auth/source/oauth2/source_sync.goreturns early:if !provider.RefreshTokenAvailable() { return ... }, so it never disables (or touches the tokens of) such users. - The stored token is exactly what the provider returned, with no synthesizing:
services/externalaccount/user.gostoresRefreshToken: gothUser.RefreshToken. When the provider issues none, this is""from the first login. - GitHub never issues a refresh token:
gothhardcodesfunc (p *Provider) RefreshTokenAvailable() bool { return false }(providers/github/github.go). OIDC/OAuth2 withoutoffline_accesslikewise store"".
So for a GitHub (or no-refresh-token) source, RefreshToken == "" is the state of every user, including one an administrator deactivated, and the gate reactivates them.
Proof of Concept
Setup:
- A Gitea instance with a GitHub authentication source (Admin Panel -> Authentication Sources -> OAuth2 -> GitHub), or any OAuth2/OIDC source configured without
offline_access. - Account V: a normal user who has signed in at least once through that source (an
external_login_userrow exists with emptyrefresh_token).
Steps:
- As an administrator, open Admin Panel -> Users -> V and uncheck "Activated" (
is_active=false). Confirm V's requests now bounce to the activation page. - As V, sign in again via "Sign in with GitHub" and complete the provider flow.
- V lands in the application with a working session.
SELECT is_active FROM "user" WHERE lower_name='v';now returnstrue.
Expected (intended by #38009): V stays is_active=false and is routed to the activation page. Actual: V is is_active=true with a full session - the administrator's deactivation is undone.
- GitHub user, ADMIN deactivated refreshToken="" -> REACTIVATED + session granted <<< admin action undone
- OIDC user w/ refresh token, ADMIN deactivated refreshToken="..." -> stays disabled (control)
- OIDC user, AUTO-SYNC cron disabled refreshToken="" -> REACTIVATED (intended)
RESULT: BYPASS CONFIRMED.Gitea's own regression test TestOAuth2CallbackReactivationGating ("auto-sync-disabled user is reactivated") sets RefreshToken="" and asserts reactivation after a full OIDC callback - that state is identical to a GitHub-source user an administrator deactivated.
Impact
Any Gitea instance using a GitHub authentication source (one of the most common) or an OIDC/OAuth2 source without refresh tokens, that relies on the "Activated" toggle to disable accounts, is affected. A deactivated user restores their own account to active and obtains a session, regaining whatever access the account had. Deactivation does not clear IsAdmin, so a deactivated administrator regains admin access. Bound: accounts disabled with "Prohibit Login" stay blocked; this defeats the IsActive=false deactivation only.
AnalysisAI
Improper authorization in Gitea before 1.27.0 lets an administrator-deactivated user (IsActive=false) silently reactivate their own account by signing in through an OAuth2/OIDC source that issues no refresh token - notably GitHub, or any OIDC source without offline_access. The reactivation gate added in PR #38009 uses an empty stored refresh token as its signal for 'disabled by auto-sync cron,' but for these sources every user has an empty refresh token, so an administrator's deliberate deactivation is indistinguishable from a cron disable and gets undone on the next login, granting a full session (including regained admin rights, since deactivation does not clear IsAdmin). …
Unlock full vulnerability intelligence
- Risk assessment & exploitation conditions
- Attack chain visualization
- Remediation with exact patch versions
- Threat intelligence from 22 sources
- Personal watchlist & email alerts
Free forever · No credit card required
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata
Vulnerability AssessmentAI
| Exploitation | Exploitation requires all of: (1) the Gitea instance uses an OAuth2 authentication source that does not issue refresh tokens - a GitHub auth source, or an OIDC/OAuth2 source configured without offline_access; (2) the target account was previously linked and has signed in at least once, so an external_login_user row with an empty refresh_token already exists; (3) the account was disabled specifically via the 'Activated' toggle (is_active=false), not via 'Prohibit Login'; and (4) the attacker controls that account's credentials at the upstream provider and can complete the provider login. … Additional conditions and limiting factors are described in the full assessment. |
| Risk Assessment | The CVSS 3.1 vector CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N (base 8.1, High) is consistent with the described attack: network-reachable login flow, low complexity, and low privileges (the attacker must be the specific deactivated user with valid provider credentials, not an anonymous outsider). … Full risk analysis with EPSS, KEV, and SSVC signal comparison available after sign-in. |
| Exploit Scenario | An administrator offboards a user (or a rogue admin) by unchecking 'Activated,' trusting that the account can no longer log in. Following the published PoC, the deactivated user simply clicks 'Sign in with GitHub' and completes the normal provider flow; Gitea's callback sees the empty refresh token, flips is_active back to true, and issues a working session - restoring all prior access, including admin if the account had it. … |
| Remediation | Vendor-released patch: upgrade to Gitea 1.27.0 or later, which corrects the reactivation gate so an empty refresh token no longer counts as proof of a cron-initiated disable (advisory: https://github.com/go-gitea/gitea/security/advisories/GHSA-vrhc-jjfc-m3m3; release: https://github.com/go-gitea/gitea/releases/tag/v1.27.0). … Detailed patch versions, workarounds, and compensating controls in full report. |
Recommended ActionAI
Within 24 hours: audit Gitea access logs for logins from deactivated administrator accounts and configure real-time alerting for any login attempts from deactivated accounts. …
Sign in for detailed remediation steps and compensating controls.
Threat intelligence, references, and detailed analysis are available after sign-in.
Broken access control in Gitea's Composer package registry (versions up to and including 1.26.1) lets remote attackers r
Gitea before 1.16.7 does not escape git fetch remote. Rated high severity (CVSS 7.5), this vulnerability is remotely exp
The git hook feature in Gitea 1.1.0 through 1.12.5 might allow for authenticated remote code execution in customer envir
Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') vulnerability in Gitea Gitea
Container escape in Gitea act_runner (Docker backend, through act 0.262.0) lets an authenticated user with workflow-exec
models/repo_mirror.go in Gitea before 1.7.6 and 1.8.x before 1.8-RC3 mishandles mirror repo URL settings, leading to rem
An issue was discovered in Gitea through 1.11.5. Rated high severity (CVSS 7.5), this vulnerability is remotely exploita
Missing Authorization in GitHub repository go-gitea/gitea prior to 1.16.4. Rated high severity (CVSS 7.1), this vulnerab
Open Redirect on login in GitHub repository go-gitea/gitea prior to 1.16.5. Rated medium severity (CVSS 6.1), this vulne
Reverse-proxy authentication bypass in the official Gitea Docker image (versions up to and including 1.26.2) allows any
Branch-protection bypass in Gitea's self-hosted Git server (all versions before 1.26.0) allows a user with push access t
Migration transport protections in Gitea are bypassed for Git LFS operations, affecting all self-hosted instances before
Same weakness CWE-863 – Incorrect Authorization
View allSame technique Authentication Bypass
View allShare
External POC / Exploit Code
Leaving vuln.today
GHSA-vrhc-jjfc-m3m3