GHSA-H56G-4QW7-2MXG
Vulnerability from github – Published: 2026-07-21 21:50 – Updated: 2026-07-21 21:50Summary
Gitea's /api/v1/teams/{id} API routes do not correctly enforce the public-only access token restriction.
A public-only token is intended to limit API access to public repositories and public organizations. However, several team API routes continue to return private team repository metadata and private team activity feed entries when called with a public-only token.
Details
The /api/v1/teams/{teamid} route group uses:
orgAssignment(false, true)
This loads ctx.Org.Team, but does not load ctx.Org.Organization.
The checkTokenPublicOnly middleware checks organization visibility through ctx.Org.Organization. When ctx.Org.Organization is nil, the organization visibility check silently passes.
In addition, the team repository handlers return repositories without applying repository-level public-only filtering:
repo_model.GetTeamRepositories(...)
convert.ToRepo(...)
They do not call:
ctx.TokenCanAccessRepo(repo)
The team activity feed handler also sets:
IncludePrivate: true
but does not apply:
opts.ApplyPublicOnly(ctx.PublicOnly)
PoC
Vulnerability is verified on latest gitea release (1.26.2) and nightly build.
Frist, create a public-only organization-scoped token for a user who is a member of a team in a private org with private repositories:
Use the returned token to request team repositories:
Expected result: Private repositories should be hidden or rejected for a public-only token. Actual result: Private team repository metadata is returned.
The team activity feed endpoint can be tested similarly:
Impact
A public-only token can access private team resources that should be hidden from that token.
{
"affected": [
{
"package": {
"ecosystem": "Go",
"name": "gitea.dev"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.27.0"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-58431"
],
"database_specific": {
"cwe_ids": [
"CWE-863"
],
"github_reviewed": true,
"github_reviewed_at": "2026-07-21T21:50:11Z",
"nvd_published_at": null,
"severity": "MODERATE"
},
"details": "### Summary\n\nGitea\u0027s `/api/v1/teams/{id}` API routes do not correctly enforce the `public-only` access token restriction.\n\nA `public-only` token is intended to limit API access to public repositories and public organizations. However, several team API routes continue to return private team repository metadata and private team activity feed entries when called with a `public-only` token.\n\n### Details\n\nThe `/api/v1/teams/{teamid}` route group uses:\n\n```go\norgAssignment(false, true)\n```\n\nThis loads `ctx.Org.Team`, but does not load `ctx.Org.Organization`.\n\nThe `checkTokenPublicOnly` middleware checks organization visibility through `ctx.Org.Organization`. When `ctx.Org.Organization` is nil, the organization visibility check silently passes.\n\nIn addition, the team repository handlers return repositories without applying repository-level `public-only` filtering:\n\n```go\nrepo_model.GetTeamRepositories(...)\nconvert.ToRepo(...)\n```\n\nThey do not call:\n\n```go\nctx.TokenCanAccessRepo(repo)\n```\n\nThe team activity feed handler also sets:\n\n```go\nIncludePrivate: true\n```\n\nbut does not apply:\n\n```go\nopts.ApplyPublicOnly(ctx.PublicOnly)\n```\n\n### PoC\n\nVulnerability is verified on latest gitea release (1.26.2) and nightly build.\nFrist, create a `public-only` organization-scoped token for a user who is a member of a team in a private org with private repositories:\n\n\u003cimg width=\"1075\" height=\"577\" alt=\"image\" src=\"https://github.com/user-attachments/assets/4a01d0ab-f67c-47c9-94b1-e74ddd77d7bc\" /\u003e\n\n\u003cimg width=\"649\" height=\"375\" alt=\"image\" src=\"https://github.com/user-attachments/assets/b5d91962-088e-40f4-bc51-88a17946e6d8\" /\u003e\n\nUse the returned token to request team repositories:\n\n\u003cimg width=\"1728\" height=\"190\" alt=\"image\" src=\"https://github.com/user-attachments/assets/0f15878f-5806-431d-958c-ffb39bf7c1e9\" /\u003e\n\nExpected result: Private repositories should be hidden or rejected for a public-only token.\nActual result: Private team repository metadata is returned.\n\nThe team activity feed endpoint can be tested similarly:\n\n\u003cimg width=\"1728\" height=\"237\" alt=\"image\" src=\"https://github.com/user-attachments/assets/280a5ddf-ad14-4769-86a8-1fdad858287c\" /\u003e\n\n### Impact\n\nA `public-only` token can access private team resources that should be hidden from that token.",
"id": "GHSA-h56g-4qw7-2mxg",
"modified": "2026-07-21T21:50:11Z",
"published": "2026-07-21T21:50:11Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/go-gitea/gitea/security/advisories/GHSA-h56g-4qw7-2mxg"
},
{
"type": "PACKAGE",
"url": "https://github.com/go-gitea/gitea"
},
{
"type": "WEB",
"url": "https://github.com/go-gitea/gitea/releases/tag/v1.27.0"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N",
"type": "CVSS_V3"
}
],
"summary": "Gitea: Public-only API token restriction is not enforced on team API routes"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.