CVE-2026-58438: Gitea Cross-repository IDOR Vulnerability

LOW
Advisory Identifier: GHSA-xv9x-fj9g-vj6h
CWE-862
Published
Advisory Summary

CVE-2026-58438 is a LOW cross-repository idor vulnerability (CWE-862: Missing Authorization) affecting Gitea libraries in the Go ecosystem. The issue involves cross-repository idor in issue-dependency removal lets an attacker tamper with and comment on private repos they cannot access. Remediation is available by upgrading affected packages to version 1.27.0.

CVE-2026-58438 at a Glance

CVE Identifier CVE-2026-58438
GHSA Identifier GHSA-xv9x-fj9g-vj6h
Severity LOW
CVSS v3.1 Base Score N/A
CWE Classification CWE-862: Missing Authorization
Affected Product Gitea
Package Ecosystem Go
Published Date
Last Updated

How to Fix CVE-2026-58438

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.27.0
Upgrade gitea.dev to 1.27.0
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-58438, 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.27.0), 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-862: Missing Authorization, where the product does not perform an authorization check when an actor attempts to access a resource or perform an action. 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

### Details `RemoveDependency` in `routers/web/repo/issue_dependency.go` takes a `removeDependencyID` form parameter identifying the other issue by its global numeric ID, and fetches it with `issues_model.GetIssueByID(ctx, depID)` - no repository or permission check at all. It then calls `issues_model.RemoveIssueDependency(ctx, ctx.Doer, issue, dep, depType)` (`models/issues/dependency.go`), which deletes the dependency join row and then writes a comment referencing the removal, attributed to the calling user, onto the dependency record. The sibling function in the very same file, `AddDependency`, does this correctly when the two issues are in different repos (which `ALLOW_CROSS_REPOSITORY_DEPENDENCIES`, on by default, permits): ```go if issue.RepoID != dep.RepoID { if !setting.Service.AllowCrossRepositoryDependencies { ... } depRepoPerm, err := access_model.GetDoerRepoPermission(ctx, dep.Repo, ctx.Doer) if !depRepoPerm.CanReadIssuesOrPulls(dep.IsPull) { return // you can't see this dependency } } ``` `RemoveDependency` has no equivalent block at all - it goes straight from resolving `dep` by ID to deleting the link, regardless of which repo `dep` lives in or whether the caller can see it. I confirmed this same code is present in the current latest release, v1.26.4. ### PoC Prerequisites: an account with write access to issues on some repo `ownerA/repoA`, and the global numeric issue ID of an issue in a private repo `repoB` that is (or was) legitimately dependency-linked to one of the attacker's issues in `repoA` (cross-repo dependencies are commonly used between related public/private repos, and `ALLOW_CROSS_REPOSITORY_DEPENDENCIES` defaults to enabled). ```bash curl -s -b "gitea_session=$ATTACKER_SESSION_COOKIE" -X POST \ --data-urlencode "removeDependencyID=<repoB_issue_global_id>" \ --data-urlencode "dependencyType=blockedBy" \ "https://TARGET_HOST/ownerA/repoA/issues/N/dependency/delete" # Expected: the dependency link is deleted and a "removed dependency" comment # authored by the attacker is added to the repoB issue, even though the # attacker has no read access to repoB. ``` ### Impact This is a cross-repository IDOR / broken access control issue. An attacker can tamper with issue-tracking state (dependency relationships) and inject an attacker-authored comment into a private repository they cannot otherwise read or write to, crossing a trust boundary the "add" path explicitly enforces. Impact is bounded - it requires an existing dependency link and discloses no repository content - but it is a genuine unauthorized-write primitive across a private-repo boundary. ### Fix Add the same cross-repo permission check used in `AddDependency` (`access_model.GetDoerRepoPermission(ctx, dep.Repo, ctx.Doer).CanReadIssuesOrPulls(dep.IsPull)`) to `RemoveDependency` before allowing the deletion to proceed when `issue.RepoID != dep.RepoID`. **If possible, please apply for a CVE number when publishing. I would greatly appreciate it.**

CVE-2026-58438 Affected Gitea Versions

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

References

Frequently Asked Questions

What is CVE-2026-58438?
CVE-2026-58438 is a security vulnerability in Gitea involving Cross-repository IDOR in issue-dependency removal lets an attacker tamper with and comment on private repos they cannot access under CWE-862: Missing Authorization.
Which Gitea versions are affected?
Affected versions include releases prior to 1.27.0 across affected packages: gitea.dev.
What version fixes CVE-2026-58438?
Upgrading to 1.27.0 (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.27.0. Upgrade your dependency to 1.27.0 or later.
What CWE is associated with CVE-2026-58438?
CVE-2026-58438 is classified under CWE-862: Missing Authorization (The product does not perform an authorization check when an actor attempts to access a resource or perform an action.).
How can I check Go dependencies for CVE-2026-58438?
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-xv9x-fj9g-vj6h",
  "modified" : "2026-07-21T20:36:59Z",
  "published" : "2026-07-21T20:36:59Z",
  "aliases" : [ "CVE-2026-58438" ],
  "summary" : "Gitea: Cross-repository IDOR in issue-dependency removal lets an attacker tamper with and comment on private repos they cannot access",
  "details" : "### Details\n`RemoveDependency` in `routers/web/repo/issue_dependency.go` takes a `removeDependencyID` form parameter identifying the other issue by its global numeric ID, and fetches it with `issues_model.GetIssueByID(ctx, depID)` - no repository or permission check at all. It then calls `issues_model.RemoveIssueDependency(ctx, ctx.Doer, issue, dep, depType)` (`models/issues/dependency.go`), which deletes the dependency join row and then writes a comment referencing the removal, attributed to the calling user, onto the dependency record.\n\nThe sibling function in the very same file, `AddDependency`, does this correctly when the two issues are in different repos (which `ALLOW_CROSS_REPOSITORY_DEPENDENCIES`, on by default, permits):\n\n```go\nif issue.RepoID != dep.RepoID {\n  if !setting.Service.AllowCrossRepositoryDependencies { ... }\n  depRepoPerm, err := access_model.GetDoerRepoPermission(ctx, dep.Repo, ctx.Doer)\n  if !depRepoPerm.CanReadIssuesOrPulls(dep.IsPull) {\n    return // you can't see this dependency\n  }\n}\n```\n\n`RemoveDependency` has no equivalent block at all - it goes straight from resolving `dep` by ID to deleting the link, regardless of which repo `dep` lives in or whether the caller can see it. I confirmed this same code is present in the current latest release, v1.26.4.\n\n### PoC\nPrerequisites: an account with write access to issues on some repo `ownerA/repoA`, and the global numeric issue ID of an issue in a private repo `repoB` that is (or was) legitimately dependency-linked to one of the attacker's issues in `repoA` (cross-repo dependencies are commonly used between related public/private repos, and `ALLOW_CROSS_REPOSITORY_DEPENDENCIES` defaults to enabled).\n\n```bash\ncurl -s -b \"gitea_session=$ATTACKER_SESSION_COOKIE\" -X POST \\\n  --data-urlencode \"removeDependencyID=<repoB_issue_global_id>\" \\\n  --data-urlencode \"dependencyType=blockedBy\" \\\n  \"https://TARGET_HOST/ownerA/repoA/issues/N/dependency/delete\"\n# Expected: the dependency link is deleted and a \"removed dependency\" comment\n# authored by the attacker is added to the repoB issue, even though the\n# attacker has no read access to repoB.\n```\n\n### Impact\nThis is a cross-repository IDOR / broken access control issue. An attacker can tamper with issue-tracking state (dependency relationships) and inject an attacker-authored comment into a private repository they cannot otherwise read or write to, crossing a trust boundary the \"add\" path explicitly enforces. Impact is bounded - it requires an existing dependency link and discloses no repository content - but it is a genuine unauthorized-write primitive across a private-repo boundary.\n\n### Fix\nAdd the same cross-repo permission check used in `AddDependency` (`access_model.GetDoerRepoPermission(ctx, dep.Repo, ctx.Doer).CanReadIssuesOrPulls(dep.IsPull)`) to `RemoveDependency` before allowing the deletion to proceed when `issue.RepoID != dep.RepoID`.\n\n**If possible, please apply for a CVE number when publishing. I would greatly appreciate it.**",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:H/AT:P/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:L/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "gitea.dev"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.27.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/go-gitea/gitea/security/advisories/GHSA-xv9x-fj9g-vj6h"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/go-gitea/gitea"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-gitea/gitea/releases/tag/v1.27.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-862" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-07-21T20:36:59Z",
    "nvd_published_at" : null
  }
}