GITEA.DEV · CVE-2026-129341 · Package
FIX → 28.4.0
A user who uploaded a release asset while holding Releases write access can still permanently delete it after that access is revoked, using the issue or pull request attachment-removal route. The row and the stored file are both removed, so the download breaks for everyone.
first public Nov 15, 2026 · 2 sources
Check it with your coding agent
It reads this page and tells you if your code or app is affected.
Self-hosted Gitea instances where a user who once had Releases write on a repository uploaded release assets and still has read access to its issues or pull requests. Public repositories are reachable by any account that still exists. Instances that do not host release assets from former collaborators are less exposed.
Not affected if default-config-no-former-writers, gitea-28.4.0-or-later
Who cares gitea, releases, self-hosted
gitea --version or the footer of the web UI; versions 28.3.0 and earlier, and from 1.11 onward, are in the affected range.Upgrade to 28.4.0
28.4.0 or later.A user who uploaded a release asset while they had Releases write access can still permanently delete that asset after their write access has been revoked or lowered to read. They only need to be able to read the repository's issues or pull requests. The web handler DeleteAttachment skips every permission check when the doer is the attachment's uploader, and it is also mounted at /{owner}/{repo}/issues/attachments/remove and /pulls/attachments/remove, which require only read access. Both the database row and the stored file are removed, so the asset's download link returns 404 for everyone.
In routers/web/repo/attachment.go, the per-link checks (including CanWrite(unit.TypeReleases) for release assets) all sit inside if ctx.Doer.ID != attach.UploaderID. For the uploader, ctx.Repo.Permission is never consulted. The release registration hides this, because /releases/attachments/remove sits behind reqRepoReleaseWriter and the API route requires reqRepoWriter(unit.TypeReleases). The issue and pull registrations accept any attachment UUID in the repository, though, and the UUID is returned by the release API for every asset.
Are you affected?
Ask from here. InfraStack checks the affected versions against your stack and answers in your inbox.
InfraStack checks the affected versions against your stack and answers in Slack, with the evidence and the fix.
InfraStack checks it against your stack and answers on your report, with the evidence and the fix.
The attached reproducer runs on default settings. It has mallory upload app.bin to alice/app v1.0 as a write collaborator, then has alice remove her. At that point mallory's requests get a 403 from the API and a 404 from the release route. The same form posted to /alice/app/issues/attachments/remove returns 200, after which the release lists no assets and the file is gone from data/attachments/.
The reach is limited. It covers only assets that the attacker's own account uploaded, and other accounts get 403. It is delete-only: nothing can be added, replaced or read. A collaborator fully removed from a private repository is locked out, but on a public repository the condition holds as long as the account exists.
The uploader shortcut dates from 8c909820a9fd (#8426, first released in v1.11.0). fbea2c68e8 ("Fix delete attachment check", #36320) added the RepoID and per-link checks only in the non-uploader branch, so this is the part of that fix that remained open.
Scanned commit 31626de2a6cdd3e1fe93216e4ac80f511297f1e7, default configuration. Attacker: a regular signed-in user who
uploaded a release asset while they had Releases write on a repository, has lost that permission since (removed
collaborator, removed team member, team lowered to read) and can still read its issues or pull requests, which on a
public repository every account can.
The web handler DeleteAttachment skips all permission checks when the doer is the attachment's uploader, and it is
mounted on a route that only requires read access. Whoever uploaded a release asset can delete it for good, whatever
their permissions are today.
On an instance where mallory uploaded app.bin to release v1.0 of the public repository alice/app while she was a
write collaborator, and alice has removed her since (mallory's permissions on the repository are pull only):
DELETE /api/v1/repos/alice/app/releases/1/assets/1 as mallory answers 403;POST /alice/app/releases/attachments/remove with file=<uuid of app.bin> in mallory's web session answers 404;POST /alice/app/issues/attachments/remove with the same form in the same session answers
200 {"uuid":"…"}. The release then lists no assets and /alice/app/releases/download/v1.0/app.bin is 404 for
everyone.The same request from eve, who never had write access, is 403.
The handler looks at what the attachment is linked to only inside the "not the uploader" branch:
// routers/web/repo/attachment.go:95
if attach.RepoID != ctx.Repo.Repository.ID {
ctx.HTTPError(http.StatusBadRequest, "attachment does not belong to this repository")
return
}
if ctx.Doer.ID != attach.UploaderID {
if attach.IssueID > 0 {
… CanWriteIssuesOrPulls(issue.IsPull), else 403 …
} else if attach.ReleaseID > 0 {
if !ctx.Repo.Permission.CanWrite(unit.TypeReleases) {
ctx.HTTPError(http.StatusForbidden)
return
}
} else {
… IsAdmin() or IsOwner(), else 403 …
}
}
err = repo_model.DeleteAttachment(ctx, attach, true)
UploaderID is written once, when the bytes arrive (routers/api/v1/repo/release_attachment.go:247 for the API used
above, routers/web/repo/attachment.go:63 for the web upload), and records a past event. ctx.Repo.Permission is the
doer's current right, and for the uploader it is never consulted. The shortcut fits the poster of an issue or comment
who removes a file from their own post, or from the upload box before submitting. A release asset is not the
uploader's post: it belongs to the repository's release.
The handler is registered twice. The release registration hides the problem, because the group itself requires the write permission:
// routers/web/web.go:1514
m.Post("/attachments/remove", repo.DeleteAttachment)
}, reqSignIn, context.RepoMustNotBeArchived(), reqRepoReleaseWriter)
The issue and pull registrations only require read access, and the handler does not care which kind of attachment the UUID names:
// routers/web/web.go:1385 (inside addIssuesPullsUpdateRoutes)
m.Post("/attachments", repo.UploadIssueAttachment)
m.Post("/attachments/remove", repo.DeleteAttachment)
…
// routers/web/web.go:1399
m.Group("/{type:issues}", addIssuesPullsUpdateRoutes, context.RequireUnitReader(unit.TypeIssues, unit.TypePullRequests), context.RepoMustNotBeArchived())
m.Group("/{type:pulls}", addIssuesPullsUpdateRoutes, reqUnitPullsReader, context.RepoMustNotBeArchived())
}, reqSignIn, context.RepoAssignment, context.RepoMustNotBeArchived()) // :1431
So the path of mallory's request is: reqSignIn → RepoAssignment → RepoMustNotBeArchived →
RequireUnitReader(Issues, PullRequests) → DeleteAttachment → attach.RepoID matches → Doer.ID == UploaderID, the
whole permission block is skipped → repo_model.DeleteAttachment(ctx, attach, true), which deletes the row and, because
of remove == true, the stored file (models/repo/attachment.go:184-208). The API twin has no such shortcut; its route
carries reqRepoWriter(unit.TypeReleases) (routers/api/v1/api.go:1478).
The UUID is not a secret: the uploader received it in the upload response, and the release API returns it in the
uuid field of every asset.
The uploader shortcut dates from 8c909820a9fd ("Enable Uploading/Removing Attachments When Editing an Issue/Comment
(#8426)", 2019-10-15), first released in v1.11.0. fbea2c68e8 ("Fix delete attachment check (#36320)") later added the
RepoID check and the per-link permission checks, but only inside the ctx.Doer.ID != attach.UploaderID branch, so
for the uploader the path is still the one from 2019.
Also observed on a running instance, beyond what the reproducer shows:
data/attachments/./pulls/attachments/remove behaves like /issues/attachments/remove.404.403 for mallory on the issue route: the reach is limited to
assets the attacker uploaded.Revoking or lowering someone's write access does not end their control over the release assets they uploaded. Only
the account that uploaded an asset while it held Releases write can do this, and only while that account can still
read the repository's issues or pull requests and the repository is not archived: on a public repository that holds as
long as the account exists, while a collaborator fully removed from a private repository is locked out. Any other
account, including one that never had write access, gets 403. Under th
NVD data is provided by NIST and is public domain. Posts quoted belong to their authors.