Summary
Any authenticated low-privilege user with read access to a repository can push arbitrary commits directly to that repository, bypassing all write-access checks.
Vulnerability
Gitea's "Allow edits from maintainers" PR option can be abused via reverse-fork PRs:
- The web UI PR-create endpoint binds
allow_maintainer_edit=truewithout verifying that the submitter has write access to the HEAD repository. - Gitea allows creating a PR where BASE = attacker's fork and HEAD = upstream target. The attacker is "maintainer" of the BASE (their own fork), so the flag is set against the upstream HEAD.
- On
git pushover HTTP/SSH, Gitea relaxes the required access mode toReadwhenSupportProcReceiveis enabled (routers/web/repo/githttp.go,routers/private/serv.go) and defers enforcement to the pre-receive hook. - The pre-receive hook calls
CanMaintainerWriteToBranch(models/issues/pull_list.go), which finds the malicious PR, seesAllowMaintainerEdit=true, and checks whether the pusher has write access to the BASE repo. Since BASE is the attacker's own fork, the check passes and the push is authorized against the upstream.
Exploitation
- Attacker forks the target repository.
- Attacker visits the web compare endpoint and creates a PR with
BASE = their_fork,HEAD = upstream, and "Allow edits from maintainers" checked. - Attacker clones their fork, makes a commit, and runs
git push <upstream_url> <branch>, the push is accepted.
Reproduction
python3 poc.py --repo http://gitea:3000/victim/repo --user attacker --password attacker_pass
Expected output:
[+] target: victim/my_repo default branch: main
[*] forking -> attacker/my_repo_pocfork (202)
[+] fork ready
[+] malicious PR created (BASE=attacker fork, HEAD=upstream)
remote: . Processing 1 references
remote: Processed 1 references in total
To http://192.168.101.20:3000/victim/my_repo.git
e5c07b3..9a0b884 main -> main
[+] latest commit on victim/my_repo@main: 'PoC: unauthorized commit via maintainer-edit bypass'
[+] CONFIRMED: unauthorized push to upstream succeeded.
A PWNED.txt file will appear on the target repo's default branch, committed by the attacker who has no write access.
Impact
Full repository compromise. Any logged-in user can backdoor any repository they can read, including all public repositories on the instance.
The application does not correctly enforce access controls, allowing a principal to access resources or operations beyond their granted permissions. Typical impact: unauthorized data access or execution of privileged operations.
CVE-2026-26231 has a CVSS score of 8.5 (High). The vector is network-reachable, low privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (1.26.2); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Two independent checks are missing; both should be added for defense in depth:
- At PR creation: before setting
AllowMaintainerEdit = true, verify the submitter has write access to the HEAD repository. - In
CanMaintainerWriteToBranch: verify that the PR's HEAD repo matches the repository being pushed to, and that the PR was opened by a legitimate owner/writer of the HEAD repository. Do not trustAllowMaintainerEditsolely based on BASE write access.
Frequently Asked Questions
- What is CVE-2026-26231? CVE-2026-26231 is a high-severity incorrect authorization vulnerability in code.gitea.io/gitea (go), affecting versions <= 1.26.1. It is fixed in 1.26.2. The application does not correctly enforce access controls, allowing a principal to access resources or operations beyond their granted permissions.
- How severe is CVE-2026-26231? CVE-2026-26231 has a CVSS score of 8.5 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of code.gitea.io/gitea are affected by CVE-2026-26231? code.gitea.io/gitea (go) versions <= 1.26.1 is affected.
- Is there a fix for CVE-2026-26231? Yes. CVE-2026-26231 is fixed in 1.26.2. Upgrade to this version or later.
- Is CVE-2026-26231 exploitable, and should I be worried? Whether CVE-2026-26231 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-26231 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-26231? Upgrade
code.gitea.io/giteato 1.26.2 or later.