/

CVE-2026-135164

Severity:

HIGH RISK

(8.8)

SQL Injection (CWE-89) in Formance Ledger API Endpoints

CVE-2026-135164

Received

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Database query execution with the ledger database role's privileges

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Formance Ledger can treat unvalidated account expansion values as SQL when processing API requests. A remote caller who can reach the affected API may inject SQL through the expand query parameter or a base64 pagination cursor, potentially exercising the database role's permissions.

Affected context

The issue is described in Formance Ledger 2.2.0-beta.3 and earlier releases before 2.4.18. It occurs in API handling for account expansion and pagination when caller-supplied values are incorporated into SQL without adequate validation or safe parameterization. The practical exposure depends on whether the affected API is reachable and on the privileges assigned to its database role.

Exploit preconditions

  • Attack surface: Formance Ledger API endpoints that process account expansion or pagination
  • Required access: Ability to send requests to an affected API; the description does not specify whether authentication is required
  • Trigger point: Processing an unvalidated expand query parameter or base64 pagination cursor
  • Why exploitation is possible: Caller-controlled values can influence SQL execution, which runs with the ledger database role's privileges

Why this happens

The underlying issue is SQL injection, mapped to CWE-89: Improper Neutralization of Special Elements used in an SQL Command. The vulnerable pattern occurs when input is incorporated into a SQL statement without reliably separating data from query structure. Validation alone may not establish that input is safe for SQL; parameterized queries and constrained query construction help preserve that separation.

Potential impact

  • An attacker may execute SQL with the ledger database role's privileges.
  • Depending on database permissions, queries could expose or alter ledger data.
  • Data integrity or service availability could be affected by unauthorized database operations.
  • The scope of impact could extend to other accessible database objects if the role has broader privileges.

General mitigation guidance

Mitigation generally focuses on ensuring user-controlled values cannot become SQL syntax.

  • Use parameterized queries or safe query-building APIs for all caller-controlled values.
  • Prefer allowlisted, typed options for expansion fields and pagination inputs.
  • Treat encoded cursors as untrusted input; validate their structure and integrity before use.
  • Apply least privilege to the ledger database role and limit access to the API surface.
  • Avoid relying on input filtering as a substitute for separating SQL code from data.

How teams detect issues like this

  • Use static analysis to identify SQL statements assembled through string concatenation, interpolation, or formatting with request-derived values.
  • Review account expansion and pagination code paths for unsafe query construction and incomplete validation.
  • Enforce repository policies requiring parameterized SQL and security review for database access changes.
  • Monitor API and database telemetry for unusual query patterns or unexpected use of expansion and cursor parameters.
  • Automated code review tools may help flag risky SQL construction patterns.

Sources

SourceLink
github.comgithub.com/formancehq/ledger/blob/v2.4.17/internal/storage/ledger/resource_accounts.go
github.comgithub.com/formancehq/ledger/commit/83cd8dc7a66ba02a0418a36ec45663b19e26dcb3
github.comgithub.com/formancehq/ledger/pull/2477
github.comgithub.com/formancehq/ledger/releases/tag/v2.4.18
vulncheck.comvulncheck.com/advisories/formance-ledger-2.2.0-beta.3-before-2.4.18-sql-injection-via-account-expand-parameter

Frequently asked

questions

The vulnerability is described as reachable through remote API requests. Exploitation depends on access to an affected endpoint and the deployment's exposure controls.

The available description does not establish whether authentication is required. The key condition is whether a caller can submit requests to the affected API.

Keep SQL structure separate from caller-provided values by using parameterized queries or safe query-building APIs, and constrain accepted expansion and cursor inputs.

Apply secure query-construction practices consistently, review request-derived data flows into database calls, and use least-privilege database roles.

Find out what's already
exploitable in your codebase.