GITEA.DEV · CVE-2026-123638 · Package
FIX → 28.4.0
Gitea's protected file pattern check reads changed file names without unquoting git's C-quoted output, so names containing quotes, backslashes or control bytes never match a protected pattern. A collaborator with write access can modify or delete protected files, and push a workflow file under .gitea/** that then runs on self-hosted runners.
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 version 28.3.0 or earlier that use branch protection with 'Protected file patterns', especially where workflow paths such as .gitea/** are protected. Instances without protected file patterns configured, or that run no self-hosted Actions runners, have less exposure. Write-access collaborators are the actors who can exploit it.
Not affected if managed-hosting, no-protected-file-patterns, unprotected-file-patterns-only
Who cares branch-protection, gitea, gitea-actions, self-hosted
gitea --version; versions 28.3.0 and earlier are affected..gitea/** or other workflow paths are listed.Upgrade to 28.4.0
GetAffectedFiles (modules/git/diff.go, v28.1.0 lines 303–341) is the only file-name source for the
branch-protection Protected file patterns feature. It runs
cmd := gitcmd.NewCommand("diff", "--name-only").AddDynamicArguments(oldCommitID, newCommitID)
...
path := strings.TrimSpace(scanner.Text()) // consumed raw — no -z, no C-quote unquoting
affectedFiles = append(affectedFiles, path)
git diff --name-only C-quotes any path containing ", \, or a control byte, emitting e.g.
"protected/weird\"name.md" instead of protected/weird"name.md. Such a line can never match a
pattern like protected/** compiled via glob.Compile(expr, '.', '/')
(models/git/protected_branch.go:267), so the protection gate fails .
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.
28.4.0.Both enforcement paths consume this function:
routers/private/hook_pre_receive.go:206-208 →
pull_service.CheckFileProtection (services/pull/patch.go:368-381):
affectedFiles, err := git.GetAffectedFiles(...)
for _, affectedFile := range affectedFiles {
lpath := strings.ToLower(affectedFile)
for _, pat := range patterns {
if pat.Match(lpath) { ... } // quoted name → no match → not protected
services/pull/patch.go:439 stores pr.ChangedProtectedFiles →
services/pull/merge.go:718 pb.MergeBlockedByProtectedFiles(...) blocks the merge. Same name
source, same blind spot.Meanwhile the web UI / PR file list goes through parsers that DO unquote (and #39781, merged 2026-10-15, frames missing unquoting as a bug): the PR view shows the file with its real name and flags it protected, while both enforcement gates let it through — a clean "UI says protected / enforcement disagrees" divergence.
A write-access collaborator — precisely the actor this feature exists to constrain — can:
", \, or a control byte.protected/important.yaml to
protected/gone"x.yaml (rename detection reports the quoted names; the old, protected-looking
name disappears from the affected-file list) and then rewrite/delete its content — verified live..gitea/**;.github/** — the documented pattern for this exact purpose, cf. go-gitea/gitea#33370):
a workflow file pushed as .gitea/workflows/pwn"name.yml bypasses the gate, is still detected by
the Actions workflow scanner, and a run is created and executed by the runner
(full 5-hop observed chain in Appendix C; job log line: PWNED-BY-QUOTED-NAME).Not affected: Unprotected file patterns (the whitelist direction) fails CLOSED — a quoted name there makes the file more restricted, not less. Verified.
git fsck --strict passes these trees; transfer.fsckObjects (the duplicate-tree-entry mitigation
for CVE-2026-95106) does not block them — quoting is legal git output, not object corruption.
Make GetAffectedFiles consume unquoted paths, exactly as sibling code already does:
cmd := gitcmd.NewCommand("diff", "--name-only", "-z").AddDynamicArguments(oldCommitID, newCommitID)
// split on NUL; each entry is the raw path — no quoting, no newline ambiguity
(the webhook file-list and the Actions paths: filter already use -z; alternatively unquote with
the same helper family that #39781 introduced for diff-tree --raw). A regression test should push
a protected/weird"name.md under protected/** and assert rejection.
NVD data is provided by NIST and is public domain. Posts quoted belong to their authors.