{"id":"CVE-2026-20706","aliases":["CVE-2026-20706","GHSA-cr4g-f395-h25h","GO-2026-5334"],"related":[],"kind":"vulnerability","state":"published","title":"Gitea repository archive downloads bypass token scope checks","summary":"Gitea versions up to and including 1.26.1 allow repository archive downloads to bypass token scope checks on the web archive download endpoint.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Gitea versions up to and including 1.26.1 allow repository archive downloads to bypass token scope checks on the web archive download endpoint.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nPR #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.\n\nA 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.\n\n## Impact\n\nScope 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.\n\n## Steps to Reproduce\n\n1. Create a personal access token with ONLY read:misc scope\n2. Access: GET /{owner}/{private-repo}/archive/main.tar.gz\n3. Archive is served (200 OK) instead of being rejected (403 Forbidden)\n\nCompare with fixed endpoints:\n- GET /{owner}/{private-repo}/raw/branch/main/README.md correctly returns 403\n\n## Root Cause\n\nDownload function in routers/web/repo/repo.go:372 does not call checkDownloadTokenScope. The outer group middleware reqUnitCodeReader checks repository permission but not token scope.\n\nThe API equivalent (/api/v1/repos/{owner}/{repo}/archive/*) IS properly scoped via tokenRequiresScopes(AccessTokenScopeCategoryRepository). The git HTTP endpoints are scoped via CheckRepoScopedToken in httpBase.\n\n## Suggested Fix\n\nAdd checkDownloadTokenScope(ctx) to Download and InitiateDownload in routers/web/repo/repo.go. The function already exists in routers/web/repo/download.go (same package).\n\n## Discovery Method\n\nVariant analysis of PR #37698 — reviewed all web routes with webAuth.AllowOAuth2 middleware.","format":"markdown","source":"ghsa"},{"lang":"en","text":"Gitea: Token scope bypass on web archive download endpoint in code.gitea.io/gitea","format":"markdown","source":"go"},{"lang":"es","text":"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.","source":"nvd"}],"published":"2026-06-16T23:42:04.000Z","modified":"2026-10-25T15:10:00.147Z","severity":{"scorer":"CISA-ADP","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N","score":9.1,"rating":"CRITICAL"},"severities":[{"scorer":"CISA-ADP","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N","score":9.1,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"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","rating":"MEDIUM"}],"cwes":["CWE-284","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-cr4g-f395-h25h","tags":["advisory","exploit","vendor-advisory","web"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/go-gitea/gitea/pull/37735","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":["geoo115"],"assigner":"Gitea","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-07-06T18:34:03.677Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-20706","url":"https://www.cve.org/CVERecord?id=CVE-2026-20706","licence":"CVE Terms of Use","modified":"2026-07-06T18:34:55.061Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-cr4g-f395-h25h","url":"https://github.com/advisories/GHSA-cr4g-f395-h25h","licence":"CC-BY-4.0","modified":"2026-06-25T19:56:32.287Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5334","url":"https://pkg.go.dev/vuln/GO-2026-5334","licence":"CC-BY-4.0","modified":"2026-06-25T19:45:33.236Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-20706","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-20706","licence":"Public domain","modified":"2026-10-25T15:10:00.147Z"}],"updatedAt":"2026-11-25T22:59:27.105Z","epss":{"score":0.00589,"percentile":0.49528,"date":"2026-12-01T12:00:22.000Z"}}