Summary
Guardian language-system contains a critical SQL injection flaw where the id GET parameter is concatenated directly into a SQL query in subtitles.php.
An authenticated attacker can manipulate this parameter to perform error-based SQL injection and extract sensitive database contents under affected configurations.
Affected context
The vulnerability resides in the subtitles retrieval functionality (subtitles.php) of the Guardian language-system, where user-supplied input controls database queries.
It becomes relevant in deployments that rely on dynamic GET parameters for file lookup and where the database server returns detailed error messages or supports error-based inference techniques.
Systems using shared credentials for the application's database connection and storing sensitive data in the same schema are particularly exposed to broader compromise.
Exploit preconditions
- Attack surface: HTTP(S) endpoint exposing
subtitles.phpwith anidGET parameter. - Required access: Valid authenticated session in the application (as indicated by the vulnerability description).
- Trigger point: Supplying crafted values in the
idquery string parameter that reach the SQL querySELECT id, filename, extension, type FROM files where id = '<id>'. - Why exploitation is possible: The application directly concatenates the
idparameter into the SQL string without input validation, escaping, or parameterization, allowing the attacker to alter query structure and invoke error-based extraction techniques.
Why this happens
This issue is a classic case of SQL injection, covered by CWE-89: Improper Neutralization of Special Elements used in an SQL Command.
The code builds SQL by concatenating raw user input ($_GET['id']) into the query, relying on quoting rather than structured parameter binding.
Without prepared statements or robust input normalization, special characters and SQL operators embedded in the parameter are interpreted by the database engine as part of the command, rather than as data.
This design breaks the assumption that user data is inert and allows attackers to drive query logic, pivot to error-based information disclosure, and enumerate database contents.
Potential impact
- An attacker may extract full contents of database tables, including user records and configuration data.
- Attackers could enumerate schema details (tables, columns, indexes) via error-based introspection.
- SQL injection could allow modification or deletion of records, leading to data integrity loss.
- Under certain database configurations, the attacker may escalate to file read/write or execution of database-level procedures.
- Compromise of authentication data stored in the database can enable broader account takeover.
General mitigation guidance
Effective mitigation focuses on eliminating direct string concatenation of untrusted input in SQL commands and reducing trust in runtime parameters.
Common defensive patterns include:
- Using parameterized queries or prepared statements so that the database treats user input strictly as data.
- Applying centralized input validation for identifiers and resource keys, restricting them to expected formats (e.g., integers or UUIDs).
- Adopting a data access layer that disallows ad-hoc SQL construction in presentation scripts such as
subtitles.php. - Limiting database privileges of the application account to only necessary operations and specific schemas.
- Designing error handling so that database error messages are not exposed directly to users, reducing feedback that aids error-based attacks.
How teams detect issues like this
Detection typically involves combining static analysis, code review, and runtime monitoring.
Static analysis tools can flag dynamic SQL construction that incorporates superglobals like $_GET without parameterization or escaping.
Manual code review should focus on scripts that interact with the database, looking for inline SQL strings and concatenated variables, especially around authentication-gated endpoints.
Runtime protections such as web application firewalls or query anomaly detection can identify suspicious patterns, like injected operators or tautologies in query parameters.
Policy-based controls in CI/CD pipelines can enforce the use of prepared statements and prohibit direct SQL building in controller or view layers.

