CVE-2026-55987

CVE-2026-55987 is a high-severity incorrect authorization vulnerability in code.gitea.io/gitea (go), affecting versions < 1.27.0. It is fixed in 1.27.0.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

Gitea: OAuth2 sign-in reactivates an administrator-deactivated account on auth sources without refresh tokens (incomplete fix of #38009)

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.go returns 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.go stores RefreshToken: gothUser.RefreshToken. When the provider issues none, this is "" from the first login.
  • GitHub never issues a refresh token: goth hardcodes func (p *Provider) RefreshTokenAvailable() bool { return false } (providers/github/github.go). OIDC/OAuth2 without offline_access likewise 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_user row exists with empty refresh_token).

Steps:

  1. As an administrator, open Admin Panel -> Users -> V and uncheck "Activated" (is_active=false). Confirm V's requests now bounce to the activation page.
  2. As V, sign in again via "Sign in with GitHub" and complete the provider flow.
  3. V lands in the application with a working session. SELECT is_active FROM "user" WHERE lower_name='v'; now returns true.

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.

The application does not correctly enforce access controls, allowing a principal to access resources or operations beyond their granted permissions. Typical impact: unauthorized data access or execution of privileged operations.

CVE-2026-55987 has a CVSS score of 8.1 (High). The vector is network-reachable, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (1.27.0); upgrading removes the vulnerable code path.

Affected versions

code.gitea.io/gitea (< 1.27.0)

Security releases

code.gitea.io/gitea → 1.27.0 (go)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Upgrade code.gitea.io/gitea to 1.27.0 or later to resolve this vulnerability.

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is CVE-2026-55987? CVE-2026-55987 is a high-severity incorrect authorization vulnerability in code.gitea.io/gitea (go), affecting versions < 1.27.0. It is fixed in 1.27.0. The application does not correctly enforce access controls, allowing a principal to access resources or operations beyond their granted permissions.
  2. How severe is CVE-2026-55987? CVE-2026-55987 has a CVSS score of 8.1 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of code.gitea.io/gitea are affected by CVE-2026-55987? code.gitea.io/gitea (go) versions < 1.27.0 is affected.
  4. Is there a fix for CVE-2026-55987? Yes. CVE-2026-55987 is fixed in 1.27.0. Upgrade to this version or later.
  5. Is CVE-2026-55987 exploitable, and should I be worried? Whether CVE-2026-55987 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2026-55987 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2026-55987? Upgrade code.gitea.io/gitea to 1.27.0 or later.

Other vulnerabilities in code.gitea.io/gitea

Stop the waste.
Protect your environment with Kodem.