high

CVE

CVE-2026-118386, CVE-2026-120263, CVE-2026-113429, CVE-2026-112887, CVE-2026-116474, CVE-2026-117635, CVE-2026-119441, CVE-2026-117685, CVE-2026-116289, CVE-2026-116296, CVE-2026-114199, CVE-2026-117646, CVE-2026-117649, CVE-2026-117677, CVE-2026-118394, CVE-2026-118395, CVE-2026-118504, CVE-2026-119533, CVE-2026-119625, CVE-2026-119627

CWE

CWE-863, CWE-287, CWE-269, CWE-79, CWE-409

Affected Surface

  • Go / self-hosted `code.gitea.io/gitea` (`gitea.dev`) versions `< 28.3.0` (`CVE-2026-118386`, `CVE-2026-120263`, `CVE-2026-113429`, `CVE-2026-112887`, `CVE-2026-116474`, `CVE-2026-117635`, `CVE-2026-119441`, `CVE-2026-117685`, `CVE-2026-116289`, `CVE-2026-116296`, and 10 additional advisories)
  • Self-hosted Gitea instances running Gitea Actions runners, OCI container package registries, or OAuth2 authentication with `ACCOUNT_LINKING = auto`

TL;DR

On 1 November 2026 (09:42 to 10:18 UTC), the Gitea project released Gitea 28.3.0 and disclosed 20 CVEs spanning Gitea Actions CI/CD workflows, OAuth2 account linking, negative-ID system accounts, OCI container registries, and public-only personal access tokens (PATs):

  1. Pull-request review commit_id workflow hijack steals Actions secrets and write GITEA_TOKEN (CVE-2026-118386 / GHSA-32h8-5xqg-h466, CVSS 8.1 High): When a pull request review triggered a workflow (pull_request_review, pull_request_review_comment), actionsNotifier.PullRequestReview() passed review.CommitID as the workflow ref (WithRef(commitID)) without verifying that review.CommitID belonged to the reviewed pull request, while deciding fork approval rules from the reviewed pull request’s head branch. Any user with read access to a repository can upload a commit containing a malicious .gitea/workflows/*.yml file (via a fork PR or AGit push) and submit a review naming that commit_id on an existing non-fork pull request in the target repository. The attacker’s workflow runs immediately without maintainer approval, receives the repository’s and owner’s Actions secrets, and gets a GITEA_TOKEN with write access to the repository.
  2. OAuth2 ACCOUNT_LINKING = auto account and administrator takeover (CVE-2026-120263 / GHSA-8p3x-w464-4g6v, High): On instances configured with [oauth2_client].ACCOUNT_LINKING = auto (non-default) and open registration, the link-account sign-up form (createUserInContext in routers/web/auth/auth.go) looked up the existing Gitea account to link using the username or email submitted in the HTML form rather than the identity returned by the OAuth2 provider (gothUser). An attacker authenticating through any configured OAuth2 provider could type an administrator’s username into the sign-up form and immediately link their external identity to the administrator account without a password.
  3. gitea-actions negative-ID system user enumerates all private repositories (CVE-2026-112887 / GHSA-8r36-6j2c-3gmv, CVSS 6.5) and spoofs instance-signed commits (CVE-2026-116474 / GHSA-mf6p-vqpw-3r7x): Every Gitea Actions job’s GITEA_TOKEN authenticates to the REST API as the shared gitea-actions system user (ID = -2). Because database query builders (FindOrgOptions, FindPublicKeyOptions, FindGPGKeyOptions, SearchOptions) checked if opts.OwnerID > 0 before adding an owner_id WHERE clause, negative user IDs were treated as “no owner restriction”, allowing any workflow job to call GET /api/v1/user/repos and list the metadata of every private repository on the entire Gitea instance. Furthermore, /api/v1/user/emails and /api/v1/user/gpg_keys allowed the ID = -2 system user to register an email and GPG key; because commit verification treats keys owned by a non-real user as the instance signing key, any workflow runner could make its commits display as trusted and signed by the Gitea instance across all repositories.
  4. Stored XSS via Actions v1 to v3 artifact Content-Encoding (CVE-2026-113429 / GHSA-9v6p-xpcp-7488, CVSS 8.7 High) and 11 public-only token scope bypasses (CVE-2026-117635, CVE-2026-119441, CVE-2026-117685, CVE-2026-116289): Legacy v1 to v3 Actions artifact uploads stored the client’s raw Content-Encoding request header into the database column later served as the artifact’s Content-Type header on download, enabling stored XSS on the Gitea origin. Separately, 11 route groups failed to enforce the public-only restriction on personal access tokens, allowing a public-only token to call /api/v1/admin to create persistent site administrators (CVE-2026-117635), call DELETE /api/v1/orgs/{org}/repos to wipe all private repositories in a public organization (CVE-2026-119441), mount private OCI container layers into public packages (CVE-2026-117685), and fetch organization Actions runner registration tokens (CVE-2026-116289).

What to do now: Upgrade Gitea to 28.3.0 immediately. Audit Gitea Actions workflow runs triggered by pull_request_review events, check whether any GPG keys or email addresses were registered on the gitea-actions (owner_id = -2) system user in the gpg_key and email_address database tables, and review OAuth2 account links if ACCOUNT_LINKING = auto was enabled.

Affected packages and projects

EcosystemProject / PackageCVE / GHSASeverityAffected versionsFixed versionVulnerable component
Go / Binary / DockerGitea (code.gitea.io/gitea / gitea.dev)CVE-2026-118386 (GHSA-32h8-5xqg-h466)CVSS 8.1 High< 28.3.028.3.0 (PR #40099)actionsNotifier.PullRequestReview() in services/actions/notifier.go
Go / Binary / DockerGiteaCVE-2026-120263 (GHSA-8p3x-w464-4g6v)High< 28.3.0 (when ACCOUNT_LINKING = auto)28.3.0 (PR #40121)createUserInContext() in routers/web/auth/auth.go
Go / Binary / DockerGiteaCVE-2026-113429 (GHSA-9v6p-xpcp-7488)CVSS 8.7 High< 28.3.028.3.0 (PR #39855)Legacy v1 to v3 Actions artifact Content-Encoding header storage
Go / Binary / DockerGiteaCVE-2026-112887 (GHSA-8r36-6j2c-3gmv), CVE-2026-116474 (GHSA-mf6p-vqpw-3r7x), CVE-2026-119625 (GHSA-3fv3-hhmm-4x2q)CVSS 6.5 Medium / Medium< 28.3.028.3.0 (PR #39945)Negative-ID gitea-actions system user (opts.OwnerID > 0) and /api/v1/user / /{username} routes
Go / Binary / DockerGiteaCVE-2026-117635 (GHSA-37xv-m4w7-j2fh), CVE-2026-119441 (GHSA-jh8p-x4ch-389q), CVE-2026-117685 (GHSA-8g99-g36h-5p2w), CVE-2026-116289 (GHSA-qcgm-ggp8-22qc), plus 114199, 117646, 118394, 118395, 119627CVSS 8.1 High / 7.1 High / Medium< 28.3.028.3.0 (PR #39690)public-only access token checks across /api/v1/admin, DELETE /api/v1/orgs/{org}/repos, OCI blob mount, runner tokens, and OIDC/feeds
Go / Binary / DockerGiteaCVE-2026-116296 (GHSA-6h2f-c8jm-84hc), CVE-2026-117649, CVE-2026-117677 (GHSA-r6mh-qg79-rqj2), CVE-2026-118504, CVE-2026-119533CVSS 8.1 High / Medium< 28.3.028.3.0 (PR #39942, PR #40016)Archived repo mutation checks, Helm Chart.yaml tar decompression bomb, and project board PR leaks

Technical analysis

1. How a pull-request review commit_id hijacks Gitea Actions secrets (CVE-2026-118386)

In Gitea prior to 28.3.0, submitting a pull request review (POST /api/v1/repos/{owner}/{repo}/pulls/{index}/reviews or via the web UI) accepts a commit_id field identifying the commit being reviewed. When actionsNotifier.PullRequestReview() in services/actions/notifier.go dispatched workflow runs for pull_request_review events, it called newPullRequestReviewNotifyInput(), which set the workflow execution ref (WithRef(commitID)) to the reviewer-supplied review.CommitID while attaching the reviewed pull request (WithPullRequest(pr)):

--- a/services/actions/notifier.go
+++ b/services/actions/notifier.go
@@ -450,7 +450,8 @@ func (n *actionsNotifier) PullRequestReview(ctx context.Context, pr *issues_mode
 		return
 	}
 
-	newPullRequestReviewNotifyInput(review.Issue.Repo, review.Reviewer, reviewHookType, review.CommitID, pr).
+	newNotifyInput(review.Issue.Repo, review.Reviewer, reviewHookType).
+		WithPullRequest(pr).
 		WithPayload(&api.PullRequestPayload{
 			Action:      api.HookIssueReviewed,
 			Index:       review.Issue.Index,
--- a/services/actions/notifier_helper.go
+++ b/services/actions/notifier_helper.go
@@ -86,12 +86,6 @@ func newNotifyInputForSchedules(repo *repo_model.Repository) *notifyInput {
 	return newNotifyInput(repo, user_model.NewActionsUser(), webhook_module.HookEventSchedule)
 }
 
-func newPullRequestReviewNotifyInput(repo *repo_model.Repository, reviewer *user_model.User, event webhook_module.HookEventType, commitID string, pr *issues_model.PullRequest) *notifyInput {
-	return newNotifyInput(repo, reviewer, event).
-		WithRef(commitID).
-		WithPullRequest(pr)
-}

Because Gitea did not verify that review.CommitID was actually part of pr, this created a two-part split between which workflow code ran and which pull request governed fork security:

  1. An attacker with read access to a repository pushes a commit containing a malicious .gitea/workflows/pwn.yml (triggered on: pull_request_review) into the repository’s object store, either by opening a fork pull request or via an AGit push (refs/for/...).
  2. Instead of waiting for a maintainer to approve their fork pull request, the attacker finds any open pull request on the repository whose head branch lives in the base repository (not a fork) and submits a review on that pull request with commit_id set to the SHA of the attacker’s commit.
  3. Because the reviewed pull request is not from a fork, Gitea skips fork workflow approval, reads .gitea/workflows/ from the attacker’s commit_id, injects the repository’s and organization’s Actions secrets, and issues a GITEA_TOKEN with write permissions to the repository.

PR #40099 (commit b89fcf7496) removes newPullRequestReviewNotifyInput() so review-triggered workflows always execute on the pull request’s head commit.

2. OAuth2 ACCOUNT_LINKING = auto account takeover (CVE-2026-120263)

When a Gitea administrator sets [oauth2_client].ACCOUNT_LINKING = auto and enables user registration, a user signing in with an OAuth2 provider for the first time can be presented with the account-linking sign-up form. In routers/web/auth/auth.go, createUserInContext() looked up whether an account already existed (user) using the username and email fields submitted in the HTML form, and if ACCOUNT_LINKING was auto, immediately linked the OAuth2 identity (possibleLinkAccountData.GothUser) to user and logged the caller in without checking whether GothUser actually owned that username or email:

--- a/routers/web/auth/auth.go
+++ b/routers/web/auth/auth.go
@@ -449,6 +449,14 @@ func extractUserNameFromOAuth2(gothUser *goth.User) (string, error) {
 	}
 }
 
+func oauth2IdentityMatchesUser(gothUser *goth.User, u *user_model.User) bool {
+	if gothUser.Email != "" && strings.EqualFold(gothUser.Email, u.Email) {
+		return true
+	}
+	uname, err := extractUserNameFromOAuth2(gothUser)
+	return err == nil && uname != "" && strings.EqualFold(uname, u.Name)
+}
+
@@ -649,6 +657,9 @@ func createUserInContext(ctx *context.Context, tpl templates.TplName, form any,
 						return false
 					}
 				}
+				if !oauth2IdentityMatchesUser(&possibleLinkAccountData.GothUser, user) {
+					break // name or email came from the sign-up form, report the conflict instead of linking
+				}
 				// TODO: probably we should respect 'remember' user's choice...
 				oauth2LinkAccount(ctx, user, possibleLinkAccountData, true)

PR #40121 (commit 4ed6f89b60) adds oauth2IdentityMatchesUser() so auto-linking only succeeds when the target Gitea user matches the email or username asserted by the OAuth2 provider itself.

3. Negative-ID gitea-actions system user bugs (CVE-2026-112887, CVE-2026-116474) and public-only PAT bypasses (CVE-2026-117635, CVE-2026-119441, CVE-2026-117685)

In Gitea, internal system accounts use negative database IDs (gitea-actions has ID = -2). When a workflow job authenticates to the REST API with its GITEA_TOKEN, ctx.Doer is that shared ID = -2 user. Two bugs in PR #39945 (commit 6782d0a37d) turned ID = -2 into an instance-wide primitive:

--- a/models/asymkey/gpg_key.go
+++ b/models/asymkey/gpg_key.go
@@ -85,7 +85,7 @@ func (opts FindGPGKeyOptions) ToConds() builder.Cond {
-	if opts.OwnerID > 0 {
+	if opts.OwnerID != 0 {
 		cond = cond.And(builder.Eq{"owner_id": opts.OwnerID})
 	}
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -256,12 +256,18 @@ func rejectPublicOnly() func(ctx *context.APIContext) {
-func contextAuthenticatedUser() func(ctx *context.APIContext) {
+func authenticatedUserAsContextUser(allowSystemUser bool) func(ctx *context.APIContext) {
 	return func(ctx *context.APIContext) {
 		if !user_model.DoerTokenAllowsOwner(ctx.Doer, ctx.Doer) {
 			ctx.APIError(http.StatusForbidden, "this endpoint is not available for public-only tokens")
 			return
 		}
+		isIndividualOrBot := ctx.Doer.IsIndividual() || ctx.Doer.IsTypeBot()
+		isSystem := ctx.Doer.ID < 0
+		if !isIndividualOrBot || isSystem && !allowSystemUser {
+			ctx.APIError(http.StatusForbidden, "this endpoint is only available for individual user or bot accounts")
+			return
+		}
 		ctx.ContextUser = ctx.Doer
 	}
 }
  • Because SearchRepositoryCondition and the organization/project/key filters treated OwnerID <= 0 as “no owner filter” (opts.OwnerID > 0) and SearchRepositoryCondition skipped AccessibleRepositoryCondition when opts.Actor.ID == opts.OwnerID, calling GET /api/v1/user/repos with a job’s GITEA_TOKEN returned every repository on the instance, including private repositories owned by other users and organizations (CVE-2026-112887).
  • Because /api/v1/user/emails and /api/v1/user/gpg_keys accepted ctx.Doer with ID = -2, any workflow job could attach an attacker’s email address and GPG public key to gitea-actions. When Gitea verifies commit signatures, any GPG key whose owner is not a real user is displayed as the instance signing key, letting the attacker forge “signed by instance” badges on commits across any repository (CVE-2026-116474).
  • Separately, PR #39690 (commit 5264304a34) attaches the token’s scope directly onto ctx.Doer so public-only PATs can no longer reach /api/v1/admin (CVE-2026-117635), DELETE /api/v1/orgs/{org}/repos (CVE-2026-119441), cross-repository OCI blob mounts from private packages (CVE-2026-117685), or organization runner registration tokens (CVE-2026-116289).

Detection and remediation

# 1. Check running Gitea version
gitea --version 2>/dev/null || docker ps --format '{{.Image}}' | grep -i gitea || true

# 2. Audit the Gitea database for GPG keys or email addresses registered to system users (owner_id < 0 / uid < 0)
sqlite3 /var/lib/gitea/data/gitea.db \
  "SELECT id, owner_id, key_id, created_unix FROM gpg_key WHERE owner_id < 0; SELECT id, uid, email, is_activated FROM email_address WHERE uid < 0;" 2>/dev/null || true

# 3. Check app.ini for OAuth2 auto-linking
rg -n 'ACCOUNT_LINKING\s*=\s*auto' /etc/gitea/app.ini /var/lib/gitea/custom/conf/app.ini 2>/dev/null || true
  1. Upgrade Gitea to >= 28.3.0: Pull the gitea/gitea:28.3.0 container image or binary release and restart the service.
  2. Audit pull_request_review Actions runs and rotate secrets: Query action_run for runs where trigger_event is pull_request_review, pull_request_review_approved, or pull_request_review_comment and verify that commit_sha belongs to the target pull request. If an untrusted review triggered a workflow run prior to 28.3.0, rotate the repository and organization Actions secrets.
  3. Purge rogue gitea-actions GPG keys and audit OAuth2 links: Delete any rows in gpg_key (owner_id < 0) or email_address (uid < 0) created by workflow tokens (CVE-2026-116474). If ACCOUNT_LINKING = auto was enabled in app.ini, audit the external_login_user table for unexpected external identities linked to administrator or privileged accounts.

Timeline

  • 2026-10-19 to 2026-10-31: Gitea maintainers merge PR #39690 (public-only token enforcement), PR #39855 (v1 to v3 artifact Content-Encoding XSS fix), PR #39942 (archived repo and Helm chart quota checks), PR #39945 (negative-ID system user hardening), PR #40099 (pull_request_review head SHA enforcement), and PR #40121 (OAuth2 oauth2IdentityMatchesUser check), with backports to release/v28.3.
  • 2026-11-01 (09:42 to 10:18 UTC): Gitea releases v28.3.0 and publishes 20 GitHub Security Advisories and NVD CVE records (CVE-2026-112887 through CVE-2026-120263).

From research to remediation

Check whether this pattern exists in your codebase

Turn this research into a remediation workflow. Scan dependencies and package manifests for similar supply-chain risk, then prioritize fixes with reachability context.

References