GHSA-WFQM-H27Q-W8QR
Deleted-account JWT opens an empty-identity realtime session after an account lookup error is lost
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-WFQM-H27Q-W8QR divulgada · CVSS 3.7 (GitHub) | |
| Remediación | Parche v0.13.45 | github.com/daptin/daptin · 0 d desde divulgación | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
A valid, unexpired JWT for a deleted Daptin account can produce a non-nil session with internal user ID zero, an all-zero reference UUID, and no groups when the authentication cache misses. This empty identity passes the presence-of-authentication checks used by realtime endpoints.
Maintainers reproduced the behavior on an isolated local instance using the normal resource API to delete the account, followed by a restart to clear authentication caches. This is an authentication lifecycle bug, not an administrator permission misconfiguration.
Preconditions and confirmed scope
The caller must already possess a cryptographically valid, unexpired JWT for an account that has subsequently been deleted. The reproduced token has `auth_version=1`, and the account lookup occurs after an authentication-cache miss. Deleting the account is an authorized offboarding operation, not an attacker capability demonstrated by this report.
The confirmed impact is an empty-identity session opening on `/live`, where an anonymous caller receives an unauthorized frame. Original-user impersonation, administrator access, additional REST privileges, Yjs document access or CRDT operations, and WebSocket operations beyond the session-open frame have not been established.
Root cause
In `server/auth/auth.go`, `AuthCheckMiddlewareWithHttp` overwrites the result of `rowx.Scan(...)` with `stmt1.Close()`. When the account is absent, `Scan` returns `sql.ErrNoRows`, but a successful statement close replaces that error with nil. Authentication continues with zero-valued lookup destinations.
`AuthVersionOrDefault(0)` returns 1, which matches a fresh version-1 token. The middleware creates and attaches the empty `SessionUser`. The realtime endpoint's non-nil session check then succeeds despite the absence of a persisted account.
The error overwrite was introduced by 73306a1b https://github.com/daptin/daptin/commit/73306a1b, dated October 1, 2024, while replacing deferred statement cleanup. Preserving the scan error alone is insufficient: the old error branch attempts account and group provisioning. Failed authentication must reject the request rather than attempt to recreate an account.
Reproduction and observed responses
- Complete first-administrator onboarding on a fresh instance.
- Provision an ordinary account and sign in to obtain its JWT.
- Confirm that `/live` opens a session identifying that account.
- Delete the account through the administrator's JSON:API `user_account` resource.
- Restart against the same database and retry with the deleted account's JWT.
Before the fix:
| Request | Observed result |
|---|---|
| `/live` WebSocket, no token | Upgrade succeeds, followed by an unauthorized frame |
| `/live` WebSocket, deleted account's JWT | Session-open frame with UUID `00000000-0000-0000-0000-000000000000` and no groups |
| Plain GET of a noncanonical Yjs room, no token | HTTP 403 |
| Same Yjs GET with deleted account's JWT | HTTP 400 from the upgrade path |
The Yjs HTTP 400 proves that the authentication gate was crossed; it does not establish document access. A WebSocket HTTP 101 alone is not the distinguishing evidence for `/live`; the session-open frame is.
Affected versions
The reporter identified source commit `4b2e5ffdb31cb2dd20a9c6569263888246603181` as v0.13.2. Maintainers also reproduced the bug on source based on `dec3fee4` before applying the local fix. The affected lookup pattern is also present in the v0.13.44 release and was introduced before the v0.11.4 tag. Versions before 0.13.45 are treated as affected; every earlier tag has not been independently reproduced. The report's original `<= 0.13.2` range does not imply that newer releases are unaffected.
Fix status
The fix is committed as c96e96e5 https://github.com/daptin/daptin/commit/c96e96e5 and pushed to `master`. The fix is released in v0.13.45 https://github.com/daptin/daptin/releases/tag/v0.13.45. Upgrade to v0.13.45 or later.
The fix:
- Preserves account lookup errors independently of statement cleanup and rejects missing accounts or failed lookups.
- Rejects invalid persisted reference IDs and empty cached identities before attaching a session.
- Removes account/group provisioning from authentication lookup-error handling. Configured OAuth provisioning remains in the existing OAuth login action workflow.
- Invalidates the authentication cache directly when the `user_account` resource is deleted, independently of group-membership removal.
The fix remains in the shared authentication and resource-deletion paths. It does not add separate permission checks to each realtime transport.
Validation
`TestDeletedUserJWTRevocationRealE2E` starts real local Daptin processes, obtains and uses the ordinary user's token to warm authentication state, and deletes the account through the resource API. With the fix, the old token returns HTTP 401 on `/live` upgrade attempts, Yjs, and REST both immediately after deletion and after restart. A valid administrator still authenticates, and repeated old-token requests do not recreate the deleted account.
Authentication unit tests cover missing accounts without provisioning, malformed stored references, scan and lookup failures, an empty cached identity, valid database lookups, valid cache hits, and existing token-version rejection. Resource, action, permission, and focused OAuth/Yjs tests, resource/auth `go vet`, and diff checks passed. The existing DAV test passed its Basic Auth principal check but failed later on calendar-description handling; the same failure was reproduced with unchanged HEAD code and is unrelated to this fix.
Operational notes
Clearing authentication caches or restarting alone is not a mitigation for the underlying bug: the reproduced empty-identity session occurs on a cache miss. Do not rely on cache expiry to revoke these requests. Deploy v0.13.45 or later.
The fix rejects subsequent authentication attempts. It does not disconnect connections that were already open when an account was deleted.
Coordination and credit
Report FO-DAPTIN-2026-002 by Wenhao Wu, Southeast University (`d3do-23`). The report states a coordinated-disclosure deadline of January 11, 2027. The accepted report is published with the v0.13.45 security release. The reported low severity is retained.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
gogithub.com/daptin/daptin |
Corregida | v0.13.45 | 0 d | v0.13.57 no afectada |
0.13.45v0.13.45Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/daptin/daptin/security/advisories/GHSA-wfqm-h27q-w8qrLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
