GHSA-xv9x-fj9g-vj6h: Gitea: Cross-repository IDOR in issue-dependency removal lets an attacker tamper with and comment on private repos they cannot access
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):
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).
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 is
Details
Original advisory: https://github.com/advisories/GHSA-xv9x-fj9g-vj6h
Referenced CVEs
| CVE | CSIRTS overview | External |
|---|---|---|
| CVE-2026-58438 | coverage & exploitation status | NVD · CVE.org |
Same CVEs, other sources
How other CERTs, PSIRTs and databases cover the vulnerabilities in this advisory.
- high[NEW] [high] Gitea: Multiple vulnerabilitiescert-bund
More from GitHub Security Advisories
- mediumGHSA-jr6p-8pjj-mfx6: Capsule has an incomplete fix of CVE-2026-22872: TenantResource RawItems and Generators s…2026-07-31
- mediumGHSA-68cj-mvg9-rgm2: Capsule: CapsuleConfiguration NodeMetadata regex fields lack webhook validation, allowing…2026-07-31
- mediumGHSA-ff84-5f28-78qj: re2: Out-of-bounds heap read in `exec`/`test`/`match` via attacker-influenced `lastIndex`…2026-07-31
- mediumGHSA-6hxr-mr5r-9836: re2: Global `String.prototype.match` with an empty-matchable pattern never advances → inf…2026-07-31
- mediumGHSA-x83g-979r-f5fh: Sylius Mollie Plugin has unauthenticated IDOR that leaks order token and customer PII2026-07-31