CVE-2023-4225
📋 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
- Chamilo LMS
📦 What is this software?
Chamilo Lms by Chamilo
⚠️ 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.
🎯 Exploit Status
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
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
allBlock 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
linuxConfigure 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
- https://github.com/chamilo/chamilo-lms/commit/6f32625a012d5de2dfe8edbccb4ed14a85e310d4
- https://github.com/chamilo/chamilo-lms/commit/e864127a440c2cab0eb62c113a04e2e904543a1f
- https://github.com/chamilo/chamilo-lms/commit/f3d62b65ad60d68096c2674d5695339f04de0b8a
- https://starlabs.sg/advisories/23/23-4225
- 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
- https://github.com/chamilo/chamilo-lms/commit/6f32625a012d5de2dfe8edbccb4ed14a85e310d4
- https://github.com/chamilo/chamilo-lms/commit/e864127a440c2cab0eb62c113a04e2e904543a1f
- https://github.com/chamilo/chamilo-lms/commit/f3d62b65ad60d68096c2674d5695339f04de0b8a
- https://starlabs.sg/advisories/23/23-4225
- 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