/

CVE-2018-25357

Severity:

CRITICAL RISK

(9.8)

Code Injection in Dolibarr ERP CRM Installer

CVE-2018-25357

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.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

Dolibarr ERP CRM 7.0.3 contains a critical code injection flaw that allows arbitrary PHP code to be written and executed via the installation workflow.

An unauthenticated attacker can inject PHP code through the db_name parameter in a POST request to install/step1.php and later execute OS-level commands through the check.php endpoint using the cmd GET parameter.

Affected context

This vulnerability manifests during the web-based installation process of Dolibarr ERP CRM 7.0.3.

It affects deployments where the install/step1.php and check.php endpoints are accessible over the network and user-supplied installation parameters (such as db_name) are processed without sufficient validation or neutralization before being written into PHP-executable context.

Environments where installation scripts remain reachable in production or exposed to the internet are particularly at risk.

Exploit preconditions

  • Attack surface: HTTP(S) interface exposing the Dolibarr installation endpoints (install/step1.php and check.php).
  • Required access: No authentication is required; the attacker needs only network access to the vulnerable web interface.
  • Trigger point: Submission of a crafted POST request to install/step1.php with malicious PHP content in the db_name parameter, followed by a GET request to check.php with a cmd parameter to trigger the injected code.
  • Why exploitation is possible: User-controlled input from db_name is incorporated into PHP-executed context without proper sanitization, encoding, or separation between data and code, enabling arbitrary PHP statements to be persisted and later executed.

Why this happens

The core issue aligns with CWE-94: Improper Control of Generation of Code ("Code Injection").

The application dynamically handles configuration values (like db_name) in a way that allows user-supplied strings to influence generated PHP code or files.

Because these values are not strictly validated, encoded, or constrained to safe characters and are subsequently interpreted by the PHP runtime, an attacker can craft input that becomes executable PHP code.

This pattern stems from mixing data and code paths, relying on dynamic PHP execution mechanisms during installation without enforcing strict separation between configuration content and executable logic.

Potential impact

  • Remote execution of arbitrary PHP code on the server.
  • Execution of operating system commands under the web server's privileges.
  • Complete compromise of the Dolibarr application and its underlying database.
  • Lateral movement within the hosting environment or network.
  • Installation of persistent web shells or backdoors.
  • Exfiltration or manipulation of sensitive business and customer data.

General mitigation guidance

Effective mitigation focuses on eliminating the ability for user input to influence executable code paths and reducing exposure of installation interfaces:

  • Constrain installer parameters (such as db_name) to strictly validated formats, using allowlists of characters and length limits, and reject any input that does not match expected patterns.
  • Avoid generating or including PHP code directly from user-supplied values; keep configuration data in non-executable formats (e.g., .ini, .env, or structured data files) that are not interpreted as code.
  • Introduce strong output encoding and neutralization when user-controlled values are written into configuration files, ensuring they cannot break out into executable syntax.
  • Disable or remove installation scripts (e.g., install/step1.php and related endpoints) once setup is complete, or restrict them behind administrative authentication and network-level controls.
  • Run the application with least-privilege OS and database accounts so that, even if code execution occurs, its capabilities are limited.

How teams detect issues like this

Detection typically involves a combination of code-level and operational checks:

  • Static analysis: Define rules or queries to identify patterns where user input is written into PHP files, concatenated into eval-like constructs, or passed into dynamic include/require statements.
  • Code review: Flag any installer or configuration code that writes executable PHP files or templates using untrusted input, especially in installation or upgrade scripts.
  • Configuration and deployment reviews: Verify that installation endpoints are disabled or restricted in production and that web roots do not contain writable directories for dynamic PHP generation without controls.
  • Runtime monitoring: Inspect web server logs for unusual access to install/step1.php and check.php, especially with unexpected db_name or cmd parameters, and monitor for anomalous outbound connections or command execution artifacts.

Sources

SourceLink
dolibarr.orgdolibarr.org
github.comgithub.com/Dolibarr/dolibarr
exploit-db.comexploit-db.com/exploits/44964
vulncheck.comvulncheck.com/advisories/dolibarr-erp-crm-remote-code-evaluation-via-install-step1-php

Frequently asked

questions

The issue is remotely exploitable by anyone who can reach the exposed Dolibarr installation endpoints; no prior authentication is required, so internet-facing installers are at high risk.

Only network access to the web interface where install/step1.php and check.php are reachable is needed. The attacker does not require valid credentials or prior presence on the system.

The safest approach is to prevent user-controlled input from ever becoming executable PHP by treating installation parameters as pure data, enforcing strict validation and encoding, and storing configuration in non-executable formats. Additionally, remove or harden installation scripts so they cannot be used after initial deployment.

Adopt a design principle that strictly separates data from code generation, avoid dynamic code construction based on user input, enforce robust input validation and encoding policies, and include security-focused reviews of installation and setup workflows. Incorporating static analysis and secure coding checklists into the development lifecycle helps catch code injection patterns early.

Find out what's already
exploitable in your codebase.