9.1critical
Gitea repository archive downloads bypass token scope checks
- Severity
- 9.1critical CVSS:3.1 by CISA-ADP
- Exploit likelihood
- 0.59% (higher than 49% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Gitea
- Also known as
- GHSA-cr4g-f395-h25hGO-2026-5334
Description
Gitea versions up to and including 1.26.1 allow repository archive downloads to bypass token scope checks on the web archive download endpoint.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| Gitea Gitea Open Source Git Server | up to 1.26.1 | CVE List |
| code.gitea.io/gitea (Go) | before 1.26.2 | GitHub Advisory Database, Go Vulnerability Database |
All scores
| CISA-ADP | 9.1critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N |
| GitHub | medium CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N |
Classification
What each source says
CVE List
Gitea versions up to and including 1.26.1 allow repository archive downloads to bypass token scope checks on the web archive download endpoint.
GitHub Advisory Database
Summary
PR #37698 added checkDownloadTokenScope to /raw/, /media/, and attachment download web endpoints. The /archive/* endpoint (repo.Download in routers/web/repo/repo.go:372) was not included in the fix. This endpoint accepts OAuth2 tokens via webAuth.AllowOAuth2 (registered at routers/web/web.go:1649-1652) but does not call checkDownloadTokenScope or CheckRepoScopedToken.
A personal access token with any non-repository scope (e.g., read:issue or read:misc) can download full repository archives (zip/tar.gz) of private repositories the token owner has access to.
Impact
Scope escalation: tokens scoped to non-repository categories can access full repository content through the archive download endpoint. Higher impact than endpoints fixed in #37698 because /archive/* serves the entire repository.
Steps to Reproduce
- Create a personal access token with ONLY read:misc scope
- Access: GET /{owner}/{private-repo}/archive/main.tar.gz
- Archive is served (200 OK) instead of being rejected (403 Forbidden)
Compare with fixed endpoints:
- GET /{owner}/{private-repo}/raw/branch/main/README.md correctly returns 403
Root Cause
Download function in routers/web/repo/repo.go:372 does not call checkDownloadTokenScope. The outer group middleware reqUnitCodeReader checks repository permission but not token scope.
The API equivalent (/api/v1/repos/{owner}/{repo}/archive/*) IS properly scoped via tokenRequiresScopes(AccessTokenScopeCategoryRepository). The git HTTP endpoints are scoped via CheckRepoScopedToken in httpBase.
Suggested Fix
Add checkDownloadTokenScope(ctx) to Download and InitiateDownload in routers/web/repo/repo.go. The function already exists in routers/web/repo/download.go (same package).
Discovery Method
Variant analysis of PR #37698 — reviewed all web routes with webAuth.AllowOAuth2 middleware.
Go Vulnerability Database
Gitea: Token scope bypass on web archive download endpoint in code.gitea.io/gitea
NVD (es)
Las versiones de Gitea hasta e incluyendo la 1.26.1 permiten que las descargas de archivos de repositorio evadan las comprobaciones de alcance de token en el punto final de descarga de archivos web.
References
| https://github.com/go-gitea/gitea/security/advisories/GHSA-cr4g-f395-h25h | advisory, exploit, vendor-advisory, web | |
| https://github.com/go-gitea/gitea/pull/37735 | patch | |
| https://github.com/go-gitea/gitea/releases/tag/v1.26.2 | release-notes | |
| https://blog.gitea.com/release-of-1.26.2/ | release-notes | |
| https://github.com/go-gitea/gitea | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-20706 changed 2026-07-06 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-cr4g-f395-h25h changed 2026-06-25 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2026-5334 changed 2026-06-25 | CC-BY-4.0 |
| NVD | CVE-2026-20706 changed 2026-10-25 | Public domain |