GHSA-4QVP-948J-4CGV
Revoked session's access token keeps working and can mint new credentials
CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-4QVP-948J-4CGV divulgada · CVSS 6.8 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
When a user's session is revoked — via logout, "revoke sessions", password reset, or an administrator disabling the account (all of which delete the session rows) — an already-issued HTTP access token (JWT) keeps working until it expires (default `jwtttlshort`, 600s). In that window it can also mint durable credentials that outlive the revocation: a renewable ~72h OAuth session (`POST /oauth/authorize` with the public client and a self-generated PKCE verifier) and a `tk_` API token with any expiry, which survives logout and password change. The HTTP auth middleware validates only the token's signature and expiry; it does not verify that the session referenced by the token's `sid` claim still exists, nor that the account is still active. The WebSocket path does perform this check (`CheckUserTokenSession`), so the protection is inconsistent. Confirmed on v2.7.0: after deleting ALL of an account's sessions, the token still returns 200 and reads private data. Not unauthenticated access and not token forgery — it requires an already-valid token. Discovered with AI assistance (disclosed) and reproduced on an isolated self-hosted lab.
Details
- `SetupTokenMiddleware` (`pkg/routes/api_tokens.go:40`) verifies the JWT signature and expiry only (via echojwt).
- `GetUserFromClaims` (`pkg/user/user.go:547`) builds the authenticated user purely from the signed claims — no session or account-status lookup.
- The token carries the session UUID as the `sid` claim (`pkg/modules/auth/auth.go:197`). `ParseUserToken` (`pkg/modules/auth/auth.go:309`) explicitly notes it "skips the session check: a valid result may belong to a revoked session."
- By contrast, `CheckUserTokenSession` (`pkg/modules/auth/auth.go:346`) looks up the session row and validates ownership/status — but it is used by the WebSocket auth path only.
So session/account revocation is enforced for WebSocket connections but not for ordinary HTTP API requests during the token's lifetime.
Credential minting from a revoked token:
- `/oauth/authorize` authenticates via `GetCurrentUser` (`pkg/modules/auth/oauth2server/authorize.go:61`), and `exchangeAuthorizationCode` calls `CreateSession` (`token.go:120,145,178`), so the revoked JWT yields a fresh, refreshable session.
- API token creation is a normal authenticated route. Logout and password change only call `DeleteAllUserSessions` (`pkg/models/sessions.go:231`) and never revoke API tokens.
- `sid` is stable across refresh (`auth.go:466`). Link-share JWTs carry no `sid`.
Impact
For up to the access-token lifetime (~10 minutes by default), a holder of a valid access token retains full authenticated HTTP access AFTER:
- the user logs out or revokes all sessions,
- the user resets their password (which deletes sessions),
- an administrator disables/locks the account.
More importantly, the window is enough to turn a stolen-then-revoked token into persistent access: a new ~72h renewable OAuth session, or an API token with any expiry that survives logout and password change. So "log out everywhere" after a token theft does not actually evict the attacker.
This weakens incident response: disabling a compromised or malicious account, or a user "logging out everywhere" after a token theft, does not take effect on the HTTP API, and can be outlived entirely via the mints above.
Note on intent
The comment at `auth.go:309` indicates the HTTP session-skip is a deliberate design choice (short-lived tokens, revocation via expiry). That reasoning only holds if the short-lived token can't mint longer-lived credentials, which it can, so this is a vulnerability rather than hardening.
Fix
Run `CheckUserTokenSession` on the HTTP path after `echojwt` (`pkg/routes/api_tokens.go:41`), for user tokens only. This blocks residual use and both mints.
- It takes `*UserTokenClaims` and costs 2 queries per request (session + `GetUserByID`), so cache the loaded user like `api_user`.
- `DeleteAllUserSessions` deletes by `user_id` and doesn't enumerate sids (`pkg/models/sessions.go:233`), so the cache needs user-keyed busting.
- Many tests mint `"test-session-id"` JWTs with no fixture row (`webtests/integrations.go:473`, `huma_helpers_test.go:35`, `api_tokens_test.go`, `oauth2_test.go`, `mcp_test.go`); add a fixture session.
Proof of concept
Environment: self-hosted Vikunja v2.7.0 (Docker), one account owned by the reporter. No public instance was tested.
Steps:
1. Log in as the test user and obtain an access token T. Its `sid` claim is a real, current session.
2. GET /api/v1/user with T -> 200.
3. GET /api/v1/user/sessions with T -> the token's own `sid` is listed among the sessions.
4. DELETE /api/v1/user/sessions/{id} with T for EVERY session, including the token's own.
5. GET /api/v1/user/sessions with T -> 0 sessions remain.
6. GET /api/v1/user with T -> 200 (profile). GET /api/v1/projects with T -> 200 (private data).
Control: a syntactically invalid token -> 401.
Result (confirmed on v2.7.0): with zero valid sessions for the account, the previously-issued access token still authenticates and reads private data, until it expires (~10 minutes).
The same revoked token can also `POST /oauth/authorize` (public client, own PKCE) and exchange the code for a new session, or create a `tk_` API token; both keep working after the original token expires. It requires an already-valid token; it is not unauthenticated access or token forgery.
Folded in: email-confirmation-required accounts keep tokens and OIDC login (was GHSA-4jvq-8395-647r)
Same auth gate, same fix. An admin freezes a user by setting status 1, email confirmation required (`pkg/routes/api/v2/admin_users.go:242`). Local password login is blocked, but the user's existing API/CalDAV/feed/MCP tokens keep working and OIDC login still succeeds. `finishLoadedUser` (`pkg/user/user.go:368`) rejects only Disabled/Locked; the unguarded paths are `ValidateAPITokenString` (`pkg/modules/auth/auth.go:289`, also MCP), `ValidateTokenAndGetOwner` (`pkg/models/api_tokens.go:366`, CalDAV and feeds), `checkUserCaldavTokens` (`pkg/routes/caldav/auth.go:117-148`, loads by username), OIDC login (`pkg/modules/auth/openid/openid.go:262-269`), `RefreshSession` and the OAuth code exchange.
Fix: one gate, `user.GetUserByIDForAuth` (reject Disabled/Locked/EmailConfirmationRequired), called from `CheckUserTokenSession` on the HTTP path and from every token validator and OIDC login. The CalDAV token path loads by username and needs the gate too.
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-4qvp-948j-4cgvLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
