Summary
Chamilo's glossary feature contained a stored cross-site scripting (XSS) issue that allowed teachers to persistently inject malicious JavaScript code.
When an administrator later viewed the compromised glossary entries, the attacker-controlled script could execute in the admin's browser, potentially leading to account takeover and unauthorized actions within the LMS.
Affected context
The vulnerability arises in Chamilo installations where the glossary function is enabled and teachers are allowed to create or edit glossary entries.
Malicious content is stored server-side and rendered in views accessible to higher-privileged users, such as administrators.
The issue manifests when the application fails to neutralize or encode user-supplied glossary terms or descriptions before displaying them in HTML pages.
Exploit preconditions
- Attack surface: Web interface of the Chamilo LMS, specifically the glossary management and viewing pages.
- Required access: An authenticated account with at least Teacher-level privileges capable of adding or modifying glossary entries.
- Trigger point: A privileged user (e.g., administrator) visits a page that displays the stored glossary entry containing injected script.
- Why exploitation is possible: The glossary feature stores user-provided HTML/markup without sufficient output encoding or sanitization, allowing embedded scripts to execute in the browser of any user who views the content.
Why this happens
The core issue maps to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting).
The glossary component accepts user-controlled text from teachers and later renders it into HTML responses without robust output encoding, HTML filtering, or content sanitization.
Because the application treats this content as trusted when generating pages for other users, including administrators, embedded script elements or event handlers are interpreted by the browser as active JavaScript rather than inert text.
This pattern—storing untrusted input and reusing it across views without appropriate context-aware escaping—is characteristic of stored XSS vulnerabilities.
Potential impact
- Execution of arbitrary JavaScript in the administrator's browser session.
- Theft of administrator session tokens or other sensitive browser-stored data.
- Unauthorized administrative actions performed via the admin's session (e.g., creating accounts, changing configurations).
- Defacement or manipulation of LMS content visible to many users.
- Lateral movement to other internal systems if the admin's browser has access to additional applications or management consoles.
General mitigation guidance
Effective mitigation focuses on treating all user-supplied content as untrusted and enforcing strict output encoding:
- Apply context-aware output encoding (HTML, attribute, JavaScript) to all glossary fields before rendering them in templates.
- Use a well-maintained HTML sanitization library to remove or neutralize scripts, event handlers, and dangerous attributes from rich text fields.
- Prefer a whitelist-based approach for allowed HTML tags and attributes, or disable raw HTML entirely in glossary entries.
- Enforce a secure templating system that automatically escapes variables by default, only allowing explicit, reviewed exceptions.
- Restrict the privileges associated with Teacher roles to the minimum necessary and separate high-risk content authoring from administrative views where possible.
How teams detect issues like this
Organizations can identify similar XSS issues through a combination of testing and code analysis:
- Static analysis: Look for templates or view functions that interpolate user-controlled glossary fields directly into HTML without encoding or sanitization.
- Code review: Flag any use of raw HTML output, disabled escaping, or custom rendering paths for glossary or other content fields.
- Dynamic testing: Use web security scanners and manual penetration testing to submit XSS test payloads in glossary entries and confirm whether they execute when viewed by other roles.
- Security policies: Enforce development guidelines requiring context-aware escaping and standardized sanitization libraries for all user-generated content components.

