GHSA-WQJR-22R7-5437
Trello, Todoist and Microsoft To Do migrations buffer remote downloads and API responses without limits, enabling in-process API OOM
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-WQJR-22R7-5437 divulgada · CVSS 6.5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
The Trello and Todoist migration importers download board backgrounds, card attachments, card covers, and note attachments into unbounded in-memory `bytes.Buffer`s and retain every blob on the in-memory `ProjectWithTasksAndBuckets` hierarchy until the entire account is converted. The underlying HTTP client (`NewSSRFSafeHTTPClient`) caps only the per-request *duration* (30s), not the response *size*, so any authenticated user who initiates a migration whose remote JSON references a huge attacker-served attachment can drive the shared API process into OOM. The same users can also OOM it with huge API responses: the Todoist and Microsoft To Do migrators decode success responses with no size cap, and the Todoist cursor loops have no aggregate item cap. This is the direct, unfixed sibling of the Planka importer OOM fixed as GHSA-wq92-8x3r-fm38 — the Planka fix added a `DownloadFileWithHeadersLimited` + per-import byte budget, but those were never ported to the Trello and Todoist code paths.
Root Cause
`pkg/modules/migration/helpers.go:63` reads the full response body with no size limit:
_, err = buf.ReadFrom(resp.Body)Both `DownloadFile` (helpers.go:51) and `DownloadFileWithHeaders` (helpers.go:56) call this unbounded path. The hardened sibling `DownloadFileWithHeadersLimited` (helpers.go:69) uses `io.LimitReader(resp.Body, maxBytes+1)` and is called only from the Planka importer (`pkg/modules/migration/planka/client.go:624`).
Trello calls bare `DownloadFile`/`DownloadFileWithHeaders`:
- `pkg/modules/migration/trello/trello.go:259` — board background
- `pkg/modules/migration/trello/trello.go:341` — card attachment (sends the OAuth token in headers)
- `pkg/modules/migration/trello/trello.go:377` — card cover
Todoist calls bare `DownloadFile`:
- `pkg/modules/migration/todoist/todoist.go:522` — note attachment
Each downloaded blob is retained as `FileContent: buf.Bytes()` on the in-memory structure (trello.go:353, :388; todoist.go:538) for the entire conversion. The configured `files.maxsize` limit is only enforced downstream in `InsertFromStructure` (trello.go:518, todoist.go:808) — *after* every attachment has already been resident in RAM.
The HTTP client (`NewSSRFSafeHTTPClient`, `pkg/httpclient/httpclient.go:50` → `newHTTPClient:59`) sets only `Timeout` (default 30s) and no response-size cap.
API responses are unbounded on the success path too (the 4xx paths in `DoGetWithClient`/`DoPostWithHeaders` are already capped, `helpers.go:137,181`):
- Todoist: `json.NewDecoder(resp.Body).Decode` at `todoist.go:600,649,673,716,754,783`.
- Microsoft To Do: token decode at `microsoft_todo.go:182`; `makeAuthenticatedGetRequest` reads the whole body of a raw `client.Do` with `buf.ReadFrom` (:200) and then `json.Unmarshal`s it (:216).
- The Todoist cursor loops (`todoist.go:661-729`, `:742-765`) accumulate every page with no aggregate item cap.
Planka is bounded.
Impact
Memory-exhaustion DoS of the shared Vikunja API process. Migration runs on the in-process watermill `gochannel` pub/sub (`pkg/events/events.go:92`), so an OOM kill terminates the whole API for all tenants, not an isolated worker. A single oversized stream and/or many simultaneously-retained attachments drive RSS up until the kernel OOM-killer or the configured limit terminates the process.
Proof of Concept
Precondition: on an instance where `migration.trello.enable=true` (or `migration.todoist.enable=true`) and the admin has registered the OAuth app key — i.e. the standard import feature is enabled.
- Attacker (any authenticated Vikunja user) prepares a Trello board under their own Trello account containing a single card attachment pointing at a large attacker-controlled URL, e.g. `https://attacker.example/huge` which streams multi-GB of random bytes.
- Attacker authorizes Vikunja against their own Trello account via the normal OAuth flow and POSTs `/api/v2/migration/trello/migrate` (JWT-authenticated).
- Vikunja fetches the board JSON, then for each attachment calls `migration.DownloadFileWithHeaders(attachment.URL, …)` (trello.go:339) → `getFile` → `buf.ReadFrom(resp.Body)`.
- `attacker.example` is a public host, so the SSRF client allows the request; the client has no byte cap; `buf.ReadFrom` streams the whole body into memory.
- API process RSS climbs until OOM kill → full outage.
Attack Chain
- Entry. POST `/api/v2/migration/trello/migrate` (or `/todoist/migrate`), authenticated.
- Guard. JWT auth; `migration.{trello,todoist}.enable=true` (default false) + admin-registered OAuth app key.
- Bypass proof. The feature flag is an admin decision to enable a normal product feature. Once enabled, any authenticated user may migrate their own account. This is the identical precondition as the published Planka advisory (GHSA-wq92-8x3r-fm38, HIGH).
- Attacker-controlled URL. The remote Trello/Todoist account references `https://attacker.example/huge`.
- Guard. Todoist's `isDownloadableURL` (todoist.go:325) checks only `scheme ∈ {http, https}` and non-empty host. Trello has no URL filter at all.
- Bypass proof. Read of the function — no size cap, no host allowlist. Attacker-controlled URL passes trivially.
- Fetch via SSRF-safe client.
- Guard. `NewSSRFSafeHTTPClient` blocks non-globally-routable IPs; sets `Timeout: 30s`.
- Bypass proof. `attacker.example` is a public host; SSRF guard is irrelevant. `httpclient.go:59-68` sets no `MaxBytesReader`/`LimitReader`. At 100 Mbit/s, 30s = ~375 MB in one buffer; on faster links multi-GB.
- Sink: unbounded buffer read. `buf.ReadFrom(resp.Body)` at `pkg/modules/migration/helpers.go:63`.
- Guard. Should be `DownloadFileWithHeadersLimited` + per-import `budget` as Planka has.
- Bypass proof. `grep -n "Limited\|budget\|LimitReader" pkg/modules/migration/trello/trello.go pkg/modules/migration/todoist/todoist.go` returns empty. `files.maxsize` is enforced only inside `InsertFromStructure`, downstream of every download — cannot interrupt the download-phase OOM.
- Impact. Blobs retained as `FileContent: buf.Bytes()` across the in-memory hierarchy; API process OOM-kills under in-process gochannel execution → outage for all tenants.
Bypass Evidence
- `pkg/modules/migration/helpers.go:63`:
- `pkg/modules/migration/helpers.go:81` (hardened sibling, not called from Trello/Todoist):
- `grep -rn "DownloadFileWithHeadersLimited\|budget" pkg/modules/migration/{trello,todoist}/` → no matches.
- `git log v2.7.0..HEAD -- pkg/modules/migration/` → no fix post-release.
- GHSA-wq92-8x3r-fm38 description references only `pkg/modules/migration/planka/*`; the fix was Planka-scoped, Trello/Todoist code paths are untouched.
Affected Versions
- Package: `code.vikunja.io/api` (ecosystem: `go`)
- Vulnerable: `<= 2.7.0` (HEAD at commit `6263ff1`, `v2.7.0-7-g6263ff1`)
- No fix released or on `main` for Trello/Todoist as of this report.
Suggested Fix
Mirror the Planka hardening to Trello, Todoist and Microsoft To Do:
1. Replace each `migration.DownloadFile(url)` / `DownloadFileWithHeaders(url, headers)` call in `trello.go` and `todoist.go` with `migration.DownloadFileWithHeadersLimited(hc, url, headers, maxBytes)` (`helpers.go:69`) where `maxBytes` is `files.maxsize` (or a lower per-attachment cap). The Trello card-attachment download (`trello.go:341`) sends the OAuth token, so it needs a redirect-refusing client (see `helpers.go:68`); Go replays the headers across hosts otherwise.
2. Decode every success-path API response with `DecodeJSONLimited` (`helpers.go:204`), including Microsoft To Do's `makeAuthenticatedGetRequest`.
3. Add an aggregate item cap across the Todoist cursor loops.
4. Introduce a per-import byte budget on `trelloMigration`/`todoistMigration` structs (analogous to Planka's `budget` on `client.go:612-634`) and decrement it on each download; abort the migration with a clear error when exceeded, before buffering further blobs.
5. Optionally stream directly into the files store instead of buffering `FileContent` into memory.
Credit
zx (Jace) — GitHub: @manus-use
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-wqjr-22r7-5437Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
