CVE-2018-16974

9.8 CRITICAL

📋 TL;DR

This vulnerability in Elefant CMS allows remote attackers to execute arbitrary PHP code on affected servers. Attackers can bypass file upload restrictions by removing .htaccess protections and uploading malicious PHP files with crafted filenames. All Elefant CMS installations before version 2.0.7 are affected.

💻 Affected Systems

Products:
  • Elefant CMS
Versions: All versions before 2.0.7
Operating Systems: All platforms running PHP
Default Config Vulnerable: ⚠️ Yes
Notes: Requires filemanager application to be installed and accessible.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete server compromise allowing arbitrary code execution, data theft, and potential lateral movement within the network.

🟠

Likely Case

Webshell deployment leading to data exfiltration, defacement, or use as part of a botnet.

🟢

If Mitigated

Limited impact with proper file upload restrictions and web application firewalls in place.

🌐 Internet-Facing: HIGH - Exploitable remotely without authentication on internet-facing systems.
🏢 Internal Only: MEDIUM - Still exploitable by internal attackers but requires network access.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploit chain involves two steps: removing .htaccess file then uploading malicious PHP file with space characters in filename.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 2.0.7

Vendor Advisory: https://github.com/jbroadway/elefant/releases/tag/elefant_2_0_7_stable

Restart Required: No

Instructions:

1. Backup your Elefant CMS installation. 2. Download Elefant CMS 2.0.7 or later. 3. Replace all files except user-uploaded content and configuration files. 4. Verify the patch by checking the version.

🔧 Temporary Workarounds

Disable filemanager upload functionality

linux

Temporarily disable or restrict access to the vulnerable filemanager upload endpoint.

mv apps/filemanager/upload apps/filemanager/upload.disabled

Implement strict file upload filtering

all

Add additional file type validation in web server configuration.

Add 'Deny from all' to .htaccess in upload directory

🧯 If You Can't Patch

  • Implement web application firewall (WAF) rules to block requests to /filemanager/api/rm/ and suspicious upload patterns.
  • Restrict network access to Elefant CMS administration interface and implement strict file upload policies.

🔍 How to Verify

Check if Vulnerable:

Check if version is below 2.0.7 and if /apps/filemanager/upload/drop.php exists and is accessible.

Check Version:

grep -r 'elefant_version' conf/config.php | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+'

Verify Fix Applied:

Verify version is 2.0.7 or higher and test that PHP file uploads with spaces in filenames are properly rejected.

📡 Detection & Monitoring

Log Indicators:

  • HTTP requests to /filemanager/api/rm/.htaccess
  • File uploads with .php followed by spaces in filename
  • Unauthorized file deletion in upload directories

Network Indicators:

  • POST requests to /apps/filemanager/upload/drop.php with suspicious filenames
  • Sequential requests to remove .htaccess then upload files

SIEM Query:

source="web_logs" AND (uri_path="/filemanager/api/rm/.htaccess" OR (uri_path="/apps/filemanager/upload/drop.php" AND user_agent CONTAINS ".php "))

🔗 References

📤 Share & Export