GHSA-3X3M-2J93-W46J
Unbounded avatar size cache exhausts server memory
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-3X3M-2J93-W46J divulgada · CVSS 6.5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The avatar endpoint keeps a separately resized copy of each user's avatar for every distinct `size` it's asked for, and nothing evicts or expires them. Since `size` is only clamped to the configured maximum (default 1024), any logged-in user can make one uploaded avatar occupy around a gigabyte of memory, freed only on restart or when that user changes their avatar.
Details
`size` is clamped to `service.maxavatarsize` (default 1024, `pkg/config/config.go:396`; `pkg/modules/avatar/avatar.go:98`). `upload.go:65` rejects `size<=0` and v2 enforces `minimum:"1"` (`v2/avatar.go:39`), so each account gets about 1024 distinct cache keys. `RememberValue` → `Put` stores them without a TTL (`pkg/modules/keyvalue/keyvalue.go:133-155`), and the memory store's sweep only walks TTL'd keys (`pkg/modules/keyvalue/memory/memory.go:79-88`).
Proof of concept
`upload.Provider.GetAvatar` caches under one key per size (`avatar_upload_<userID>_<size>`) via `keyvalue.RememberValue`, which stores with `Put` and no TTL; the default in-memory store is a plain map with no size cap and no eviction. A noisy PNG stays near 3 bytes per pixel, so sizes 1 to 1024 sum to about 1 GiB.
On a default `vikunja/vikunja:2.7.0` instance (open registration, rate limiting off, in-memory keyvalue):
API=http://host/api/v1
# Log in as any user, upload a 1024x1024 noise image as your avatar:
curl -X PUT -H "Authorization: Bearer $TOKEN" -F avatar=@noise.png $API/user/settings/avatar/upload
# Fetch your own avatar once at each allowed size (~1024 GETs):
curl -H "Authorization: Bearer $TOKEN" "$API/avatar/$USERNAME?size=[1-1024]"Resident memory climbed from about 30 MiB to about 1.8 GiB for that one account, repeating the same sizes added nothing, and it stayed put while idle. A 1.5 GB instance was OOM-killed partway through a single sweep. The 2.6.0 pixel-cap change (GHSA-4vh2) bounds a single decode, not the number of cached copies.
Impact
Any authenticated user can exhaust a default instance and get the API process OOM-killed, and registration is open by default, so each extra account adds roughly another gigabyte. A link-share token can do the same against any user's uploaded avatar. Rate limiting is off by default; with it on at the default 100 a minute, one account still fills its gigabyte in about ten minutes.
Fix
Map `size` to a small discrete allowlist before it reaches the cache key, in the shared `GetAvatarForUsername` (`pkg/modules/avatar/avatar.go`), as `GetPreviewSizeFromString` does for task-attachment previews. Doing it there also bounds the gravatar provider's per-size cache, which has the same problem with negative and zero sizes on v1.
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-3x3m-2j93-w46jLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
