Summary
The Website module in Dolibarr ERP & CRM 22.0.4 and below uses blacklist-based filtering to block dangerous PHP functions tied to system command execution, but this control can be bypassed by authenticated users allowed to edit PHP content.
Under these conditions, an attacker may gain full remote code execution and run arbitrary operating system commands on the underlying server.
Affected context
This vulnerability occurs in Dolibarr ERP & CRM installations that enable the Website module and allow authenticated users to create or edit PHP-based content or pages.
The risk is present when application-layer defenses rely on blacklisting specific PHP functions to prevent command execution, rather than enforcing strict separation between content and executable code.
Multi-tenant or shared-hosting deployments where multiple users share a Dolibarr instance are particularly exposed if edit permissions are broadly granted.
Exploit preconditions
- Attack surface: Web interface of the Dolibarr Website module.
- Required access: Authenticated account with permissions to create or modify PHP content or templates in the Website module.
- Trigger point: Saving or rendering PHP content that is processed by the server-side PHP engine.
- Why exploitation is possible: The application relies on blacklist-based filtering of "dangerous" functions, which can be circumvented through alternative invocation patterns, indirect function calls, or incomplete coverage of dangerous APIs, allowing arbitrary OS command execution.
Why this happens
The core issue is an OS Command Injection weakness mapped to CWE-78, where user-controlled PHP content is executed on the server with insufficient safeguards.
Instead of treating user-editable content as data only, the Website module permits PHP code execution and attempts to secure it via a blacklist of disallowed functions related to system commands.
Blacklist approaches are inherently fragile: they are prone to omissions, encoding tricks, and alternate call paths, and they do not provide a robust guarantee that no dangerous behavior remains reachable.
This design effectively grants code execution capability to any user who can bypass or work around the blacklist, resulting in full server-side command execution.
Potential impact
- Execution of arbitrary operating system commands on the Dolibarr server.
- Reading, modifying, or deleting sensitive business data managed by Dolibarr.
- Installation of web shells or backdoors for persistent access.
- Lateral movement to other systems reachable from the compromised server.
- Abuse of the server for spam, cryptomining, or staging further attacks.
- Complete compromise of the Dolibarr application integrity and availability.
General mitigation guidance
Effective mitigation focuses on eliminating the need for user-supplied executable PHP in the Website module and enforcing strict separation between content and code.
Recommended defensive patterns include:
- Avoid allowing PHP code in user-editable website content; treat all user-supplied site content as data to be rendered, not executed.
- Replace blacklist-based controls with allowlist-based design, where only a constrained set of safe operations or templating constructs are permitted.
- Use a sandboxed templating engine (e.g., logic-limited templates) instead of raw PHP for dynamic content.
- Minimize and tightly scope permissions so that only highly trusted administrative accounts can alter any server-side logic or templates.
- Run the application and web server under least-privilege accounts, reducing the impact of potential command execution.
- Apply strong change control and review processes for any content that can influence server-side behavior.
How teams detect issues like this
Detection typically combines code-level analysis with operational monitoring:
- Static analysis: Search for locations where user-editable content is passed to PHP for direct execution, especially with partial function blacklists or custom "dangerous function" filters.
- Code review signals: User-facing editors that support PHP or "advanced" server-side scripting in the Website module; any logic that parses, filters, then evaluates PHP fragments should be examined carefully.
- Security policy checks: Enforce policies preventing raw PHP usage in content management features and require template engines with restricted capabilities.
- Runtime monitoring: Log and alert on unexpected calls to system-level functions (e.g.,
exec,shell_exec,system,passthru) and suspicious outbound network connections or file modifications initiated by the web server user. - Automated SAST or RASP tools can assist in spotting dynamic code execution paths and improper command construction during development and testing.

