/

CVE-2026-58376

Severity:

HIGH RISK

(7.6)

SQL Injection (CWE-89) in Dolibarr REST API Filters

CVE-2026-58376

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Sensitive Data Exposure via Authenticated SQL Injection

Severity:

HIGH RISK

(7.6)

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

Authenticated SQL injection in Dolibarr's REST API allows malicious API clients to inject crafted SQL via the sqlfilters parameter on dictionary and multicurrency endpoints.

When these filters are concatenated into the WHERE clause with insufficient sanitization, an attacker can exfiltrate arbitrary database contents, including sensitive records, under typical authenticated API access conditions.

Affected context

This vulnerability appears in Dolibarr deployments that expose the REST API, particularly the setup dictionary and multicurrencies endpoints implemented in api_setup.class.php and api_multicurrencies.class.php.

It becomes relevant when authenticated API users can supply sqlfilters values that are directly incorporated into dynamically built SQL WHERE clauses.

The existing validation only checks for balanced parentheses and rewrites certain triplet patterns, leaving any text outside those patterns unaltered and potentially dangerous.

Exploit preconditions

  • Attack surface: Dolibarr REST API, specifically dictionary and multicurrencies endpoints that accept sqlfilters.
  • Required access: Valid authenticated API credentials with permission to call the affected endpoints.
  • Trigger point: Submission of a crafted sqlfilters parameter that injects additional SQL fragments such as UNION SELECT or extended predicates.
  • Why exploitation is possible: The server-side logic performs limited syntactic checks (e.g., balanced parentheses and triplet rewriting) but does not properly parameterize or sanitize the remaining content, allowing attacker-controlled fragments to be concatenated directly into the SQL WHERE clause.

Why this happens

The core issue is dynamic SQL construction using untrusted user input embedded directly into query strings without proper parameterization.

In Dolibarr's API handlers, the sqlfilters parameter is only partially validated and then concatenated into the WHERE clause, trusting that remaining text is safe.

This pattern maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where application code fails to treat user-controlled query modifiers as data and instead allows them to function as executable SQL logic.

Potential impact

  • Authenticated attackers may retrieve arbitrary database rows beyond their intended authorization scope.
  • Sensitive information such as password hashes, API keys, and configuration secrets could be exposed.
  • Business-critical records (customers, invoices, orders, financial data) can be enumerated and exfiltrated.
  • Database reconnaissance and schema harvesting may be possible via injected queries.
  • The vulnerability could aid in chaining attacks, such as credential cracking or lateral movement using leaked secrets.

General mitigation guidance

Effective mitigation focuses on eliminating direct concatenation of user-controlled values into SQL and reducing trust in client-supplied filter syntax.

Recommended patterns include:

  • Use parameterized queries or query builders that represent filters as structured data (fields, operators, values) rather than raw SQL fragments.
  • Introduce a strict allowlist model for filterable columns and accepted operators, validating each component independently.
  • Normalize filtering logic so that client input is mapped to safe query parameters, not embedded SQL fragments.
  • Apply least-privilege principles to API accounts and database roles so that even if a filter is abused, access is constrained.
  • Prefer high-level search or filter APIs that abstract away SQL semantics from clients, reducing opportunities for injection.

How teams detect issues like this

Detection commonly relies on inspecting both code and runtime behavior:

  • Static analysis rules targeting string-based SQL construction and direct inclusion of request parameters like sqlfilters.
  • Manual code reviews focusing on API handlers that accept dynamic filter or search parameters and checking for parameterization.
  • Centralized logging of SQL queries and API calls, with anomaly detection for unexpected UNION, subqueries, or tautological predicates in generated SQL.
  • Security test automation, such as dynamic application security testing, that probes filter parameters for injection behavior during CI/CD.
  • Policy enforcement that flags or blocks deployment of endpoints relying on raw SQL fragments from clients.

Sources

SourceLink
github.comgithub.com/Dolibarr/dolibarr/commit/14db36e8486ef725b0d493d97abb2950a54358d3
github.comgithub.com/Dolibarr/dolibarr/issues/38768
github.comgithub.com/Dolibarr/dolibarr/pull/38794
vulncheck.comvulncheck.com/advisories/dolibarr-sql-injection-via-sqlfilters-parameter-in-multiple-rest-api-list-endpoints

Frequently asked

questions

It mainly enables data exfiltration through injected read queries, such as UNION SELECT. While it can expose sensitive information and broad datasets, direct write or destructive operations depend on how the underlying code assembles queries and the database permissions of the API account.

The attacker must possess authenticated API access with the ability to call the affected setup dictionary or multicurrencies endpoints. Anonymous users cannot exploit it, but compromised or abused API credentials provide a viable path.

Replace any dynamic SQL that incorporates sqlfilters with parameterized queries or an ORM/query builder that models filters as structured parameters. Ensure that filterable fields and operations are strictly defined and that no raw SQL fragments from the client are concatenated into query strings.

Adopt a defensive development standard that forbids building SQL via string concatenation with user input, enforce code review checks for parameterization, and use automated analysis tools to flag risky patterns. Design APIs so that clients express filters in constrained, validated formats unrelated to underlying SQL syntax.

Find out what's already
exploitable in your codebase.