CVE-2023-4225

8.8 HIGH

📋 TL;DR

This vulnerability allows authenticated users with learner roles in Chamilo LMS to upload arbitrary PHP files through the exercise.ajax.php endpoint, leading to remote code execution. Attackers can execute arbitrary code on the server with the web server's privileges. All Chamilo LMS installations up to version 1.11.24 are affected.

💻 Affected Systems

Products:
  • Chamilo LMS
Versions: All versions <= 1.11.24
Operating Systems: All operating systems running Chamilo LMS
Default Config Vulnerable: ⚠️ Yes
Notes: Requires authenticated user with learner role or higher. The vulnerability exists in the default installation.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full server compromise allowing attackers to execute arbitrary commands, steal sensitive data, install backdoors, pivot to internal networks, and potentially gain persistent access.

🟠

Likely Case

Attackers upload web shells to gain initial access, then escalate privileges to compromise the entire application and potentially the underlying server.

🟢

If Mitigated

With proper file upload validation and web application firewalls, exploitation attempts are blocked and logged for investigation.

🌐 Internet-Facing: HIGH - Internet-facing Chamilo instances are directly accessible to attackers who can create learner accounts or compromise existing ones.
🏢 Internal Only: MEDIUM - Internal instances are still vulnerable to insider threats or attackers who gain internal network access through other means.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: CONFIRMED
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires authenticated access but is straightforward once an attacker has learner credentials. Public exploit details are available in the advisory links.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: v1.11.25 and later

Vendor Advisory: https://support.chamilo.org/projects/chamilo-18/wiki/security_issues#Issue-129-2023-09-04-Critical-impact-Moderate-risk-Authenticated-users-may-gain-unauthenticated-RCE-CVE-2023-4223CVE-2023-4224CVE-2023-4225CVE-2023-4226

Restart Required: No

Instructions:

1. Backup your Chamilo installation and database. 2. Download the latest version from the official Chamilo website. 3. Replace the affected files with patched versions from the GitHub commits. 4. Verify the fix by checking that file upload validation now properly restricts PHP file uploads.

🔧 Temporary Workarounds

Web Application Firewall Rule

all

Block requests to the vulnerable endpoint or restrict file uploads to specific extensions

# Example ModSecurity rule: SecRule REQUEST_URI "@contains /main/inc/ajax/exercise.ajax.php" "id:1001,phase:1,deny,status:403,msg:'Blocking Chamilo CVE-2023-4225 exploit attempt'"

File Upload Restriction

linux

Configure web server to block execution of uploaded PHP files in upload directories

# Apache: <Location /app/upload/>\n    php_flag engine off\n</Location>
# Nginx: location ~* /app/upload/.*\.php$ {\n    deny all;\n}

🧯 If You Can't Patch

  • Disable the exercise.ajax.php endpoint or restrict access to it via web server configuration
  • Implement strict file upload validation at the application level to reject all PHP files regardless of extension tricks

🔍 How to Verify

Check if Vulnerable:

Check if your Chamilo version is <= 1.11.24 and examine the exercise.ajax.php file for proper file extension validation

Check Version:

Check the main/inc/conf/configuration.php file for version information or use the Chamilo admin interface

Verify Fix Applied:

Attempt to upload a PHP file through the exercise functionality - it should be rejected with proper validation

📡 Detection & Monitoring

Log Indicators:

  • Multiple failed file upload attempts to exercise.ajax.php
  • Successful upload of .php files to upload directories
  • Unusual POST requests to exercise.ajax.php with file upload parameters

Network Indicators:

  • POST requests to /main/inc/ajax/exercise.ajax.php with file upload content
  • Subsequent requests to uploaded PHP files in upload directories

SIEM Query:

source="web_server_logs" AND (uri="/main/inc/ajax/exercise.ajax.php" AND method="POST" AND size>100000) OR (uri MATCHES "*upload/*.php" AND user_agent NOT IN ["normal_user_agents"])

🔗 References

📤 Share & Export