/

CVE-2026-32931

Severity:

HIGH RISK

(7.5)

Unrestricted File Upload in Chamilo LMS Exercise Sound

CVE-2026-32931

Analyzed

Vulnerability type

Category:

Unrestricted File Upload

CWE:

CWE-434

Impact:

Remote Code Execution as web server user (www-data)

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Chamilo LMS suffers from an unrestricted file upload issue in the exercise sound upload feature, where a teacher can upload a PHP file while spoofing the Content-Type header as audio/mpeg.

Because the file keeps its .php extension and is stored in a web-accessible directory, this condition can lead to remote code execution as the web server user when the file is accessed.

Affected context

The vulnerability occurs in Chamilo LMS instances that expose the exercise sound upload functionality to authenticated teacher roles.

It manifests where uploaded content is trusted based on the HTTP Content-Type header, and where uploaded files are saved using their original filenames and extensions into directories that are directly served by the web server.

In such environments, if server-side validation does not enforce strict file type, extension, and execution policies, a PHP file uploaded through this feature may later be executed as application code.

Exploit preconditions

  • Attack surface: HTTP upload endpoint used for exercise sound/audio uploads in Chamilo LMS.
  • Required access: Valid authenticated teacher (or higher) account with permission to create or modify exercises that accept sound uploads.
  • Trigger point: Submitting an upload request containing a PHP file while setting the Content-Type header to audio/mpeg (or a similarly accepted type).
  • Why exploitation is possible:
  • The server relies on the client-provided Content-Type header rather than independently validating the file content and extension.
  • The uploaded file is stored with its original .php extension in a web-accessible directory.
  • The web server is configured to interpret .php files as executable scripts, so a subsequent HTTP request to the uploaded file path executes the file.

Why this happens

This vulnerability stems from insufficient server-side validation of uploaded files in the exercise sound upload functionality.

Instead of enforcing a strict allowlist of file extensions and verifying the actual file type at the server, the implementation trusts the Content-Type header supplied by the client and preserves the original filename and extension.

Combined with saving uploads into a web-accessible directory where .php files are executed by the web server, this behavior matches CWE-434: Unrestricted Upload of File with Dangerous Type.

Abstractly, the insecure pattern is: user-controlled file data plus user-controlled filename and extension, stored in an executable context, without robust validation or separation between data and code.

Potential impact

  • Remote code execution as the web server user (www-data) through uploaded PHP scripts.
  • Full compromise of the Chamilo LMS application context, including reading or modifying application data.
  • Pivoting to access or manipulate sensitive information stored in the LMS database (e.g., course content, user records, grades), depending on existing permissions.
  • Use of the compromised server as a foothold for further attacks within the hosting environment or internal network, subject to isolation and hardening controls.
  • Deployment of persistent webshells that facilitate long-term unauthorized access and post-exploitation activities.

General mitigation guidance

Effective mitigation focuses on tightening upload handling, restricting execution surfaces, and reducing trust in client-controlled metadata:

  • Strict file type and extension allowlists:
  • Enforce a server-side allowlist of permitted file extensions for the exercise sound feature (e.g., .mp3, .wav) and reject any other extensions.
  • Normalize filenames (e.g., generate server-side names) and strip or replace disallowed characters and extensions rather than preserving the original client-provided name.
  • Content validation independent of client headers:
  • Do not rely on the Content-Type header supplied by the client.
  • Verify uploaded content using server-side mechanisms such as file signatures, MIME detection libraries, or media-specific parsing where feasible.
  • Non-executable storage locations:
  • Store all user-uploaded files outside of web-executable directories so they cannot be interpreted as scripts by the web server.
  • Configure the web server so that user-uploaded paths never execute code (e.g., disable script execution in upload directories).
  • Separation of code and user content:
  • Maintain clear separation between application code directories and user-upload directories.
  • Apply web server rules (e.g., for PHP or other interpreters) that only execute code from explicitly designated locations controlled by the deployment process.
  • Principle of least privilege and hardening:
  • Run the web server and PHP interpreter with the least privileges necessary, restricting filesystem permissions for upload directories.
  • Apply general hardening (e.g., disabling dangerous PHP functions where compatible with the application) to reduce the impact if a malicious file is somehow executed.

How teams detect issues like this

Organizations can employ several approaches to detect similar unrestricted file upload risks:

  • Static analysis and code review:
  • Search for upload handlers that:
  • Use client-controlled filenames directly when saving files.
  • Do not enforce a strict extension allowlist.
  • Trust $_FILES['type'] or HTTP Content-Type without independent inspection.
  • Look for code paths saving uploads to directories under the document root that are also configured to execute scripts.
  • Configuration and policy checks:
  • Review web server and PHP configurations to ensure that upload directories are not marked as executable for server-side scripts.
  • Enforce policies that separate user content directories from code directories in deployment templates and infrastructure-as-code.
  • Dynamic testing and QA:
  • Incorporate security tests in QA that attempt to upload non-permitted file types (e.g., .php, .phtml) through media or document upload features.
  • Verify that such uploads are rejected or stored in a way that prevents execution, and that the application responds with appropriate errors.
  • Monitoring and logging:
  • Monitor access logs for suspicious requests to upload paths or unexpected script execution within upload directories.
  • Enable application-level logging around upload features to detect anomalous file types or repeated upload attempts that violate expected patterns.

Automated security scanning tools—both static analyzers and dynamic web vulnerability scanners—can augment manual review by flagging risky upload endpoints and executable upload directories, but should be combined with human validation.

Sources

SourceLink
github.comgithub.com/chamilo/chamilo-lms/commit/8cbe660de267f2b6ed625433bdfcf38dee8752b4
github.comgithub.com/chamilo/chamilo-lms/commit/d5ef5153df3d1b2de112cbeb190cdd10bea457f3
github.comgithub.com/chamilo/chamilo-lms/security/advisories/GHSA-863j-h6pf-3xhx

Frequently asked

questions

Yes, if the Chamilo LMS instance is exposed over the internet and teacher accounts can be obtained or compromised remotely, an attacker can exploit the upload feature via standard HTTP requests. The attack is carried out through authenticated web traffic to the vulnerable upload endpoint.

The attacker must have valid credentials for at least a teacher-level account (or any role allowed to use the exercise sound upload function). Anonymous users cannot exploit this specific issue if the upload feature is restricted to authenticated teachers.

The safest pattern is to treat all uploads as untrusted data, enforce a strict allowlist of file extensions and MIME types on the server, and store uploaded content in non-executable directories. Additionally, filenames should be generated server-side, and web server configuration should prevent execution of any user-uploaded files.

Apply a defense-in-depth strategy for uploads: verify file types independently of client headers, enforce extension allowlists, segregate user content from executable code, and configure the web server to disable script execution in upload directories. Regular security reviews, automated tests targeting upload endpoints, and adherence to secure coding guidelines for file handling help reduce the risk of reintroducing these vulnerabilities.

Find out what's already
exploitable in your codebase.