Summary
Chamilo LMS exposes an unrestricted file upload issue in the BigUpload endpoint that allows any authenticated user to write arbitrary content to server-side files.
Because the attacker can control the filename and content, and the .pht extension is not safely filtered, this can result in remote code execution on Apache deployments that treat .pht as PHP.
Affected context
This vulnerability appears in Chamilo LMS deployments prior to 1.11.38 that:
- Enable the BigUpload endpoint for authenticated users (including students)
- Run on web servers (e.g., Apache) that interpret
.phtfiles as PHP scripts - Store uploaded content in web-accessible locations without strict execution separation
The issue arises because the upload mechanism allows user-controlled filenames and raw body content to be written directly to disk, with only partial extension filtering.
Exploit preconditions
- Attack surface: HTTP(S) BigUpload endpoint in Chamilo LMS
- Required access: Any authenticated user account (including low-privilege student roles)
- Trigger point: Sending a POST request where:
- The
keyparameter sets the target filename - The raw POST body becomes the file content
- Why exploitation is possible:
- The upload handler allows arbitrary file paths/names based on user input
- Only
.phpextensions are filtered, leaving.phtand potentially other executable mappings untouched - On Apache configurations that treat
.phtfiles as PHP, the uploaded file is parsed as server-side code when accessed
Why this happens
The core issue is an unrestricted file upload pattern where user-controlled data is written to server-side files with insufficient validation and extension handling.
The BigUpload endpoint trusts the key parameter to define the filename and writes the raw POST body directly to disk, only applying a basic safeguard against .php extensions.
This maps to CWE-434: Unrestricted Upload of File with Dangerous Type, because attackers can:
- Choose a script-capable extension (
.phtin this case) that the server executes - Place arbitrary content in that file, which the server then interprets as executable PHP on certain configurations.
Potential impact
- Remote code execution under the web server or application runtime user
- Full compromise of the Chamilo LMS application and its data
- Unauthorized access to user records, course content, and stored credentials or tokens
- Lateral movement to other systems reachable from the compromised server
- Installation of web shells, backdoors, or persistence mechanisms
- Use of the compromised server as a pivot point in broader network attacks
General mitigation guidance
Effective mitigation focuses on strictly controlling what can be uploaded and where it resides:
- Enforce an allowlist of safe file types/extensions and reject or neutralize all others; avoid relying on simple blacklist filtering (e.g., only blocking
.php). - Store uploaded files outside of web-accessible document roots, or on storage that cannot be executed as code by the web server.
- Decouple file names on disk from user-controlled parameters by generating server-side identifiers rather than trusting client-supplied filenames or paths.
- Normalize and validate file paths to prevent extension tricks, double extensions, or alternate handler mappings such as
.pht. - Configure the web server to disallow execution of dynamic code from upload directories (e.g., disable PHP handlers there).
- Apply least-privilege to the web server user so that even if an upload-related flaw exists, its ability to modify sensitive locations is reduced.
How teams detect issues like this
Organizations can look for this class of issue using a combination of static and runtime techniques:
- Static analysis: Flag code paths that:
- Write HTTP request bodies to the filesystem
- Use user input (e.g., request parameters like
key) directly in file paths or names - Perform only simple extension checks or blacklists for dangerous file types
- Code review signals:
- Upload handlers that trust client-provided filenames or paths
- Lack of a clear allowlist for file types and MIME types
- Uploaded files stored under web-accessible directories with active script handlers
- Runtime and log analysis:
- Monitor access logs for requests to unusual script-like extensions in upload directories (
.pht,.phar, etc.) - Alert on patterns where low-privilege accounts perform repeated uploads followed by execution attempts.
- Policy enforcement:
- Integrate secure upload policies into CI/CD checks and automated review tools that scan for risky file-handling constructs.

