CVE-2026-57886: Gitea: Cross-repository issue/comment attachment re-linking can expose private attachment content
Gitea’s issue and comment attachment update paths accept attachment UUIDs without verifying that each attachment belongs to the target issue/comment repository. If an authenticated attacker knows a victim attachment UUID, they can re-link that attachment to an attacker-controlled issue or comment, causing later attachment access checks to use the attacker’s repository authorization context.
Full HTTP/E2E observation:
- A local Gitea server was started with an isolated SQLite database.
- A victim user created private repositories, private issues, and issue attachments containing unique marker strings.
- An attacker user first attempted to download each victim attachment through
/attachments/{uuid}and received404. - The attacker then submitted the victim UUID through the real issue edit route in an attacker-controlled public repository.
- The same attacker could then download the victim issue attachment through
/attachments/{uuid}and received200; the response body contained the unique issue marker. - The attacker repeated the flow through the real comment edit route and could download the second victim attachment with
200; the response body contained the unique comment marker.
Model-level issue-path behavior:
- A fixture attachment with
RepoID = 2andIssueID = 4was passed toUpdateIssueAttachmentsfor attacker issueID = 1, whoseRepoID = 1. - The call succeeded.
- The attachment row still had
RepoID = 2, but itsIssueIDwas changed to the attacker issue. GetAttachmentLinkedTypeAndRepoIDthen resolved the attachment to attacker repositoryRepoID = 1.
Model-level comment-path behavior:
- The same cross-repository attachment UUID was passed to
UpdateCommentAttachmentsfor attacker commentID = 1. - The call succeeded.
- The attachment row still had
RepoID = 2, but itsIssueIDandCommentIDwere changed to the attacker’s issue/comment. - The linked repository used for access checks became attacker repository
RepoID = 1.
Negative control:
- Existing release test
TestAddReleaseAttachmentsRejectsDifferentRepopasses and confirms the release path rejects the same class of cross-repository attachment linkage.
Detailed verifier and step-by-step runbook are available on request.
References
- github.com/advisories/GHSA-6c6r-5xr4-cr5m
- github.com/go-gitea/gitea/commit/de4b8277e9cb576f2315fb03b5ab6478b42a1d31
- github.com/go-gitea/gitea/commit/f69e15afe7496cc62e96dab244629c69eb31a7bf
- github.com/go-gitea/gitea/pull/38406
- github.com/go-gitea/gitea/pull/38426
- github.com/go-gitea/gitea/releases/tag/v1.27.0
- github.com/go-gitea/gitea/security/advisories/GHSA-6c6r-5xr4-cr5m
- nvd.nist.gov/vuln/detail/CVE-2026-57886
Code Behaviors & Features
Detect and mitigate CVE-2026-57886 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →