/

CVE-2026-30875

Severity:

HIGH RISK

(8.8)

Arbitrary File Upload / Code Injection in Chamilo LMS H5P

CVE-2026-30875

Analyzed

Vulnerability type

Category:

Arbitrary File Upload / Code Injection

CWE:

CWE-94

Impact:

Authenticated Remote Code Execution via Web Interface

Severity:

HIGH RISK

(8.8)

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 versions prior to 1.11.36 contain an arbitrary file upload vulnerability in the H5P Import feature that can lead to remote code execution.

Authenticated users with the Teacher role can upload a crafted H5P package that bypasses validation, enabling execution of attacker-controlled PHP code via alternative extensions and a malicious .htaccess file.

Affected context

This vulnerability occurs in Chamilo LMS instances that expose the H5P content import functionality to authenticated users with the Teacher role.

The H5P import mechanism performs only minimal validation (checking for the presence of h5p.json) and does not enforce strict restrictions on embedded server-side files or web server configuration files within the imported package.

In environments where the web server honors .htaccess directives or similar configuration rules, uploaded content from the H5P package may be interpreted as executable PHP, even when using non-standard file extensions such as .txt.

Exploit preconditions

  • Attack surface: Web-based H5P Import feature in Chamilo LMS.
  • Required access: Valid Chamilo LMS account with at least Teacher-level privileges and permission to import H5P content.
  • Trigger point: Uploading and importing a specially crafted H5P package that:
  • Includes a webshell or arbitrary PHP script stored with a non-standard extension (e.g., .txt), and
  • Includes a .htaccess file (or equivalent) that configures the web server to treat that extension as PHP.
  • Why exploitation is possible: The H5P validation logic only verifies the existence of h5p.json and does not:
  • Restrict or sanitize embedded .htaccess files,
  • Block alternative-extension PHP payloads,
  • Enforce a safe allowlist of file types or denylist of executable content.

As a result, attacker-controlled files are written into a web-accessible directory where the web server can execute them.

Why this happens

The root cause is insufficient server-side validation and sanitization of uploaded H5P packages, combined with the web server's willingness to execute PHP in user-controlled directories based on .htaccess directives.

From a vulnerability-class perspective, this maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), because user-supplied content is allowed to introduce executable code into the runtime environment.

The H5P import logic treats the package as largely trusted once a basic structural check (presence of h5p.json) passes, without:

  • Enforcing a strict content policy on upload,
  • Stripping potentially dangerous configuration files,
  • Preventing server-side executable content in upload paths.

This insecure pattern—trusting complex uploaded archives without robust filtering—allows attacker-controlled code to be deployed and then invoked via HTTP, resulting in remote code execution under the web server's privileges.

Potential impact

  • Remote execution of arbitrary PHP code within the Chamilo LMS web server context.
  • Full compromise of the affected LMS instance, including modification or theft of course content and user data.
  • Lateral movement within the hosting environment, depending on server configuration and permissions.
  • Installation of persistent webshells for long-term unauthorized access.
  • Use of the compromised LMS as a pivot point for further attacks against internal networks or other applications on the same server.

General mitigation guidance

Effective mitigation focuses on hardening both the file upload pipeline and the execution environment for user-supplied files:

  • Constrain upload content:
  • Implement strict allowlists for file types and paths within H5P packages, permitting only necessary media and resource formats.
  • Explicitly block server-side executable content and configuration files (e.g., .php, .phtml, .phar, .htaccess, and equivalent).
  • Validate archive contents before extraction, and reject or strip disallowed entries.
  • Isolate uploaded content:
  • Serve uploaded files from directories that are not configured to execute server-side code.
  • Configure the web server so that user-uploaded directories do not interpret .htaccess files or any runtime configuration directives from user-controlled paths.
  • Consider using a separate static asset domain or storage layer that only serves files and never executes them.
  • Apply least privilege and defense in depth:
  • Run the web server and application with minimal filesystem and OS privileges, limiting the blast radius of a compromise.
  • Segregate application data, configuration, and executable code from upload directories.
  • Strengthen validation logic for complex formats:
  • Treat composite upload formats like H5P as untrusted archives and apply layered checks (schema validation, path normalization, and content-type verification).
  • Prefer robust, secure-by-default libraries or frameworks for handling such packages, and enforce a conservative security policy around them.

How teams detect issues like this

Detection strategies can combine code-level review, configuration analysis, and runtime monitoring:

  • Static analysis and code review:
  • Identify code paths that handle archive uploads (e.g., H5P import) and inspect for:
  • Minimal or missing validation logic,
  • Absence of allowlists for file types and extensions,
  • Direct extraction of archives into web-accessible directories.
  • Use static analysis rules to flag:
  • Use of upload APIs without subsequent security checks,
  • Writes to directories that are configured for PHP execution or honor .htaccess from user-controlled locations.
  • Configuration auditing:
  • Review web server configuration to ensure:
  • Upload directories are not configured as executable locations,
  • .htaccess is disabled or constrained in user-writable paths.
  • Verify that any overrides enabling PHP execution in dynamic directories are explicitly justified and documented.
  • Runtime and log monitoring:
  • Monitor logs for suspicious patterns such as:
  • Requests to newly uploaded files with uncommon extensions being executed as PHP,
  • Abnormal access patterns from Teacher accounts, including repeated upload attempts or access to upload directories.
  • Employ application and intrusion-detection tools to alert on anomalous behavior around file uploads and code execution.
  • Automated security checks in CI/CD:
  • Integrate automated scanning tools or security linters that:
  • Check for insecure upload handling patterns,
  • Enforce internal policies disallowing executable code and configuration files in user-uploaded content.

Sources

SourceLink
github.comgithub.com/chamilo/chamilo-lms/releases/tag/v1.11.36
github.comgithub.com/chamilo/chamilo-lms/security/advisories/GHSA-mj4f-8fw2-hrfm

Frequently asked

questions

It is highly exploitable wherever Teachers (or equivalent roles) can import H5P content and the server is configured to honor .htaccess or similar directives in upload directories. In such environments, an attacker with a Teacher account can reliably achieve remote code execution.

No. The vulnerability can be triggered by any authenticated user with at least Teacher-level permissions and access to the H5P import functionality. Higher privileges are not strictly required, although broader permissions may increase the post-exploitation impact.

The safest pattern is to treat H5P (and similar archives) as untrusted input, enforce strict allowlists on file types, explicitly reject or strip any executable or configuration files, and ensure that uploaded content is stored in non-executable directories. The upload handler should never allow user-controlled archives to introduce server-side code or web server configuration into executable paths.

Prevention relies on designing file upload and import features with security first: enforce strong validation rules, isolate uploads from executable directories, disable execution in user-writable paths, and regularly review web server and application configurations. Incorporating secure coding guidelines, automated checks, and security-focused code reviews for all upload-related features helps catch such flaws before deployment.

Find out what's already
exploitable in your codebase.