Skip to main content

Gitea CVE-2026-57886

| EUVDEUVD-2026-58147 MEDIUM
Authorization Bypass Through User-Controlled Key (CWE-639)
2026-07-21 https://github.com/go-gitea/gitea GHSA-6c6r-5xr4-cr5m
5.9
CVSS 3.1 · Vendor: https://github.com/go-gitea/gitea
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Obtain victim attachment UUID via notification email or prior access
  2. Delivery
    Authenticate to Gitea as low-privilege user
  3. Exploit
    Submit victim UUID in files[] of issue edit request
  4. Install
    UpdateIssueAttachments re-links attachment to attacker repository
  5. C2
    Request /attachments/{uuid}
  6. Execute
    Access check resolves against attacker's repository
  7. Impact
    Private attachment file served to attacker

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V8 - Authorization Object-level authorization, IDOR prevention
Exploitation Conditions

The attacker must be authenticated to the Gitea instance with at least issue-editing permissions in one repository they control or have write access to - any such repository suffices, including a public repository on the same instance. The attacker must separately know the UUID of a target attachment from a different, inaccessible repository; this UUID cannot be enumerated through the vulnerability itself and must be obtained via a secondary information-disclosure vector such as forwarded notification emails, browser history, shared attachment links, API response logs, or prior legitimate read access to the victim repository. The vulnerability affects the web issue/comment attachment update path and requires the Gitea instance to be running a version prior to 1.27.0. Limiting factors: AC:H reflects the UUID prerequisite; PR:L means fully anonymous exploitation is not possible; the victim repository must contain issue or comment attachments; and UUID exposure must have occurred through some prior channel for the attack to proceed.

Impact

The provided CVSS 3.1 vector (AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:N, score 5.9) accurately reflects the attack profile: network-reachable, requires a low-privilege authenticated session, and carries High confidentiality impact offset by High attack complexity. The AC:H rating is appropriate because the attacker must independently obtain the victim attachment UUID - it cannot be enumerated through this vulnerability alone and must arrive through a separate channel such as notification email, browser history, shared links, or log exposure. No EPSS data was provided in the available intelligence, so probabilistic exploitation likelihood cannot be quantified. The vulnerability is not listed in CISA KEV, and no public exploit code has been identified, indicating it is not yet confirmed as widely or actively exploited. However, the GHSA advisory contains a complete E2E reproduction runbook that significantly lowers the barrier for capable adversaries. Organizations hosting private Gitea repositories with sensitive issue or comment attachments, particularly those with broad user bases that increase UUID exposure surface, should treat this as a medium-high remediation priority despite the moderate CVSS score.

Exploit ScenarioDerived

An attacker authenticated to a Gitea instance edits an issue in a repository they control and injects a victim attachment UUID - obtained, for example, from a notification email or a previously shared link - into the files[] form parameter of the issue update HTTP request. Gitea's UpdateIssueAttachments function accepts the UUID and re-links the attachment to the attacker's issue without validating repository ownership. The attacker then requests /attachments/{victim-uuid} and receives the private attachment file, because the access check now resolves against the attacker's own repository. No public exploit code has been identified, but the GHSA advisory provides a complete step-by-step HTTP-level runbook.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jul 21, 2026

Cross-repository attachment re-linking in Gitea exposes private issue and comment attachments to authenticated attackers who know a victim's attachment UUID. An attacker with issue-editing rights in any repository they can access can inject a victim UUID into the files[] parameter of an issue or comment edit request, causing Gitea to re-link that attachment into the attacker's authorization context; subsequent requests to /attachments/{uuid} then resolve access against the attacker's repository rather than the victim's, delivering the private file. No public exploit code has been identified at time of analysis, but the GHSA advisory (GHSA-6c6r-5xr4-cr5m) includes a detailed step-by-step reproduction runbook. The vendor-released fix is Gitea v1.27.0.

RemediationAI

Upgrade Gitea to version 1.27.0, which incorporates fixes from pull requests https://github.com/go-gitea/gitea/pull/38406 and https://github.com/go-gitea/gitea/pull/38426, and commits de4b8277e9cb576f2315fb03b5ab6478b42a1d31 and f69e15afe7496cc62e96dab244629c69eb31a7bf. The release is available at https://github.com/go-gitea/gitea/releases/tag/v1.27.0. If an immediate upgrade is not feasible, reduce exposure by restricting repository issue-editing permissions to the minimum necessary set of trusted users, since the attack requires an authenticated user with issue-edit rights - this limits the pool of potential attackers but does not eliminate the vulnerability and may affect collaboration workflows. Disabling attachment uploads entirely (if the Gitea configuration supports it) would prevent new UUIDs from being created but would not protect existing attachment UUIDs already in circulation. After upgrading, the advisory recommends running a database audit query to detect and remediate existing inconsistent rows where attachment.issue_id is non-zero but attachment.repo_id differs from the linked issue's repository, as these may represent prior exploitation or data integrity issues.

Affected VersionsENISA

Gitea Open Source Git Server 0 ≤1.26.4

Affected Packages

go code.gitea.io/gitea fix: 1.27.0
go gitea.dev fix: 1.27.0
euvd gitea_open_source_git_server no fix

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 3 packages in go, euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The vulnerability is an instance of CWE-639 (Authorization Through User-Controlled Key): attachment UUIDs supplied by the client are accepted as authoritative identifiers without ownership validation. In Gitea's Go codebase, UpdateIssueAttachments (models/issues/issue_update.go:267-278) and UpdateCommentAttachments (models/issues/comment.go:623-642) look up attachments by UUID and update their IssueID/CommentID linkage, but neither function asserts that the attachment's stored RepoID matches the repository of the target issue or comment, nor do they reject attachments already linked to a different issue or comment. The global /attachments/{uuid} route (routers/web/web.go:872-876) subsequently determines access permissions by calling GetAttachmentLinkedTypeAndRepoID, which derives the repository from the now-attacker-controlled IssueID field - not from the attachment's original RepoID. An equivalent guard was previously introduced for the release-attachment path (models/repo/release.go:179-215) as part of remediating CVE-2026-20736, demonstrating that the intended invariant is known to the project; the issue and comment paths were simply not covered by that fix. Affected package: Go module code.gitea.io/gitea (CPE: pkg:go/code.gitea.io_gitea).

Know when Gitea gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/go-gitea/gitea) PRIMARY 5.9 MEDIUM
AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:N
vuln.today AI 5.9 MEDIUM

Network-exploitable by authenticated low-privilege users (PR:L); AC:H because victim UUID must be obtained independently; C:H for full private file disclosure; I:L for attachment linkage mutation; no availability impact.

3.1 AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:N
4.0 AV:N/AC:L/AT:P/PR:L/UI:N/VC:H/VI:L/VA:N/SC:N/SI:N/SA:N
SUSE MEDIUM

Primary rating from Vendor (https://github.com/go-gitea/gitea).

CVSS VectorVendor: https://github.com/go-gitea/gitea

Attack Vector
Network
Attack Complexity
High
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
Low
Availability
None

DescriptionCVE.org

Summary

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.

Affected

  • Component: web issue/comment attachment handling.
  • Confirmed version: main commit a39b2775edcb3ba53def96794491b91335117d81 (v1.27.0-dev-352-ga39b2775ed).
  • Fixed in: not fixed at the time of validation.
  • Other versions: not exhaustively tested. The affected code path appears structurally similar to versions that contain the current issue/comment attachment update logic.

Description / Root Cause

files[] values from issue/comment edit flows are passed to updateAttachments in routers/web/repo/issue.go:589-629. That helper calls:

  • models/issues/issue_update.go:267-278 (UpdateIssueAttachments)
  • models/issues/comment.go:623-642 (UpdateCommentAttachments)

Both functions load attachments by UUID and update the attachment linkage, but neither validates that the attachment row's RepoID matches the repository of the target issue/comment. They also do not reject attachments already linked to a different issue/comment.

Attachment reads then use the linked issue/release repository to decide access:

  • services/repository/repository.go:185-207 returns the repository ID from IssueID or ReleaseID.
  • routers/web/repo/attachment.go:153-184 checks read permission on that linked repository.
  • routers/web/repo/attachment.go:216-224 opens and serves the file from the attachment's storage path after the linked-repository permission check succeeds.

For the global /attachments/{uuid} route in routers/web/web.go:872-876, there is no current repository context, so the early attach.RepoID mismatch check in ServeAttachment does not protect against this re-linking case.

A patched sibling path already demonstrates the intended invariant: models/repo/release.go:179-215 rejects release attachments whose RepoID differs from the release repository. That guard was introduced for CVE-2026-20736, but the issue/comment paths still lack an equivalent check.

Impact

An attacker who can edit an issue/comment in a repository they can read can move a known victim attachment UUID into that repository's authorization context. After the re-link, the attachment download path resolves access against the attacker-controlled repository while serving the original attachment file.

This can disclose private issue/comment attachments if the attacker has obtained the UUID through prior legitimate access, copied links, notification content, logs, browser history, or another exposure. The attack does not require write access to the victim repository.

Reproduction Summary

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 received 404.
  • 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 received 200; 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 = 2 and IssueID = 4 was passed to UpdateIssueAttachments for attacker issue ID = 1, whose RepoID = 1.
  • The call succeeded.
  • The attachment row still had RepoID = 2, but its IssueID was changed to the attacker issue.
  • GetAttachmentLinkedTypeAndRepoID then resolved the attachment to attacker repository RepoID = 1.

Model-level comment-path behavior:

  • The same cross-repository attachment UUID was passed to UpdateCommentAttachments for attacker comment ID = 1.
  • The call succeeded.
  • The attachment row still had RepoID = 2, but its IssueID and CommentID were changed to the attacker's issue/comment.
  • The linked repository used for access checks became attacker repository RepoID = 1.

Negative control:

  • Existing release test TestAddReleaseAttachmentsRejectsDifferentRepo passes 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.

Suggested Fix

Add repository and linkage validation before updating issue/comment attachments.

Recommended checks:

  • Load the target issue for UpdateIssueAttachments and derive its RepoID.
  • Load the target comment's issue for UpdateCommentAttachments and derive its RepoID.
  • Reject any attachment whose RepoID differs from the target issue repository.
  • Reject attachments already linked to a different issue/comment/release, except for attachments already linked to the same object being updated.
  • If caller context is available at the web/service layer, also require new unlinked attachments to belong to the current actor or to have been uploaded in the current edit session.
  • Preserve any legacy RepoID = 0 migration behavior only when it can be proven safe for the target repository.

Also consider a cleanup/audit query for existing inconsistent rows where attachment.issue_id != 0 and attachment.repo_id differs from the linked issue repository.

Regression Tests

Add tests that fail before the fix and pass after it:

  • UpdateIssueAttachments rejects an attachment whose RepoID differs from the target issue's RepoID.
  • UpdateCommentAttachments rejects an attachment whose RepoID differs from the target comment issue's RepoID.
  • Same-repository unlinked attachment linking still works for normal issue/comment editing.
  • Attachments already linked to a different issue/comment cannot be moved by passing their UUID in files[].
  • Existing release guard test remains passing.

Threat Intelligence Overview

EPSS Score
0.2%
Top 94% exploitable
Prevalence
Medium
self-hosted Git forge, widely used in enterprises and open source communities
Threat Intel
1
1 source
Data Quality
6 sources
Confidence: High

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact· derived
Medium

Priority Score

30
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +30
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Authentication bypass attacks exploit flaws in the verification mechanisms that control access to systems and applications.

More in Gitea

View all
CVE-2026-60004 CRITICAL POC
9.8

Remote code execution in Gitea (self-hosted Git service) via a code-injection flaw (CWE-94) allows attackers to run arbi

CVE-2026-27771 HIGH POC
8.2 Jul 03

Broken access control in Gitea's Composer package registry (versions up to and including 1.26.1) lets remote attackers r

CVE-2022-30781 HIGH POC
7.5 May 16

Gitea before 1.16.7 does not escape git fetch remote. Rated high severity (CVSS 7.5), this vulnerability is remotely exp

CVE-2020-14144 HIGH POC
7.2 Oct 16

The git hook feature in Gitea 1.1.0 through 1.12.5 might allow for authenticated remote code execution in customer envir

CVE-2024-6886 CRITICAL POC
10.0 Aug 06

Improper Neutralization of Input During Web Page Generation (XSS or 'Cross-site Scripting') vulnerability in Gitea Gitea

CVE-2026-72867 CRITICAL POC
9.9 Aug 10

Authenticated command injection in Dokploy (self-hostable PaaS) versions 0.29.3 through 0.29.12 lets a low-privileged us

CVE-2026-20896 CRITICAL POC
9.8 Jul 03

Reverse-proxy authentication bypass in the official Gitea Docker image (versions up to and including 1.26.2) allows any

CVE-2026-59774 CRITICAL POC
9.8

Path traversal in Gitea's Org-mode (`.org`) markup renderer allows an attacker who can get Org-mode content rendered by

CVE-2026-58053 CRITICAL POC
9.4 Jun 28

Container escape in Gitea act_runner (Docker backend, through act 0.262.0) lets an authenticated user with workflow-exec

CVE-2019-11229 HIGH POC
8.8 Apr 15

models/repo_mirror.go in Gitea before 1.7.6 and 1.8.x before 1.8-RC3 mishandles mirror repo URL settings, leading to rem

CVE-2026-57894 HIGH POC
8.5 Jul 21

Server-side request forgery and internal repository exfiltration in Gitea before 1.27.0 lets a low-privileged authentica

CVE-2026-24791 HIGH POC
8.1 Jun 17

Authorization bypass in Gitea versions 1.22.3 through 1.26.1 allows holders of `public-only` access tokens or OAuth gran

Vendor StatusVendor

SUSE

Severity: Moderate
Product Status
SUSE Linux Enterprise Server 16.1 Affected
SUSE Linux Enterprise Server for SAP applications 16.1 Affected
SUSE Linux Enterprise Module for Package Hub 15 SP5 Affected
SUSE Linux Enterprise Module for Package Hub 15 SP6 Affected
openSUSE Leap 15.5 Affected

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy