Summary
Chamilo LMS has a SQL injection vulnerability in the session search action because the groupOp value in a crafted filter is not restricted to expected operators. An authenticated administrator who can invoke the action may trigger blind or time-based queries, potentially exposing or changing database data or disrupting service.
Chamilo LMS has a SQL injection vulnerability in the session search action because the groupOp value in a crafted filter is not restricted to expected operators. An authenticated administrator who can invoke the action may trigger blind or time-based queries, potentially exposing or changing database data or disrupting service.
Affected context
The issue occurs in the get_sessions action in /main/inc/ajax/model.ajax.php when session searches are requested with _search=true and JSON filters are processed. Chamilo versions before 1.11.40 and 2.0.1 are affected when attacker-controlled groupOp input reaches query logic without validation against the expected operators.
The issue occurs in the get_sessions action in /main/inc/ajax/model.ajax.php when session searches are requested with _search=true and JSON filters are processed. Chamilo versions before 1.11.40 and 2.0.1 are affected when attacker-controlled groupOp input reaches query logic without validation against the expected operators.
Exploit preconditions
- Attack surface: The session search action in Chamilo LMS.
- Required access: An authenticated administrator account.
- Trigger point: A search request with
_search=trueand a crafted JSONfiltersparameter. - Why exploitation is possible: The
groupOpvalue is not restricted to expected operators before being incorporated into query logic, allowing SQL syntax to influence database execution.
- Attack surface: The session search action in Chamilo LMS.
- Required access: An authenticated administrator account.
- Trigger point: A search request with
_search=trueand a crafted JSONfiltersparameter. - Why exploitation is possible: The
groupOpvalue is not restricted to expected operators before being incorporated into query logic, allowing SQL syntax to influence database execution.
Why this happens
The application incorporates attacker-controlled input into SQL query logic without ensuring that the input is a valid operator. This is an injection flaw mapped to CWE-89: Improper Neutralization of Special Elements used in an SQL Command. Insecure query construction allows input to be interpreted as SQL rather than only as data.
The application incorporates attacker-controlled input into SQL query logic without ensuring that the input is a valid operator. This is an injection flaw mapped to CWE-89: Improper Neutralization of Special Elements used in an SQL Command. Insecure query construction allows input to be interpreted as SQL rather than only as data.
Potential impact
- Sensitive user, course, session, configuration, password-reset, or administrative data could be disclosed.
- Database records could be modified or deleted, subject to the database account's privileges.
- Expensive delayed queries could degrade availability or cause denial of service.
- Sensitive user, course, session, configuration, password-reset, or administrative data could be disclosed.
- Database records could be modified or deleted, subject to the database account's privileges.
- Expensive delayed queries could degrade availability or cause denial of service.
General mitigation guidance
Mitigation generally focuses on keeping untrusted values from becoming executable SQL.
- Use parameterized queries for data values and avoid constructing SQL from request input.
- Validate operator choices against a narrow allowlist, such as the supported
ANDandORvalues. - Apply strict validation to structured search filters and reject unexpected fields or values.
- Use database accounts with only the privileges required by the application.
- Limit query cost and execution time where appropriate to reduce the impact of expensive searches.
Mitigation generally focuses on keeping untrusted values from becoming executable SQL.
- Use parameterized queries for data values and avoid constructing SQL from request input.
- Validate operator choices against a narrow allowlist, such as the supported
ANDandORvalues. - Apply strict validation to structured search filters and reject unexpected fields or values.
- Use database accounts with only the privileges required by the application.
- Limit query cost and execution time where appropriate to reduce the impact of expensive searches.
How teams detect issues like this
- Use static analysis to identify query construction that incorporates request-controlled values.
- Review search and filter handlers for operator values that are not validated against a fixed allowlist.
- Apply automated checks to flag unsafe SQL APIs and missing parameterization in code changes.
- Monitor database activity for unusual delayed queries, unexpected query patterns, or excessive search-related errors.
- Use static analysis to identify query construction that incorporates request-controlled values.
- Review search and filter handlers for operator values that are not validated against a fixed allowlist.
- Apply automated checks to flag unsafe SQL APIs and missing parameterization in code changes.
- Monitor database activity for unusual delayed queries, unexpected query patterns, or excessive search-related errors.

