BoidCMS — Authenticated File Upload to RCE via Template Injection (CVE-2026-39387)
by xp1tr · 2026-07-05
- Severity
- High
- CVE
- CVE-2026-39387
- Category
- web
- Affected product
- BoidCMS
- Affected versions
- <= 2.1.2
- Disclosed
- 2026-07-05
- Patch status
- unpatched
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-05 |
| Author / Researcher | xp1tr |
| CVE / Advisory | CVE-2026-39387 |
| Category | web |
| Severity | High |
| CVSS Score | Not specified in source |
| Status | Weaponized |
| Tags | boidcms, php, authenticated, file-upload, path-traversal, template-injection, rce |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | BoidCMS |
| Versions Affected | <= 2.1.2 |
| Language / Platform | Python (exploit) targeting PHP web application |
| Authentication Required | Yes (admin account) |
| Network Access Required | Yes |
Summary
BoidCMS (<= 2.1.2) combines two weaknesses to reach remote code execution from an authenticated admin account. First, its media upload endpoint only checks the declared MIME type (e.g. image/gif) rather than actual file contents, allowing PHP code embedded in a .gif file to be stored on the server. Second, the page-creation endpoint accepts a user-controlled tpl (template) parameter that is resolved relative to the themes directory without sanitization, allowing path traversal (e.g. ../../media/shell.gif) to point a page’s rendering template at the uploaded file. When the crafted page is viewed, the PHP interpreter executes the embedded payload, giving the attacker an interactive shell.
Vulnerability Details
Root Cause
The media upload handler validates only the declared MIME type rather than file content (CWE-434), and the page tpl parameter is used to build a template include path without path-traversal sanitization (CWE-22), together enabling PHP execution from an uploaded image.
Attack Vector
- Log into BoidCMS as an admin (
-l/-pcredentials). - Upload a
.giffile containing embedded PHP code via the media upload endpoint (admin?page=media). - Create a new page (
admin?page=create) withtpl=../../media/shell.gif, pointing the page’s template at the uploaded file. - Request the resulting page’s permalink with a
cmdparameter to execute arbitrary commands (GET /<permalink>?cmd=<command>).
Impact
Authenticated remote code execution as the web server user, providing an interactive shell for further post-exploitation.
Environment / Lab Setup
Target: BoidCMS <= 2.1.2 (PHP)
Attacker: python3, requests
Proof of Concept
PoC Script
See
CVE-2026-39387.pyin this folder.
| |
The script logs in with the provided admin credentials (handling CSRF tokens), uploads a GIF-disguised PHP webshell, creates a page whose template path traverses to the uploaded file, and drops the operator into an interactive cmd >> shell for command execution on the remote host.
Detection & Indicators of Compromise
POST /admin?page=create HTTP/1.1
tpl=../../media/shell.gif
GET /<permalink>?cmd=id HTTP/1.1
Signs of compromise:
- Media files with
.gif/image extensions containing embedded<?phptags - Page
tplvalues referencing paths outside the intended themes directory
Remediation
| Action | Detail |
|---|---|
| Primary fix | Update BoidCMS to a version validating actual uploaded file content and sanitizing the tpl parameter against path traversal, once available |
| Interim mitigation | Validate uploaded file content (not just declared MIME type); restrict tpl to an allowlist of known template files |
References
Notes
Mirrored from https://github.com/xp1tr/CVE-2026-39387 on 2026-07-05.
| |