{"id":"CVE-2026-26231","aliases":["CVE-2026-26231","GHSA-mm7c-rhg6-qr4r","GO-2026-5510"],"related":[],"kind":"vulnerability","state":"published","title":"Gitea maintainer-edit permissions allow unauthorized commits to readable repositories","summary":"Gitea versions up to and including 1.26.1 allow the Allow edits from maintainers permission path to authorize commits to repositories that the user can read but should not be able to write.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Gitea versions up to and including 1.26.1 allow the Allow edits from maintainers permission path to authorize commits to repositories that the user can read but should not be able to write.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nAny authenticated low-privilege user with read access to a repository can push arbitrary commits directly to that repository, bypassing all write-access checks.\n\n## Vulnerability\n\nGitea's \"Allow edits from maintainers\" PR option can be abused via reverse-fork PRs:\n\n1. The web UI PR-create endpoint binds `allow_maintainer_edit=true` **without** verifying that the submitter has write access to the HEAD repository.\n2. 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.\n3. On `git push` over HTTP/SSH, Gitea relaxes the required access mode to `Read` when `SupportProcReceive` is enabled ([`routers/web/repo/githttp.go`](https://github.com/go-gitea/gitea/blob/v1.25.5/routers/web/repo/githttp.go#L189), [`routers/private/serv.go`](https://github.com/go-gitea/gitea/blob/v1.25.5/routers/private/serv.go#L337)) and defers enforcement to the pre-receive hook.\n4. The pre-receive hook calls [`CanMaintainerWriteToBranch`](https://github.com/go-gitea/gitea/blob/v1.25.5/models/issues/pull_list.go#L72) (`models/issues/pull_list.go`), which finds the malicious PR, sees `AllowMaintainerEdit=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.\n\n## Exploitation\n\n1. Attacker forks the target repository.\n2. Attacker visits the web compare endpoint and creates a PR with `BASE = their_fork`, `HEAD = upstream`, and \"Allow edits from maintainers\" checked.\n3. Attacker clones their fork, makes a commit, and runs `git push <upstream_url> <branch>` — the push is accepted.\n\n## Reproduction\n\n```bash\npython3 poc.py --repo http://gitea:3000/victim/repo --user attacker --password attacker_pass\n```\n[poc.py](https://github.com/user-attachments/files/26641541/poc.py)\n\nExpected output:\n```\n[+] target: victim/my_repo  default branch: main\n[*] forking -> attacker/my_repo_pocfork (202)\n[+] fork ready\n[+] malicious PR created (BASE=attacker fork, HEAD=upstream)\n\nremote: . Processing 1 references\nremote: Processed 1 references in total\nTo http://192.168.101.20:3000/victim/my_repo.git\n   e5c07b3..9a0b884  main -> main\n\n[+] latest commit on victim/my_repo@main: 'PoC: unauthorized commit via maintainer-edit bypass'\n[+] CONFIRMED: unauthorized push to upstream succeeded.\n```\n\nA `PWNED.txt` file will appear on the target repo's default branch, committed by the attacker who has no write access.\n\n\n## Impact\n\nFull repository compromise. Any logged-in user can backdoor any repository they can read, including all public repositories on the instance.\n\n## Suggested Fix\n\nTwo independent checks are missing; both should be added for defense in depth:\n\n1. **At PR creation:** before setting `AllowMaintainerEdit = true`, verify the submitter has write access to the **HEAD** repository.\n2. **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 trust `AllowMaintainerEdit` solely based on BASE write access.","format":"markdown","source":"ghsa"},{"lang":"en","text":"Gitea: Authorization Bypass via \"Allow edits from maintainers\" allows unauthorized commits to any readable repo in code.gitea.io/gitea","format":"markdown","source":"go"},{"lang":"es","text":"Versiones de Gitea hasta la 1.26.1 inclusive permiten que la ruta de permiso ’Permitir ediciones de los mantenedores’ autorice confirmaciones a repositorios que el usuario puede leer pero en los que no debería poder escribir.","source":"nvd"}],"published":"2026-06-16T23:41:01.000Z","modified":"2026-10-25T15:10:00.147Z","severity":{"scorer":"Gitea","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:N","score":8.5,"rating":"HIGH"},"severities":[{"scorer":"Gitea","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:N","score":8.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:H/A:N","score":8.5,"rating":"HIGH"}],"cwes":["CWE-863"],"affected":[{"ranges":[{"type":"semver","introduced":"0","lastAffected":"1.26.1","status":"affected"}],"vendor":"Gitea","product":"Gitea Open Source Git Server","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.26.2"}],"ecosystem":"Go","package":"code.gitea.io/gitea","purl":"pkg:golang/code.gitea.io/gitea","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"1.26.2"}],"ecosystem":"Go","package":"code.gitea.io/gitea","purl":"pkg:golang/code.gitea.io/gitea","source":"go"}],"references":[{"url":"https://github.com/go-gitea/gitea/security/advisories/GHSA-mm7c-rhg6-qr4r","tags":["advisory","exploit","vendor-advisory","web"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/go-gitea/gitea/pull/37479","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://github.com/go-gitea/gitea/pull/37484","tags":["patch"],"sources":["cvelist","nvd"]},{"url":"https://github.com/go-gitea/gitea/releases/tag/v1.26.2","tags":["release-notes"],"sources":["cvelist","nvd"]},{"url":"https://blog.gitea.com/release-of-1.26.2/","tags":["release-notes"],"sources":["cvelist","nvd"]},{"url":"https://github.com/go-gitea/gitea","tags":["package"],"sources":["ghsa"]}],"credits":["ddd"],"assigner":"Gitea","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-07-07T14:44:56.666Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-26231","url":"https://www.cve.org/CVERecord?id=CVE-2026-26231","licence":"CVE Terms of Use","modified":"2026-07-07T16:59:29.212Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-mm7c-rhg6-qr4r","url":"https://github.com/advisories/GHSA-mm7c-rhg6-qr4r","licence":"CC-BY-4.0","modified":"2026-06-25T23:11:46.487Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5510","url":"https://pkg.go.dev/vuln/GO-2026-5510","licence":"CC-BY-4.0","modified":"2026-06-25T23:01:15.779Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-26231","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-26231","licence":"Public domain","modified":"2026-10-25T15:10:00.147Z"}],"updatedAt":"2026-11-25T22:59:27.111Z","epss":{"score":0.0036,"percentile":0.31843,"date":"2026-12-01T12:00:22.000Z"}}