CVE-2023-4223
📋 TL;DR
This vulnerability allows authenticated users with learner roles in Chamilo LMS to upload arbitrary PHP files through the document upload functionality. Successful exploitation leads to remote code execution on the server. All Chamilo LMS installations running version 1.11.24 or earlier 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, access sensitive data, pivot to internal networks, and maintain persistent access.
Likely Case
Attackers upload web shells to gain control over the Chamilo application server, potentially accessing user data, modifying content, or using the server for further attacks.
If Mitigated
If proper file upload validation and web application firewalls are in place, exploitation attempts would be blocked, limiting impact to failed upload attempts.
🎯 Exploit Status
Exploitation requires authenticated access but is straightforward once an attacker has valid 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 patch by checking that file uploads properly validate file types.
🔧 Temporary Workarounds
Web Application Firewall Rule
allBlock uploads of PHP files to the vulnerable endpoint
Add WAF rule to block requests to /main/inc/ajax/document.ajax.php with PHP file extensions in upload data
File Extension Restriction
linuxConfigure web server to block execution of uploaded PHP files
Add to .htaccess (Apache): <FilesMatch "\.php$"> Deny from all </FilesMatch>
Add to nginx config: location ~ \.php$ { deny all; }
🧯 If You Can't Patch
- Disable the document upload functionality for learner roles in Chamilo configuration
- Implement strict file upload validation at the application level to reject PHP and other executable file types
🔍 How to Verify
Check if Vulnerable:
Check if your Chamilo version is <= 1.11.24 and examine if /main/inc/ajax/document.ajax.php exists without proper file type validation.
Check Version:
Check Chamilo configuration file or admin panel for version information, or examine the main/inc/conf/configuration.php file
Verify Fix Applied:
Attempt to upload a PHP file as a learner user - it should be rejected with proper error messages. Verify version is >= 1.11.25.
📡 Detection & Monitoring
Log Indicators:
- Multiple failed upload attempts with PHP extensions
- Successful uploads of PHP files to document directories
- Unusual file upload activity from learner accounts
Network Indicators:
- POST requests to /main/inc/ajax/document.ajax.php with PHP file content
- Subsequent requests to uploaded PHP files in document directories
SIEM Query:
source="web_server" AND (url="/main/inc/ajax/document.ajax.php" AND method="POST" AND (file_extension="php" OR content_type LIKE "%php%"))
🔗 References
- https://github.com/chamilo/chamilo-lms/commit/3d74fb7d99bd2e287730552f7a66562417a55047
- https://github.com/chamilo/chamilo-lms/commit/6f32625a012d5de2dfe8edbccb4ed14a85e310d4
- https://github.com/chamilo/chamilo-lms/commit/e864127a440c2cab0eb62c113a04e2e904543a1f
- https://starlabs.sg/advisories/23/23-4223
- 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/3d74fb7d99bd2e287730552f7a66562417a55047
- https://github.com/chamilo/chamilo-lms/commit/6f32625a012d5de2dfe8edbccb4ed14a85e310d4
- https://github.com/chamilo/chamilo-lms/commit/e864127a440c2cab0eb62c113a04e2e904543a1f
- https://starlabs.sg/advisories/23/23-4223
- 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