---
id: "CVE-2026-123009"
page: "https://infrastack.ai/live/CVE-2026-123009"
kind: "vulnerability"
aliases: ["CVE-2026-123009", "GHSA-9vh6-6hgj-j5m5"]
title: "Privilege bypass in repo file-editor allows reading private base-repo branches"
severity: "high"
cvss: 7.7
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "gitea.dev", "fixed": ["28.4.0"], "affected": ">= 1.25, <= 28.3.0", "ecosystem": "go"}]
ecosystems: ["go"]
tags: ["cwe-284", "cwe-863", "git", "gitea", "package", "self-hosted"]
not_affected_if: ["forking-disabled", "managed-hosting", "no-private-repos"]
published_at: "2026-11-15T21:03:10+00:00"
first_seen_at: "2026-11-15T21:12:47+00:00"
updated_at: "2026-11-15T21:14:05+00:00"
sources: [{"source": "ghsa-repo", "url": "https://github.com/go-gitea/gitea/security/advisories/GHSA-9vh6-6hgj-j5m5", "first_seen_at": "2026-11-15T21:12:47+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-123009", "first_seen_at": "2026-11-15T22:40:23+00:00"}]
exploit_sources: []
---

# Privilege bypass in repo file-editor allows reading private base-repo branches

Link for people: https://infrastack.ai/live/CVE-2026-123009 (this .md is for agents)

Gitea's web file editor accepts an unchecked from_base_branch parameter that copies a branch from the base repository into the user's fork. An authenticated fork owner can therefore read the current contents of any branch of a base repository after it has been made private.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- go:gitea.dev affected >= 1.25, <= 28.3.0 fixed 28.4.0

## How to check

- Check the Gitea version with `gitea --version` or the server admin page; affected versions are `>= 1.25` up to `28.3.0`.
- Look for forks whose base repository was made private after the fork was created.

## Fix

- `go:gitea.dev`: upgrade to `28.4.0`.

## Timeline

- 2026-11-15T21:12:47+00:00 ghsa-repo https://github.com/go-gitea/gitea/security/advisories/GHSA-9vh6-6hgj-j5m5
- 2026-11-15T22:40:23+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-123009

## Documents

- [advisory] Maintainer's advisory: github.com https://github.com/go-gitea/gitea/security/advisories/GHSA-9vh6-6hgj-j5m5
- [fix] Release notes: github.com https://github.com/go-gitea/gitea/releases/tag/v28.4.0

## From the sources

### Summary
Gitea's web file-editor has a *submit-to-fork* flow: when you edit a file in a repository you can read but cannot write to, Gitea redirects you into your own fork's editor carrying `?from_base_branch=<branch>`, so the branch you were viewing is copied from the base repo into your fork and you can open a pull request from it (`services/context/repo.go:241-244`).

That parameter is never authorized against the base repository. Any authenticated user who owns a fork can therefore submit it directly and read the contents of the fork's **now-private base repository**, long after the owner revoked their access, by naming any branch of it.

### Details
`routers/web/repo/editor.go:136` reads the parameter with no binding and no validator. A non-empty value forces the new-branch path, which skips the protected-branch guard, leaving only a check against the attacker's **own fork**:

```go
// routers/web/repo/editor.go:136-145
fromBaseBranch := ctx.FormString("from_base_branch")
commitToNewBranch := commonForm.CommitChoice == editorCommitChoiceNewBranch || fromBaseBranch != ""
targetBranchName := util.Iif(commitToNewBranch, commonForm.NewBranchName, ctx.Repo.BranchName)
if targetBranchName == ctx.Repo.BranchName && !commitFormOptions.CanCommitToBranch {
	ctx.JSONError(ctx.Tr("repo.editor.cannot_commit_to_protected_branch", targetBranchName))
	return nil
}

if !issues.CanMaintainerWriteToBranch(ctx, ctx.Repo.Permission, targetBranchName, ctx.Doer) {
	ctx.NotFound(nil)
	return nil
}
```

Note the asymmetry with the field beside it: `new_branch_name` carries `binding:"GitRefName;MaxSize(100)"` in `services/forms/repo_form_editor.go:17`, while `from_base_branch` is not a form-struct field at all, so it never enters binding. And `CanMaintainerWriteToBranch` resolves against the fork the request targets (`models/issues/pull_list.go:82-84`, `headPerm.CanWrite(unit.TypeCode)`), which the attacker owns — so it short-circuits true.

The value then drives a base→fork git push, with no read check on the base repo anywhere on the path:

```go
// routers/web/repo/editor_util.go:129-134
func editorPushBranchToForkedRepository(ctx context.Context, doer *user_model.User, baseRepo *repo_model.Repository, baseBranchName string, targetRepo *repo_model.Repository, targetBranchName string) error {
	return git.PushManaged(ctx, baseRepo, targetRepo, git.PushOptions{
		Branch: baseBranchName + ":" + targetBranchName,
		Env:    repo_module.PushingEnvironment(doer, targetRepo),
	})
}
```

- The other caller of this same primitive, `MergeUpstream` (`services/repository/merge_upstream.go:31-38`), does gate on `GetDoerRepoPermission(ctx, repo.BaseRepo, doer).CanRead(unit.TypeCode)` before pushing. `editorPushBranchToForkedRepository` has no equivalent.
- `git.PushManaged` (`modules/git/push.go:18-21`) just pushes; it has no notion of authorization, so every caller must check first.
- `Repository.GetBaseRepo` (`models/repo/repo.go:537`) is a pure ID lookup, and making a repo private cascades to forks without ever detaching them, so the fork keeps a permission-free handle on the parent forever.
- Reachable at `POST /<owner>/<fork-repo>/_new/<branch>/` (the fork's own new-file editor route) with no privilege beyond owning the fork — the attacker never touches a route on the base repo.

Note: a request rejected later with `HTTP 400` (e.g. a stale `last_commit` value) still creates and populates the branch first, because the base→fork push in `prepareEditorCommitSubmittedForm` runs before the stale-commit check in `ChangeRepoFiles`. In testing, only real branch names for `from_base_branch` worked (a tag, a raw commit SHA, and `refs/pull/N/head` were all rejected) — but no branch-only validation exists in source, so the true scope may be broader.

### Impact
Any authenticated user who owns a fork of a repository can exfiltrate the **current contents of any branch** of that repository's base repo after the owner makes it private, bypassing repository privacy entirely — including repos the attacker was never a collaborator on beyond having forked them while public. Recommended fix: add the same `GetDoerRepoPermission(baseRepo, doer).CanRead(unit.TypeCode)` check used in `MergeUpstream` to `editorPushBranchToForkedRepository` before calling `git.PushManaged`, ideally centralized so every `PushManaged` caller enforces it, and bind/validate `from_base_branch` the same way `NewBranchName` is validated.

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
