GITEA.DEV · CVE-2026-123009 · Package
FIX → 28.4.0
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.
first public Nov 15, 2026 · 2 sources
Check it with your coding agent
It reads this page and tells you if your code or app is affected.
Self-hosted Gitea instances on affected versions where users can fork repositories, especially where private repositories have forks created while they were public. Instances that disable forking or do not have private repositories with public forks are less exposed. The sources do not say whether managed Gitea hosting has already been patched.
Not affected if forking-disabled, managed-hosting, no-private-repos
Who cares git, gitea, self-hosted
gitea --version or the server admin page; affected versions are >= 1.25 up to 28.3.0.Upgrade to 28.4.0
go:gitea.dev: upgrade to 28.4.0.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.
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:
// 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))
}
!issues.CanMaintainerWriteToBranch(ctx, ctx.Repo.Permission, targetBranchName, ctx.Doer) {
ctx.NotFound()
}
Are you affected?
Ask from here. InfraStack checks the affected versions against your stack and answers in your inbox.
InfraStack checks the affected versions against your stack and answers in Slack, with the evidence and the fix.
InfraStack checks it against your stack and answers on your report, with the evidence and the fix.
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:
// 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),
})
}
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.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.
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.
NVD data is provided by NIST and is public domain. Posts quoted belong to their authors.