/

CVE-2025-59542

Severity:

CRITICAL RISK

(9.0)

XSS in Chamilo Course Learning Path Settings

CVE-2025-59542

Analyzed

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Account Takeover via Stored Cross-Site Scripting

Severity:

CRITICAL RISK

(9.0)

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's course learning path Settings field is vulnerable to stored cross-site scripting (XSS), allowing untrusted JavaScript to be persisted and later executed in other users' browsers.

An attacker with a low-privileged account can inject malicious script that runs whenever other users, including administrators, view the affected course information page, potentially leading to session theft and account takeover.

Affected context

The vulnerability occurs within Chamilo's course management functionality, specifically when handling the "learning path" Settings field.

It manifests in deployments where user-supplied content in this field is stored and later rendered into web pages without robust output encoding or sanitization.

Any environment where trainers or similarly low-privileged roles can configure course learning paths and where other users regularly view the corresponding course information pages is potentially affected.

Exploit preconditions

  • Attack surface: Web application interface for managing course learning paths.
  • Required access: Authenticated low-privileged user account (e.g., trainer) with permission to edit the Settings field for a course learning path.
  • Trigger point: Another user, such as a student or administrator, must visit the course information page that displays the maliciously crafted content.
  • Why exploitation is possible: The application stores and later renders the Settings field without consistently applying contextual output encoding or filtering, allowing injected JavaScript to execute in the victim's browser.

Why this happens

This issue stems from improper neutralization of user-controlled content before it is included in HTML output, aligning with CWE-79 (Improper Neutralization of Input During Web Page Generation).

The learning path Settings field accepts text from a low-privileged user, stores it, and then renders it back into a page viewed by others without applying strict, context-aware HTML/JavaScript escaping or sanitization.

Because the rendered content can contain HTML tags and script-related constructs, the browser interprets parts of the stored input as executable JavaScript, enabling persistent cross-site scripting.

Potential impact

  • Theft of session cookies or authentication tokens belonging to higher-privileged users.
  • Account takeover (ATO) of administrators, trainers, or students who view the compromised course page.
  • Execution of arbitrary actions on behalf of victims (e.g., changing settings, creating or deleting courses, or modifying user accounts).
  • Injection of malicious content into course pages, potentially distributing phishing or malware links to students.
  • Lateral movement within the application through chained account compromises.

General mitigation guidance

Effective mitigation focuses on enforcing strict output encoding and content handling rules for all user-controlled fields rendered in web pages.

Common defensive patterns include:

  • Applying context-aware output encoding (HTML, attribute, JavaScript, or URL encoding) whenever user input is included in server-side templates or client-side rendering.
  • Restricting allowed markup in rich-text fields using a well-maintained allowlist-based HTML sanitizer that strips scriptable constructs, event handlers, and dangerous attributes.
  • Designing templates so that untrusted data is never embedded directly into executable JavaScript or HTML attributes without robust encoding.
  • Adopting a content security policy (CSP) that disallows inline JavaScript and restricts script sources to trusted origins, reducing impact if encoding failures occur.
  • Minimizing privileges for low-level roles and separating permissions for content creation and administrative control to limit the blast radius of compromised accounts.

How teams detect issues like this

Detection typically combines code-centric and behavior-centric approaches:

  • Static analysis or secure code review looking for template rendering paths where data from the learning path Settings field (and similar inputs) is output without explicit encoding functions.
  • Automated scanning with web vulnerability scanners configured to test stored XSS in form fields and parameters associated with course configuration and content management.
  • Security unit and integration tests that assert all user-supplied fields are passed through encoding/sanitization layers before rendering.
  • Application security policies or linters that flag unsafe patterns, such as direct insertion of raw user input into HTML templates or usage of dangerouslySetInnerHTML/innerHTML-style sinks.
  • Monitoring of logs and application telemetry for anomalous script-like payloads being stored in database fields associated with course settings.

Sources

SourceLink
github.comgithub.com/chamilo/chamilo-lms/releases/tag/v1.11.34
github.comgithub.com/chamilo/chamilo-lms/security/advisories/GHSA-pxrh-3rcp-h7m6

Frequently asked

questions

Yes. Any attacker who can obtain a low-privileged account with access to the affected Settings field can exploit the vulnerability remotely by injecting malicious JavaScript, which then executes in other users' browsers when they view the compromised course page.

The attacker needs an authenticated account with permissions to modify the course learning path Settings field, typically a trainer or similar role. No elevated system privileges are required beyond that.

The most robust fix is to ensure that all user-controlled content is properly and contextually encoded before being rendered, and to optionally sanitize rich-text inputs using an allowlist-based HTML sanitizer. Aligning template rendering with a framework that encodes by default and disallows raw HTML output by default significantly reduces risk.

Prevention strategies include adopting secure coding standards that mandate output encoding for all untrusted data, integrating automated XSS-focused tests and static analysis into the CI/CD pipeline, limiting where rich HTML is allowed, deploying a strong Content Security Policy, and performing periodic security reviews of features that allow user-generated content.

Find out what's already
exploitable in your codebase.