/

CVE-2025-67486

Severity:

HIGH RISK

(7.2)

Code Injection in Dolibarr User Extrafields

CVE-2025-67486

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-74

Impact:

Authenticated 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's user extrafields feature contains a code injection flaw where attacker-controlled "computed value" expressions are passed directly into PHP's eval() function.

An authenticated administrator can abuse this behavior to execute arbitrary PHP code on the server, leading to full application compromise under affected configurations.

Affected context

This vulnerability manifests in Dolibarr deployments that use the user extrafields "computed value" capability to dynamically calculate field values.

The issue is present when the application evaluates these expressions using PHP's eval() with insufficient validation or restriction of the supplied expression string.

It is most relevant in environments where administrator accounts are shared, delegated, or exposed to untrusted users, or where an attacker can otherwise obtain administrator-level credentials.

Exploit preconditions

  • Attack surface: Web application interface for configuring user extrafields
  • Required access: Authenticated administrator (or any role with permission to define/modify extrafield "computed value" expressions)
  • Trigger point: Saving or triggering evaluation of a crafted "computed value" that is later processed by eval()
  • Why exploitation is possible: The application embeds user-provided expression text into an eval() call without robust parsing, whitelisting, or sandboxing, allowing arbitrary PHP code to be executed in the application's runtime context.

Why this happens

The underlying issue is the direct use of PHP's eval() on data influenced by users, which is a classic code injection antipattern.

Instead of treating "computed value" content as data to be interpreted by a constrained expression engine, the application passes the raw string into the PHP interpreter, effectively granting code execution privileges to anyone who can modify that field.

This aligns with CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component, where untrusted inputs are embedded into commands or code processed by another interpreter without adequate neutralization or strict allowlisting.

Potential impact

  • Arbitrary PHP code execution within the web server process
  • Reading or modification of application data, including ERP and CRM records
  • Creation of backdoor functionality or web shells for persistent access
  • Access to sensitive configuration values, such as database credentials
  • Lateral movement to other systems, depending on server privileges and network position

General mitigation guidance

Mitigation generally focuses on avoiding direct interpreter calls on user-controlled data and constraining any dynamic expression capabilities.

Recommended defensive patterns include:

  • Replacing eval() with a safe, declarative expression engine that operates on a strict grammar and prevents arbitrary function calls
  • Applying strict allowlists for permitted operators and functions, and rejecting any expression that deviates from expected patterns
  • Treating "computed value" content as data, not code, and evaluating it through explicit, hard-coded logic paths rather than generic interpreter APIs
  • Restricting high-risk configuration capabilities to a minimal set of trusted administrators and using separate accounts for routine tasks
  • Running the application with least-privilege OS and database accounts to limit the blast radius if code execution occurs

How teams detect issues like this

Detection can be approached through both code-level and operational monitoring techniques:

  • Static analysis rules that flag any use of eval(), assert(), or similar dynamic execution APIs, especially when arguments derive from configuration or request data
  • Secure code review checklists that explicitly require justification and alternatives for interpreter use and dynamic expression features
  • Application logging and monitoring focused on changes to user extrafields configuration, particularly updates to "computed value" fields
  • Web application firewalls or runtime application self-protection (RASP) solutions that can detect anomalous PHP execution patterns or suspicious expression strings
  • Periodic configuration audits to identify and review any complex or unexpected "computed value" expressions that may embed logic beyond simple calculations

Sources

SourceLink
github.comgithub.com/Dolibarr/dolibarr/blob/22.0.2/htdocs/core/lib/functions.lib.php
medium.commedium.com/@abduxalilovjavohir/dolibarr-erp-authenticated-remote-code-execution-via-eval-injection-in-user-extrafields-dfc305d0118e

Frequently asked

questions

Exploitation is straightforward for anyone with sufficient administrative privileges, because the vulnerable feature directly evaluates user-supplied expressions as PHP code. The main limiting factor is access to the relevant configuration interface.

An attacker must be an authenticated administrator or hold a role with the ability to define or edit user extrafield "computed value" expressions. Compromise of such an account effectively enables arbitrary code execution within the application context.

The most robust fix is to eliminate eval() entirely for this feature and replace it with a constrained expression evaluator or fixed, server-side logic. Any remaining dynamic behavior should operate on a predefined grammar and allowlist, making it impossible for user input to introduce arbitrary PHP constructs.

Avoid embedding untrusted input into interpreter calls, enforce strict input validation and allowlists for any dynamic expression features, and include checks for eval() and similar APIs in code review and automated analysis. Designing features to treat user input purely as data, not executable code, significantly reduces the risk of code injection.

Find out what's already
exploitable in your codebase.