Summary
The Online Reviewer System 1.0 contains a SQL injection vulnerability in the pretest-taking functionality, where the ID parameter in index.php is incorporated into database queries without proper sanitization.
A remote attacker can manipulate this parameter to alter SQL queries, which may lead to unauthorized data access, modification, or other database-level impacts.
Affected context
This vulnerability occurs in the Online Reviewer System 1.0, specifically within the student assessments pretest module at /system/system/students/assessments/pretest/take/index.php.
It is present when the application accepts an ID parameter from user-controlled input (such as query string or form data) and uses it directly in SQL statements without robust input validation, parameterization, or context-aware escaping.
Deployments that expose this endpoint to untrusted networks, such as the public internet, are more susceptible to exploitation.
Exploit preconditions
- Attack surface: HTTP request interface to
/system/system/students/assessments/pretest/take/index.php - Required access: Remote, unauthenticated or low-privileged access to the pretest-taking functionality, depending on how the application is deployed and protected
- Trigger point: Supplying crafted data via the
IDparameter in a web request so that it becomes part of a dynamically constructed SQL query - Why exploitation is possible: The application constructs SQL statements by concatenating or interpolating raw
IDparameter values into query strings without using prepared statements or adequate context-specific sanitization, enabling attackers to inject additional SQL syntax
Why this happens
The root cause aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
The code that handles the ID parameter appears to directly mix user input into SQL queries, often via string concatenation or unsafe interpolation, without consistently using parameterized queries or rigorous input validation.
Additionally, the broader pattern maps to CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component, since untrusted input is passed to the database (a downstream interpreter) where SQL meta-characters are not neutralized.
This insecure pattern allows attackers to treat data as part of the SQL command structure rather than as a purely literal value.
Potential impact
- May allow an attacker to read sensitive information from database tables, including student records and assessment data
- Could enable modification or deletion of assessment content, questions, or results
- May allow creation or manipulation of user accounts, potentially escalating privileges within the application
- Could corrupt grading data, leading to inaccurate scores and academic integrity issues
- In some configurations, may enable further compromise of the underlying system if the database has extended capabilities or excessive privileges
General mitigation guidance
Effective mitigation centers on treating all user-controlled input as untrusted and strictly separating data from SQL command structure.
Common defensive patterns include:
- Using parameterized queries or prepared statements for all database operations, ensuring that input is bound as data rather than concatenated into SQL strings
- Applying strict server-side validation on the
IDparameter (e.g., ensuring it conforms to expected numeric or UUID formats) and rejecting unexpected patterns - Employing context-appropriate escaping at the database driver layer when parameterization is not possible, while recognizing this as secondary to prepared statements
- Implementing least-privilege database accounts so the application can perform only the minimum operations required (e.g., no unnecessary DROP/ALTER privileges)
- Centralizing data-access patterns through a well-reviewed data access layer instead of ad-hoc query construction in page controllers
- Enforcing secure coding guidelines and training for developers on injection-safe patterns
How teams detect issues like this
Detection typically combines code-focused and behavior-focused approaches:
- Static analysis: Configure SAST tools and linters to flag dynamic SQL construction patterns (string concatenation, interpolation) where user input like
$_GET['ID']or similar constructs flow into query APIs - Code review: Look for direct use of request parameters in SQL statements, missing prepared statements, and lack of validation or type-casting for primary key fields
- Runtime monitoring: Use database activity monitoring to detect anomalous queries (e.g., unexpected OR 1=1 patterns, UNION queries, or schema enumeration) originating from the application
- Security testing: Incorporate automated and manual injection testing in CI/CD pipelines and during periodic security assessments, focusing on parameters such as
IDin dynamic endpoints

