/

CVE-2026-22666

Severity:

HIGH RISK

(7.2)

Eval Injection in Dolibarr dol_eval_standard() Computed

CVE-2026-22666

Analyzed

Vulnerability type

Category:

Eval Injection

CWE:

CWE-95, CWE-94

Impact:

Remote Code Execution

Severity:

HIGH RISK

(7.2)

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

Dolibarr ERP/CRM before version 23.0.2 contains an authenticated remote code execution vulnerability in the dol_eval_standard() function, which evaluates user-controlled expressions using eval() without reliably blocking dangerous constructs.

An attacker with administrator privileges can craft payloads using PHP dynamic callable syntax to bypass whitelist-based checks, resulting in arbitrary command execution on the server.

Affected context

This vulnerability appears in Dolibarr ERP/CRM deployments where:

  • Administrators can define or modify computed extrafields or other evaluatable expressions
  • The dol_eval_standard() function is used to evaluate these expressions at runtime
  • Evaluation relies on a whitelist-mode filter that attempts to block forbidden strings

In such configurations, the application treats administrator-supplied expressions as code and executes them with PHP eval(), creating a high-impact risk if the filtering logic is incomplete or bypassable.

Exploit preconditions

  • Attack surface: Web-based administrative interface for Dolibarr ERP/CRM
  • Required access: Valid Dolibarr account with administrator-level privileges or equivalent rights to configure computed extrafields or other evaluated expressions
  • Trigger point: Server-side execution of dol_eval_standard() when rendering or processing a computed field or any feature that evaluates custom expressions
  • Why exploitation is possible: The whitelist-mode filter inside dol_eval_standard() does not properly detect PHP dynamic callable syntax and fails to apply forbidden string checks in all cases, allowing crafted expressions to reach eval() and execute arbitrary PHP code.

Why this happens

The issue stems from using eval() on user-configurable expressions in combination with incomplete input validation.

The dol_eval_standard() function attempts to sanitize or restrict expressions via a whitelist approach and forbidden-string checks, but the logic does not cover all syntactic forms available in PHP, including dynamic callable syntax.

Because the filter focuses on direct string matches rather than a robust parsing or safe evaluation model, attackers can encode dangerous operations in forms that evade detection, mapping directly to CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection').

Potential impact

  • Execution of arbitrary PHP code in the context of the web server
  • Reading, modifying, or deleting application and business data managed by Dolibarr
  • Installation of webshells or backdoors for persistent access
  • Pivoting to the underlying operating system to run arbitrary system commands
  • Lateral movement to other internal systems reachable from the Dolibarr host
  • Abuse of the Dolibarr instance for data exfiltration or further compromise of the organization

General mitigation guidance

Effective mitigation focuses on eliminating dangerous dynamic evaluation paths and reducing the power of configurable expressions:

  • Replace eval()-based evaluation with a safe, domain-specific expression engine that explicitly supports only the minimal operations needed (e.g., arithmetic, simple conditionals, field references).
  • Implement strict parsing and allow-listing at the syntax and function level, rejecting any construct outside the supported safe subset.
  • Treat administrator-supplied expressions as untrusted input, enforcing the same secure coding principles applied to regular user input.
  • Apply least-privilege principles to the application runtime (e.g., restricted file system permissions, non-privileged OS users) so that, even if code execution occurs, its capabilities are constrained.
  • Centralize and reuse safe evaluation routines instead of ad-hoc uses of eval() scattered across the codebase, simplifying review and hardening.

These patterns reduce the risk of eval injection even when complex configuration features are required.

How teams detect issues like this

Detection can combine code-centric and configuration-centric approaches:

  • Static analysis: Search for uses of eval() or similar dynamic execution constructs that accept user- or admin-controlled input; flag any instance where the input is not derived solely from trusted constants or a rigorously-validated expression model.
  • Code review signals: Pay special attention to helper functions like dol_eval_standard() that centralize evaluation logic; reviewers should look for whitelist-based checks, string filtering, or regex rules that attempt to secure eval() rather than replacing it.
  • Configuration review: Regularly review high-privilege configuration paths such as computed extrafields, custom formulae, and plugin-defined expressions to identify suspicious or unexpectedly complex logic.
  • Runtime monitoring: Monitor application logs and web server logs for anomalous errors, unexpected PHP warnings, or unusual outbound connections that could indicate malicious code execution.
  • Automated tooling: Integrate SAST tools or custom linters into CI pipelines to systematically detect eval-like patterns and enforce organization-wide policies that discourage dynamic code evaluation.

Sources

SourceLink
github.comgithub.com/Dolibarr/dolibarr/commit/6f425521b3e6f9f27eca05228e02093dbaa40dea
github.comgithub.com/Dolibarr/dolibarr/releases/tag/23.0.2
github.comgithub.com/Dolibarr/dolibarr/security/advisories/GHSA-vmvw-qq8w-wqhg
jivasecurity.comjivasecurity.com/writeups/dolibarr-remote-code-execution-cve-2026-22666
vulncheck.comvulncheck.com/advisories/dolibarr-erp-crm-authenticated-rce-via-dol-eval-standard

Frequently asked

questions

Yes, if the Dolibarr administrative interface is exposed and an attacker can obtain valid administrator credentials or compromise an admin account. The attack is performed via HTTP(S) requests but requires authenticated, high-privilege access.

Exploitation requires administrator-level privileges or equivalent rights that allow defining or editing computed extrafields or other expressions processed by dol_eval_standard(). Regular user accounts without such configuration capabilities cannot typically exploit this flaw directly.

The safest pattern is to remove reliance on eval() entirely for user- or admin-supplied expressions and replace it with a dedicated, safely-implemented expression engine that only supports well-defined operations. Any residual dynamic behavior should be constrained by strict parsing, explicit allow-lists, and strong separation from sensitive APIs.

Avoid designs where configuration is interpreted as executable code. When dynamic behavior is needed, design constrained configuration languages or expression DSLs from the outset, perform thorough threat modeling, and enforce security checks via automated tooling and code review focused on dynamic evaluation, reflection, and callable resolution.

Find out what's already
exploitable in your codebase.