Summary
Chamilo versions prior to 1.11.34 contain a stored cross-site scripting (XSS) vulnerability in the course description field that allows low-privileged users to inject malicious JavaScript.
When other users, including administrators, view the affected course information page, the injected script executes in their browser, potentially leading to session theft and account takeover.
Affected context
This vulnerability appears in Chamilo learning management system deployments where:
- Low-privileged users (such as trainers) can create or edit course descriptions.
- The course description content is rendered on the course information page without robust output encoding or sanitization.
- User browsers execute scripts in the same origin as the Chamilo application when viewing course information.
The issue becomes relevant in multi-user environments where users with differing privilege levels access shared course pages.
Exploit preconditions
- Attack surface: Web interface, specifically the workflow for creating or editing course descriptions and viewing course information pages.
- Required access: A valid low-privileged Chamilo account capable of editing the course description field (e.g., trainer or equivalent).
- Trigger point: Any user, including administrators, browsing to the course information page that displays the stored, unsanitized course description.
- Why exploitation is possible: User-controlled HTML/JavaScript content from the course description field is persisted server-side and later rendered into the page without proper contextual output encoding, enabling execution of attacker-supplied scripts in other users' browsers.
Why this happens
The underlying bug is a classic stored cross-site scripting issue, mapped to CWE-79: Improper Neutralization of Input During Web Page Generation.
The application stores user-supplied course description data and later includes it in HTML responses without consistently applying context-aware output encoding or HTML sanitization.
As a result, special characters and script-related constructs are interpreted by the browser as executable code instead of inert text.
The abstract pattern is: untrusted, persistent user input is embedded into a web page's DOM without neutralization, allowing scripts to execute in the application's origin.
Potential impact
- Theft of session cookies or authentication tokens from users who view the compromised course page.
- Account takeover of higher-privileged users, including administrators or course managers.
- Execution of arbitrary JavaScript in victims' browsers, enabling actions on their behalf (e.g., changing settings, adding new users, modifying courses).
- Unauthorized access to sensitive information displayed or accessible in the web UI.
- Use of compromised accounts as a stepping stone for broader platform abuse or data exfiltration.
General mitigation guidance
Effective mitigation generally focuses on output encoding and strict handling of untrusted content:
- Consistently apply context-aware output encoding for all user-controlled data rendered in HTML, attributes, JavaScript, or URLs.
- Use a robust HTML sanitization library to strip or neutralize script-related elements and dangerous attributes from rich-text fields such as course descriptions.
- Prefer safe-by-default templating frameworks that automatically escape variables unless explicitly marked as safe after sanitization.
- Limit or carefully scope any feature that allows HTML input; when rich formatting is required, allow only a minimal, whitelisted subset of tags and attributes.
- Enforce least-privilege principles for user roles so that compromised low-privileged accounts have restricted blast radius.
- Consider enabling defense-in-depth browser-side protections such as a strict Content Security Policy (CSP) to reduce the impact of residual XSS issues.
How teams detect issues like this
Detection usually combines code inspection with automated checks:
- Static analysis: Configure SAST tools to flag raw insertion of user-controlled variables into templates without passing through an escaping or sanitization function, particularly in views that render course descriptions.
- Code review signals: During manual review, look for:
- Direct concatenation of user input into HTML.
- Use of frameworks' "unsafe" or "raw" output mechanisms.
- Bypasses or disabling of sanitization filters for rich-text fields.
- Dynamic testing: Employ DAST or browser-based scanners configured to test for stored XSS by injecting markers into persistent fields (like course descriptions) and checking later page loads.
- Security policy enforcement: Integrate linting rules or pre-commit hooks that require contextual encoding for templated outputs and disallow inline script insertion patterns.

