---
id: "CVE-2026-129341"
page: "https://infrastack.ai/live/CVE-2026-129341"
kind: "vulnerability"
aliases: ["CVE-2026-129341", "GHSA-jr33-w6w7-86vj"]
title: "DeleteAttachment lets former writers delete release assets they uploaded"
severity: "medium"
cvss: null
epss: null
exploited: false
status: "open"
category: "package"
products: [{"name": "gitea.dev", "fixed": ["28.4.0"], "affected": ">= 1.11, <= 28.3.0", "ecosystem": "go"}]
ecosystems: ["go"]
tags: ["cwe-863", "gitea", "package", "releases", "self-hosted"]
not_affected_if: ["default-config-no-former-writers", "gitea-28.4.0-or-later"]
published_at: "2026-11-15T21:03:15+00:00"
first_seen_at: "2026-11-15T21:12:47+00:00"
updated_at: "2026-11-15T21:14:19+00:00"
sources: [{"source": "ghsa-repo", "url": "https://github.com/go-gitea/gitea/security/advisories/GHSA-jr33-w6w7-86vj", "first_seen_at": "2026-11-15T21:12:47+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-129341", "first_seen_at": "2026-11-15T22:40:23+00:00"}]
exploit_sources: []
---

# DeleteAttachment lets former writers delete release assets they uploaded

Link for people: https://infrastack.ai/live/CVE-2026-129341 (this .md is for agents)

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.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- go:gitea.dev affected >= 1.11, <= 28.3.0 fixed 28.4.0

## How to check

- Check the Gitea version with `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.
- Look in the release-attachment history of repositories for assets uploaded by accounts that no longer have write access.

## Fix

- Gitea: move to `28.4.0` or later.

## Timeline

- 2026-11-15T21:12:47+00:00 ghsa-repo https://github.com/go-gitea/gitea/security/advisories/GHSA-jr33-w6w7-86vj
- 2026-11-15T22:40:23+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-129341

## Documents

- [advisory] Maintainer's advisory: github.com https://github.com/go-gitea/gitea/security/advisories/GHSA-jr33-w6w7-86vj
- [fix] Release notes: github.com https://github.com/go-gitea/gitea/releases/tag/v28.4.0

## From the sources

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.

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.

## Details

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:

```go
// 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:

```go
// 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:

```go
// 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:

- Private repository in an organization, mallory in a team whose Releases permission is lowered from write to read
  after her upload: the API and the release route refuse her, the issue route deletes the asset, and the file
  disappears from `data/attachments/`.
- `/pulls/attachments/remove` behaves like `/issues/attachments/remove`.
- With the Issues unit disabled and pull requests enabled, the issue route still deletes; with both units disabled it
  is `404`.
- An asset of the same release uploaded by alice is `403` for mallory on the issue route: the reach is limited to
  assets the attacker uploaded.

## Impact

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

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
