Summary
Chamilo LMS has an unauthenticated SQL injection vulnerability in tag-search handling, where the options parameter supplied to extra_field.ajax.php can influence a database query. A remote attacker may be able to inject SQL and extract database information by sending a crafted POST request to an affected deployment.
Affected context
The issue affects Chamilo LMS 1.11.10 and versions before 1.11.16. It occurs in the searchOptionsFromTags function, which processes the options parameter from requests to extra_field.ajax.php and uses it in an SQL IN clause.
Exploit preconditions
- Attack surface: The
extra_field.ajax.phpendpoint, reachable over the network. - Required access: No authentication is required, according to the vulnerability description.
- Trigger point: A POST request containing a malicious JSON
optionsarray reaches tag-search processing. - Why exploitation is possible: Values from the request can affect SQL query structure if they are incorporated into the
INclause without safe parameterization.
Why this happens
The underlying bug is the unsafe construction of a database query using request-controlled values. When input is inserted into SQL syntax instead of being handled as data through parameterized queries, an attacker may alter the query's intended meaning. This is CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
Potential impact
- An attacker may retrieve database information accessible to the application's database account.
- Sensitive records could be exposed, depending on database permissions and application data.
- The confidentiality of the LMS and its users' data could be affected.
General mitigation guidance
Reduce risk by treating request parameters as untrusted and keeping them separate from SQL syntax.
Common defensive patterns include:
- Using parameterized queries or prepared statements for values in
INclauses. - Validating and constraining the expected structure and types of JSON input.
- Applying least-privilege permissions to database accounts.
- Returning only necessary data and limiting database access to the application's required scope.
- Using secure-by-default data-access abstractions that do not build SQL from raw input.
How teams detect issues like this
- Use static analysis to identify SQL statements assembled through string concatenation or interpolation with request data.
- Review endpoint handlers and database-access code for unsafe use of JSON values in query clauses.
- Enforce code-review and CI policies requiring parameterized queries for database operations.
- Monitor database and application logs for unusual requests to tag-search endpoints and unexpected query errors.

