/

CVE-2026-31939

Severity:

HIGH RISK

(8.3)

Path Traversal / Arbitrary File Access in Chamilo LMS

CVE-2026-31939

Analyzed

Vulnerability type

Category:

Path Traversal / Arbitrary File Access

CWE:

CWE-22, CWE-73

Impact:

Arbitrary File Deletion on Server

Severity:

HIGH RISK

(8.3)

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.38 contain a path traversal flaw in main/exercise/savescores.php where user-controlled input is concatenated directly into filesystem paths.

An attacker who can control the test parameter may be able to traverse directories and delete arbitrary files on the server, potentially impacting availability and integrity of the LMS environment.

Affected context

The vulnerability occurs in the score-saving functionality of Chamilo LMS, specifically in main/exercise/savescores.php.

It manifests when the application constructs file paths using $_REQUEST['test'] without normalizing or validating the resulting path.

In deployments where the web server process has broad filesystem permissions and user-controlled parameters reach this script, crafted input can influence which files are targeted for deletion.

Exploit preconditions

  • Attack surface: HTTP interface exposed by Chamilo LMS, targeting main/exercise/savescores.php.
  • Required access: Ability to send HTTP requests that reach the vulnerable script; in many LMS deployments this may require at least an authenticated user role capable of accessing exercises.
  • Trigger point: The test request parameter ($_REQUEST['test']) is received and concatenated into a filesystem path used in deletion logic.
  • Why exploitation is possible: The application constructs file system paths directly from user input without canonicalization, normalization, or checks for directory traversal sequences, allowing ../ patterns to escape the intended directory.

Why this happens

This issue stems from direct use of unvalidated user input in filesystem path construction, aligning with CWE-22: Improper Limitation of a Pathname to a Restricted Directory.

The $_REQUEST['test'] parameter is concatenated into a path used by file deletion routines without canonicalizing the path or verifying that it remains within an allowed base directory.

As a result, directory traversal sequences can redirect file operations to unintended locations, enabling deletion of files outside the intended exercise-related storage area.

The behavior also relates to CWE-73: External Control of File Name or Path, where external input controls which file is operated upon.

Potential impact

  • Deletion of course materials, exercises, or uploaded resources relied on by students and instructors
  • Removal of configuration files that can disrupt application behavior or cause denial of service
  • Deletion of log files, hindering forensic analysis and incident response
  • Potential corruption of backups or temporary data if these are accessible to the application user
  • Broader system instability if the web server user has permissions to delete critical system or application files

General mitigation guidance

Effective mitigation focuses on constraining how user input influences filesystem paths and reducing file operation privileges:

  • Restrict file operations to a predefined base directory and enforce that any resolved path remains within this directory after canonicalization.
  • Normalize and validate user input used in file paths, rejecting or sanitizing any segments containing directory traversal sequences, absolute paths, or unexpected characters.
  • Use indirect references (such as opaque IDs mapped to server-side paths) instead of allowing clients to specify file or path names directly.
  • Implement least-privilege for the web server or PHP user so it only has write/delete permissions in directories that truly require it.
  • Centralize file access routines behind helper APIs that enforce validation and policy checks consistently across the codebase.

How teams detect issues like this

Organizations can detect similar vulnerabilities by combining code analysis and operational monitoring:

  • Static analysis: Configure rules to flag concatenation of $_GET, $_POST, or $_REQUEST values into filesystem APIs (e.g., unlink, fopen, file_put_contents, include) without prior validation or normalization.
  • Code review: During manual review, look for file operations based on request parameters and verify that they use whitelisting, canonicalization, and base-directory checks.
  • Security testing: Use targeted dynamic testing to probe for directory traversal sequences in parameters that influence file operations, watching for errors or unexpected behavior.
  • Runtime monitoring: Monitor application logs and server logs for suspicious patterns such as ../ sequences in request parameters, repeated file deletion errors, or access to unexpected directories.

Sources

SourceLink
github.comgithub.com/chamilo/chamilo-lms/commit/4dddcc19d36119da27b7c49eb84a035800abae78
github.comgithub.com/chamilo/chamilo-lms/releases/tag/v1.11.38
github.comgithub.com/chamilo/chamilo-lms/security/advisories/GHSA-8q8c-v75x-q2hx

Frequently asked

questions

Yes. An attacker who can reach the vulnerable savescores.php endpoint and control the test parameter can attempt to exploit the path traversal over the network, subject to any authentication or access controls in front of the endpoint.

In many LMS configurations, interacting with exercise functionality requires authentication. Whether guest or student accounts can reach the vulnerable code path depends on local configuration, but at minimum the attacker must hold a role that can trigger the score-saving logic.

The most robust approach is to decouple user input from raw filesystem paths by using server-side mappings from IDs to paths, while also enforcing base-directory constraints and path canonicalization before any file operation occurs. File deletion should only ever operate on paths derived from trusted, validated sources.

Adopt a standard file-access abstraction that all modules use, with built-in validation, canonicalization, and base-directory checks. Combine this with secure coding guidelines that forbid direct use of request parameters in filesystem APIs, and enforce these rules via automated static analysis and code review.

Find out what's already
exploitable in your codebase.