GHSA-VGHX-GP7M-XPX2
CSRF: Milestone open/close via GET request (CWE-352)
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-VGHX-GP7M-XPX2 divulgada | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Vulnerability Details
File: `cmd/gogs/internal/web/web.go` (route registration), `internal/route/repo/issue.go:1228` (`ChangeMilestonStatus`)
Line: `cmd/gogs/internal/web/web.go:431`
CWE: CWE-352 — Cross-Site Request Forgery (CSRF)
Severity: Low
CVSS: 4.3 — CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:N
### Root Cause
`ChangeMilestonStatus` performs a state-changing operation (closing or
reopening a repository milestone) and is registered as a `GET` route:
m.Group("/milestones", func() {
...
m.Get("/:id/:action", repo.ChangeMilestonStatus) // action = "open" | "close"
m.Post("/delete", repo.DeleteMilestone)
}, reqRepoWriter, context.RepoRef())CSRF token protection (`[session] CSRF_COOKIE_NAME`) was removed from
`main` in PR #8300. The session cookie set by `go-macaron/session`
(`i_like_gogs`) is `HttpOnly; SameSite=Lax` but does not carry any CSRF
token. Under `SameSite=Lax`, the cookie is still sent on a top-level GET
navigation (e.g. the victim clicking a link, or any redirect that results
in a top-level navigation). Because the milestone status change is wired
to `GET`, no token, `Origin`, or `Referer` check is performed, a single
crafted link is sufficient to trigger the state change while the victim is
authenticated.
This is the same class of bug recently fixed in PR #8321 ("Organization
team and member management actions accepted GET requests"), which appears
to have missed this handler.
### Attack Scenario
1. Victim is signed in to a Gogs instance and has write access to
`owner/repo` (collaborator, or org member with write-level team access).
2. Attacker sends the victim a link, e.g.:
`https://gogs.example.com/owner/repo/milestones/3/close`
3. Victim clicks the link while logged in. The browser performs a
top-level GET navigation and sends the `SameSite=Lax` session cookie.
4. `ChangeMilestonStatus` runs with the victim's session and calls
`database.ChangeMilestoneStatus(m, true)`, closing (or reopening, via
`/open`) the milestone without the victim's intent.
### Impact
Unauthorized opening/closing of repository milestones triggered by a
single link click from any authenticated repo writer. No data loss or
privilege escalation, but it is a genuine state-changing CSRF on a `GET`
endpoint in code that has otherwise just had this exact class of issue
fixed elsewhere (#8321).
Vulnerable Code
m.Get("/:id/:action", repo.ChangeMilestonStatus)<a href="{{$.Link}}/{{.ID}}/close" data-id={{.ID}} data-title={{.Name}}>...</a>### Recommended Fix
Require `POST` for the status-change route (consistent with the existing
`DeleteMilestone` route) and update the UI to submit it via `$.post`
instead of a plain link:
m.Post("/:id/:action", repo.ChangeMilestonStatus)<a href="#" class="link-action" data-url="{{$.Link}}/{{.ID}}/close" data-id={{.ID}} data-title={{.Name}}>...</a>$(".link-action").click(function() {
$.post($(this).data("url")).done(function() {
window.location.reload();
});
return false;
});### Verification
Dynamically confirmed on `gogs/gogs:edge` (build commit
`515f45ae00db60b996aedb9e2c03fbbdb80cfd09`, matching `main` HEAD) in a
Docker lab on 2026-06-10:
- Created repo `gogsadmin/testrepo`, milestone "Test Milestone" (id=1, open).
- Sent `GET /gogsadmin/testrepo/milestones/1/close` with only the session
cookie and forged cross-site `Origin`/`Referer` headers (simulating a
cross-site top-level navigation under `SameSite=Lax`). No CSRF token or
`X-XSRF-TOKEN` header was sent.
- Server responded `302 Found` to `/gogsadmin/testrepo/milestones?state=closed`,
and the milestone was confirmed closed (moved from the open list to the
closed list) — proving the GET request alone mutated state.
A fix has been prepared (branch `fix/milestone-status-csrf`, commit
`9b2affe28`) and can be shared for review.
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
gogogs.io/gogs |
Sin parche | — | — | v0.13.3 afectada |
0.15.0Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/gogs/gogs/security/advisories/GHSA-vghx-gp7m-xpx2Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
