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):
- Pull-request review
commit_idworkflow hijack steals Actions secrets and writeGITEA_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()passedreview.CommitIDas the workflow ref (WithRef(commitID)) without verifying thatreview.CommitIDbelonged 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/*.ymlfile (via a fork PR or AGit push) and submit a review naming thatcommit_idon 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 aGITEA_TOKENwith write access to the repository. - OAuth2
ACCOUNT_LINKING = autoaccount 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 (createUserInContextinrouters/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. gitea-actionsnegative-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’sGITEA_TOKENauthenticates to the REST API as the sharedgitea-actionssystem user (ID = -2). Because database query builders (FindOrgOptions,FindPublicKeyOptions,FindGPGKeyOptions,SearchOptions) checkedif opts.OwnerID > 0before adding anowner_idWHEREclause, negative user IDs were treated as “no owner restriction”, allowing any workflow job to callGET /api/v1/user/reposand list the metadata of every private repository on the entire Gitea instance. Furthermore,/api/v1/user/emailsand/api/v1/user/gpg_keysallowed theID = -2system 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.- Stored XSS via Actions v1 to v3 artifact
Content-Encoding(CVE-2026-113429/GHSA-9v6p-xpcp-7488, CVSS 8.7 High) and 11public-onlytoken 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 rawContent-Encodingrequest header into the database column later served as the artifact’sContent-Typeheader on download, enabling stored XSS on the Gitea origin. Separately, 11 route groups failed to enforce thepublic-onlyrestriction on personal access tokens, allowing apublic-onlytoken to call/api/v1/adminto create persistent site administrators (CVE-2026-117635), callDELETE /api/v1/orgs/{org}/reposto 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
| Ecosystem | Project / Package | CVE / GHSA | Severity | Affected versions | Fixed version | Vulnerable component |
|---|---|---|---|---|---|---|
| Go / Binary / Docker | Gitea (code.gitea.io/gitea / gitea.dev) | CVE-2026-118386 (GHSA-32h8-5xqg-h466) | CVSS 8.1 High | < 28.3.0 | 28.3.0 (PR #40099) | actionsNotifier.PullRequestReview() in services/actions/notifier.go |
| Go / Binary / Docker | Gitea | CVE-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 / Docker | Gitea | CVE-2026-113429 (GHSA-9v6p-xpcp-7488) | CVSS 8.7 High | < 28.3.0 | 28.3.0 (PR #39855) | Legacy v1 to v3 Actions artifact Content-Encoding header storage |
| Go / Binary / Docker | Gitea | CVE-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.0 | 28.3.0 (PR #39945) | Negative-ID gitea-actions system user (opts.OwnerID > 0) and /api/v1/user / /{username} routes |
| Go / Binary / Docker | Gitea | CVE-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, 119627 | CVSS 8.1 High / 7.1 High / Medium | < 28.3.0 | 28.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 / Docker | Gitea | CVE-2026-116296 (GHSA-6h2f-c8jm-84hc), CVE-2026-117649, CVE-2026-117677 (GHSA-r6mh-qg79-rqj2), CVE-2026-118504, CVE-2026-119533 | CVSS 8.1 High / Medium | < 28.3.0 | 28.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:
- An attacker with read access to a repository pushes a commit containing a malicious
.gitea/workflows/pwn.yml(triggeredon: pull_request_review) into the repository’s object store, either by opening a fork pull request or via an AGit push (refs/for/...). - 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_idset to the SHA of the attacker’s commit. - Because the reviewed pull request is not from a fork, Gitea skips fork workflow approval, reads
.gitea/workflows/from the attacker’scommit_id, injects the repository’s and organization’s Actions secrets, and issues aGITEA_TOKENwith 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
SearchRepositoryConditionand the organization/project/key filters treatedOwnerID <= 0as “no owner filter” (opts.OwnerID > 0) andSearchRepositoryConditionskippedAccessibleRepositoryConditionwhenopts.Actor.ID == opts.OwnerID, callingGET /api/v1/user/reposwith a job’sGITEA_TOKENreturned every repository on the instance, including private repositories owned by other users and organizations (CVE-2026-112887). - Because
/api/v1/user/emailsand/api/v1/user/gpg_keysacceptedctx.DoerwithID = -2, any workflow job could attach an attacker’s email address and GPG public key togitea-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(commit5264304a34) attaches the token’s scope directly ontoctx.Doersopublic-onlyPATs 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
- Upgrade Gitea to
>= 28.3.0: Pull thegitea/gitea:28.3.0container image or binary release and restart the service. - Audit
pull_request_reviewActions runs and rotate secrets: Queryaction_runfor runs wheretrigger_eventispull_request_review,pull_request_review_approved, orpull_request_review_commentand verify thatcommit_shabelongs to the target pull request. If an untrusted review triggered a workflow run prior to28.3.0, rotate the repository and organization Actions secrets. - Purge rogue
gitea-actionsGPG keys and audit OAuth2 links: Delete any rows ingpg_key(owner_id < 0) oremail_address(uid < 0) created by workflow tokens (CVE-2026-116474). IfACCOUNT_LINKING = autowas enabled inapp.ini, audit theexternal_login_usertable for unexpected external identities linked to administrator or privileged accounts.
Timeline
- 2026-10-19 to 2026-10-31: Gitea maintainers merge PR
#39690(public-onlytoken enforcement), PR#39855(v1 to v3 artifactContent-EncodingXSS fix), PR#39942(archived repo and Helm chart quota checks), PR#39945(negative-ID system user hardening), PR#40099(pull_request_reviewhead SHA enforcement), and PR#40121(OAuth2oauth2IdentityMatchesUsercheck), with backports torelease/v28.3. - 2026-11-01 (
09:42to10:18 UTC): Gitea releasesv28.3.0and publishes 20 GitHub Security Advisories and NVD CVE records (CVE-2026-112887throughCVE-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
- Gitea 28.3.0 Release Notes and GitHub Tag v28.3.0
- go-gitea/gitea Advisory GHSA-32h8-5xqg-h466 and PR #40099 (CVE-2026-118386: Actions fork workflow gets secrets and write token via review commit_id)
- go-gitea/gitea Advisory GHSA-8p3x-w464-4g6v and PR #40121 (CVE-2026-120263: Account takeover via OAuth2 auto-linking with form username)
- go-gitea/gitea Advisories GHSA-8r36-6j2c-3gmv (CVE-2026-112887), GHSA-mf6p-vqpw-3r7x (CVE-2026-116474), and PR #39945 (system user and token scope hardening)
- go-gitea/gitea Advisories GHSA-37xv-m4w7-j2fh (CVE-2026-117635), GHSA-jh8p-x4ch-389q (CVE-2026-119441), GHSA-8g99-g36h-5p2w (CVE-2026-117685), and PR #39690
- go-gitea/gitea Advisory GHSA-9v6p-xpcp-7488 and PR #39855 (CVE-2026-113429: Stored XSS via v1-v3 Actions artifact Content-Encoding header)