Summary
Guardian language-system contains a critical SQL injection flaw where the id GET parameter is concatenated directly into an SQL query without sanitization.
An authenticated attacker can use error-based SQL injection through translate_text.php to extract sensitive database contents when the application executes the crafted query.
Affected context
This vulnerability arises in the Guardian language-system's translate_text.php endpoint, specifically around line 15 where file metadata is loaded by id.
It occurs when user-supplied GET parameters are interpolated directly into SQL strings and executed by the database layer without parameterization, escaping, or input validation.
Exploit preconditions
- Attack surface: HTTP request to translate_text.php using the id GET parameter
- Required access: Authenticated access to the application endpoint
- Trigger point: Execution of the SQL query
SELECT id, filename, extension, type FROM files where id = '<user_input>' - Why exploitation is possible: The application directly concatenates user input into the WHERE clause, allowing crafted payloads to alter the query structure and invoke database error responses that reveal data
Why this happens
The underlying issue is constructing SQL queries by string concatenation using unchecked user input.
This behavior maps directly to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where control characters, operators, or additional statements are not neutralized before reaching the database.
Instead of using prepared statements with bound parameters, the application trusts the id parameter as-is, enabling attackers to manipulate the query logic and extract information via error messages and response variations.
Potential impact
- An attacker may extract sensitive records from the files table and related tables.
- Attackers could read authentication or session-related data stored in the database.
- The database schema and structure could be enumerated via error-based probing.
- Depending on configuration, attackers can potentially modify or delete data.
- In some environments, SQL injection can lead to broader system compromise through database-level features.
General mitigation guidance
Effective mitigation centers on eliminating dynamic SQL built from raw user input and adopting secure-by-default database access patterns.
Common defensive approaches include:
- Using prepared statements or parameterized queries for all user-influenced SQL.
- Implementing strict server-side validation and normalization of identifier parameters such as id.
- Segregating database privileges so that application accounts only have the minimum operations needed.
- Applying centralized query-building utilities that enforce parameterization and forbid ad hoc string concatenation.
- Designing error handling to avoid exposing detailed database error messages to callers.
How teams detect issues like this
Teams can detect this class of issue by:
- Static analysis rules that flag SQL strings concatenated with variables originating from HTTP request parameters.
- Code reviews that look for direct uses of
$_GET,$_POST, or other input sources in query construction. - Security testing and fuzzing that attempt to inject SQL control characters and observe error-based behaviors or response anomalies.
- Enforcing development policies that mandate prepared statements and prohibit raw, inline SQL from user input.

