CVE-2026-28740: Gitea Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-2m9v-5q2g-58vq
CVSS 7.1
CWE-639 CWE-863
Published
Advisory Summary

CVE-2026-28740 is a HIGH (CVSS 7.1) remote code execution vulnerability (CWE-639: Authorization Bypass Through User-Controlled Key) affecting Gitea libraries in the Go ecosystem. The issue involves git lfs object reuse allows non-code access to authorize private source objects. Remediation is available by upgrading affected packages to version 1.26.3.

CVE-2026-28740 at a Glance

CVE Identifier CVE-2026-28740
GHSA Identifier GHSA-2m9v-5q2g-58vq
Severity HIGH
CVSS v3.1 Base Score 7.1
CWE Classification CWE-639: Authorization Bypass Through User-Controlled Key
Affected Product Gitea
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 7.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity Low (I:L)
Availability None (A:N)

How to Fix CVE-2026-28740

To remediate this vulnerability, upgrade all affected Gitea dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

gitea.dev fixed: 1.26.3
Upgrade gitea.dev to 1.26.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for gitea.dev

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-28740, inspect your project dependencies for Gitea:

inspect dependencies for gitea.dev

Analyze the terminal output to locate any version of Gitea in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.26.3), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-639: Authorization Bypass Through User-Controlled Key, where the system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data. In Gitea, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary A user with Code write access to one repository may be able to associate an existing Git LFS object from a private source repository with their target repository, even when they do not have Code access to the source repository that currently owns the LFS object. The issue appears to be caused by the source-object authorization check using broad repository accessibility instead of requiring Code-unit access to at least one repository that owns the requested LFS object. ## Impact This issue breaks the expected authorization boundary between repository units. A user who does not have Code access to a private source repository should not be able to reuse or associate Git LFS objects owned by that repository. However, because the source-object accessibility check accepts broad repository access, non-Code access such as Issues access may be sufficient for the LFS object to be treated as accessible. If the reused object becomes downloadable through the attacker-controlled target repository after metadata association, this can result in cross-repository Git LFS content disclosure. The target repository write authorization is still enforced. The problem is specifically in the authorization decision for whether the source LFS object is accessible and may be reused. ## Preconditions The attacker needs: * an authenticated Gitea account; * Code write access to a target repository; * non-Code access, such as Issues access, to a private source repository; * knowledge of an existing Git LFS object OID and size from the private source repository. ## Affected Area The issue affects the Git LFS upload/object reuse path. Relevant paths: ```text services/lfs/server.go ``` Relevant handlers: ```text BatchHandler UploadHandler ``` Both paths can call: ```go git_model.LFSObjectAccessible(ctx, ctx.Doer, p.Oid) ``` The helper is located in: ```text models/git/lfs.go ``` The authorization check uses: ```go repo_model.AccessibleRepositoryCondition(user, unit.TypeInvalid) ``` When `unit.TypeInvalid` is used, the repository access condition can include broad repository access, such as organization team membership through `team_repo` and `team_user`, without requiring that the user has access to the Code unit of the source repository. By contrast, Code-specific repository access checks use a concrete unit type and include `team_unit` validation. ## Validation I reproduced this locally using Gitea's Go test harness. Validated against commit: ```text dac41a124fd34820a3c8caf3b3592ba62cd514ff ``` The PoC creates the following scenario: 1. The attacker has Code write access to the target repository. 2. The source repository is private. 3. The attacker does not have Code access to the source repository. 4. The attacker only has Issues access to the source repository through an organization team. 5. An LFS object exists in the source repository. 6. `LFSObjectAccessible(ctx, attacker, oid)` returns `true`. 7. `NewLFSMetaObject(ctx, targetRepo.ID, pointer)` successfully creates LFS metadata for the target repository. Test result: ```text === RUN TestLFSObjectAccessibleAllowsNonCodeSourceAccess --- PASS: TestLFSObjectAccessibleAllowsNonCodeSourceAccess PASS ok gitea.dev/models/git ``` No live instance was tested. Validation was performed only against a local test database. ## Security Expectation A user should not be allowed to reuse or associate an LFS object from a private source repository unless they have Code access to that source repository, or another permission level explicitly intended to grant access to repository file contents. Non-Code permissions such as Issues access should not authorize access to Git LFS object content or allow Git LFS object reuse. ## Suggested Fix `LFSObjectAccessible` should require Code-unit access to at least one repository that owns the requested LFS object. The check should avoid using `unit.TypeInvalid` for this source-object authorization decision. A Code-specific repository access condition should be used instead. A regression test should cover: * private source repository; * user has Issues-only access to the source repository; * user does not have Code access to the source repository; * user has Code write access to the target repository; * known LFS object exists in the source repository; * object reuse must be rejected unless the user has Code access to the source repository. ## Suggested Severity Suggested severity: Medium to High. The severity depends on whether the associated LFS object becomes downloadable through the target repository after reuse. If the object becomes downloadable through the target repository, the issue should be considered High because it can lead to cross-repository Git LFS content disclosure. Suggested CVSS v3.1 if content disclosure is confirmed: ```text CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:N ``` Rationale: * network reachable through Git LFS endpoints; * requires authentication; * requires knowledge of the LFS object OID and size; * no user interaction required; * breaks repository-level authorization expectations; * primary impact is confidentiality of private Git LFS content; * limited integrity impact through unauthorized LFS metadata association in the target repository. ## Evidence I can provide the local regression test and passing test log privately if needed.

CVE-2026-28740 Affected Gitea Versions

1 component(s)
Fixed Versions:
1.26.3
Product / Package Ecosystem Affected Versions Fixed Version
gitea.dev
Go
< 1.26.3
1.26.3

References

Frequently Asked Questions

What is CVE-2026-28740?
CVE-2026-28740 is a security vulnerability in Gitea involving Git LFS object reuse allows non-Code access to authorize private source objects under CWE-639: Authorization Bypass Through User-Controlled Key.
Which Gitea versions are affected?
Affected versions include releases prior to 1.26.3 across affected packages: gitea.dev.
What version fixes CVE-2026-28740?
Upgrading to 1.26.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is gitea.dev affected?
Yes, gitea.dev is affected in releases prior to 1.26.3. Upgrade your dependency to 1.26.3 or later.
What is the CVSS score of CVE-2026-28740?
CVE-2026-28740 has a CVSS v3.1 base score of 7.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N.
What CWE is associated with CVE-2026-28740?
CVE-2026-28740 is classified under CWE-639: Authorization Bypass Through User-Controlled Key (The system's authorization functionality does not prevent one user from gaining access to another user's data or record by modifying the key value identifying the data.).
How can I check Go dependencies for CVE-2026-28740?
Run the dependency tree command: 'inspect dependencies for gitea.dev'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-2m9v-5q2g-58vq",
  "modified" : "2026-07-21T20:29:43Z",
  "published" : "2026-07-21T20:29:43Z",
  "aliases" : [ "CVE-2026-28740" ],
  "summary" : "Gitea: Git LFS object reuse allows non-Code access to authorize private source objects",
  "details" : "## Summary\n\nA user with Code write access to one repository may be able to associate an existing Git LFS object from a private source repository with their target repository, even when they do not have Code access to the source repository that currently owns the LFS object.\n\nThe issue appears to be caused by the source-object authorization check using broad repository accessibility instead of requiring Code-unit access to at least one repository that owns the requested LFS object.\n\n## Impact\n\nThis issue breaks the expected authorization boundary between repository units.\n\nA user who does not have Code access to a private source repository should not be able to reuse or associate Git LFS objects owned by that repository. However, because the source-object accessibility check accepts broad repository access, non-Code access such as Issues access may be sufficient for the LFS object to be treated as accessible.\n\nIf the reused object becomes downloadable through the attacker-controlled target repository after metadata association, this can result in cross-repository Git LFS content disclosure.\n\nThe target repository write authorization is still enforced. The problem is specifically in the authorization decision for whether the source LFS object is accessible and may be reused.\n\n## Preconditions\n\nThe attacker needs:\n\n* an authenticated Gitea account;\n* Code write access to a target repository;\n* non-Code access, such as Issues access, to a private source repository;\n* knowledge of an existing Git LFS object OID and size from the private source repository.\n\n## Affected Area\n\nThe issue affects the Git LFS upload/object reuse path.\n\nRelevant paths:\n\n```text\nservices/lfs/server.go\n```\n\nRelevant handlers:\n\n```text\nBatchHandler\nUploadHandler\n```\n\nBoth paths can call:\n\n```go\ngit_model.LFSObjectAccessible(ctx, ctx.Doer, p.Oid)\n```\n\nThe helper is located in:\n\n```text\nmodels/git/lfs.go\n```\n\nThe authorization check uses:\n\n```go\nrepo_model.AccessibleRepositoryCondition(user, unit.TypeInvalid)\n```\n\nWhen `unit.TypeInvalid` is used, the repository access condition can include broad repository access, such as organization team membership through `team_repo` and `team_user`, without requiring that the user has access to the Code unit of the source repository.\n\nBy contrast, Code-specific repository access checks use a concrete unit type and include `team_unit` validation.\n\n## Validation\n\nI reproduced this locally using Gitea's Go test harness.\n\nValidated against commit:\n\n```text\ndac41a124fd34820a3c8caf3b3592ba62cd514ff\n```\n\nThe PoC creates the following scenario:\n\n1. The attacker has Code write access to the target repository.\n2. The source repository is private.\n3. The attacker does not have Code access to the source repository.\n4. The attacker only has Issues access to the source repository through an organization team.\n5. An LFS object exists in the source repository.\n6. `LFSObjectAccessible(ctx, attacker, oid)` returns `true`.\n7. `NewLFSMetaObject(ctx, targetRepo.ID, pointer)` successfully creates LFS metadata for the target repository.\n\nTest result:\n\n```text\n=== RUN   TestLFSObjectAccessibleAllowsNonCodeSourceAccess\n--- PASS: TestLFSObjectAccessibleAllowsNonCodeSourceAccess\nPASS\nok  \tgitea.dev/models/git\n```\n\nNo live instance was tested. Validation was performed only against a local test database.\n\n## Security Expectation\n\nA user should not be allowed to reuse or associate an LFS object from a private source repository unless they have Code access to that source repository, or another permission level explicitly intended to grant access to repository file contents.\n\nNon-Code permissions such as Issues access should not authorize access to Git LFS object content or allow Git LFS object reuse.\n\n## Suggested Fix\n\n`LFSObjectAccessible` should require Code-unit access to at least one repository that owns the requested LFS object.\n\nThe check should avoid using `unit.TypeInvalid` for this source-object authorization decision. A Code-specific repository access condition should be used instead.\n\nA regression test should cover:\n\n* private source repository;\n* user has Issues-only access to the source repository;\n* user does not have Code access to the source repository;\n* user has Code write access to the target repository;\n* known LFS object exists in the source repository;\n* object reuse must be rejected unless the user has Code access to the source repository.\n\n## Suggested Severity\n\nSuggested severity: Medium to High.\n\nThe severity depends on whether the associated LFS object becomes downloadable through the target repository after reuse.\n\nIf the object becomes downloadable through the target repository, the issue should be considered High because it can lead to cross-repository Git LFS content disclosure.\n\nSuggested CVSS v3.1 if content disclosure is confirmed:\n\n```text\nCVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:L/A:N\n```\n\nRationale:\n\n* network reachable through Git LFS endpoints;\n* requires authentication;\n* requires knowledge of the LFS object OID and size;\n* no user interaction required;\n* breaks repository-level authorization expectations;\n* primary impact is confidentiality of private Git LFS content;\n* limited integrity impact through unauthorized LFS metadata association in the target repository.\n\n## Evidence\n\nI can provide the local regression test and passing test log privately if needed.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:L/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "gitea.dev"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.26.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/go-gitea/gitea/security/advisories/GHSA-2m9v-5q2g-58vq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-28740"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-gitea/gitea/pull/38050"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-gitea/gitea/commit/1c7b7ea72df7cf81e88b8e09049608254d32e56e"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-gitea/gitea/commit/7b4a1a1a118501b9d0260301dfed7f52dfc36ee9"
  }, {
    "type" : "WEB",
    "url" : "https://blog.gitea.com/release-of-1.26.3-and-1.26.4"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/go-gitea/gitea"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-gitea/gitea/releases/tag/v1.26.3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-639", "CWE-863" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-07-21T20:29:43Z",
    "nvd_published_at" : "2026-07-03T21:16:59Z"
  }
}