A critical vulnerability (CVE-2022-43126) has been identified in the Online Diagnostic Lab Management System v1., which could potentially allow an attacker to execute malicious SQL queries and compromise the security and integrity of the application. This SQL injection vulnerability has been found in the 'id' parameter of the '/admin/tests/manage_test.php' page. As a result, an attacker with sufficient knowledge of the application and database schemas can exploit this vulnerability to gain unauthorized access to sensitive information, manipulate application data, or execute malicious code against the underlying server.

In this article, we provide a detailed description of the vulnerability, how it can be exploited, and steps that can be taken to mitigate the risk posed by this security issue. Additionally, we provide code snippets to demonstrate the vulnerability and links to the original references for further information.

Code Snippet

The following code snippet demonstrates the SQL injection vulnerability in the 'id' parameter of the '/admin/tests/manage_test.php' page. The snippet highlights the vulnerable code that processes the GET request to the 'manage_test.php' page without properly validating or sanitizing the user-supplied 'id' parameter.

// File: /admin/tests/manage_test.php

$id = $_GET['id'];

$sql = "SELECT * FROM tests WHERE id = $id";
$result = mysqli_query($conn, $sql);
$testDetails = mysqli_fetch_assoc($result);

Exploit Details

An attacker can craft an HTTP GET request to the '/admin/tests/manage_test.php' page with a malicious 'id' parameter value that includes a specially crafted SQL query. This would result in the SQL query being executed against the server's backend database, potentially leading to unauthorized access, data manipulation, or the execution of arbitrary code. The following example demonstrates a simple SQL injection attack using this vulnerability:

http://example.com/admin/tests/manage_test.php?id=1'; OR '1'='1

By using the above malicious URL, an attacker can modify the SQL query to return all records from the 'tests' table instead of a single record based on the intended "id" value. This may lead to sensitive information disclosure or allow further exploitation of the server.


To mitigate the risk of this SQL injection vulnerability, developers should implement proper input validation and sanitation to ensure that user-supplied data is safe for use in SQL queries. Additionally, the use of prepared statements or parameterized queries is highly recommended, as they effectively prevent SQL injection attacks by ensuring that user-supplied data is treated separately from the SQL query itself.

- CVE-2022-43126 - Official CVE Entry
- Online Diagnostic Lab Management System v1. - GitHub Repository
- OWASP Guide to SQL Injection Prevention


The SQL injection vulnerability in the Online Diagnostic Lab Management System v1. (CVE-2022-43126) has been identified, along with related exploit details and mitigation steps. It is essential for developers, administrators, and end-users to take the necessary precautions to secure their applications and data from potential attacks exploiting this vulnerability. If you are using this application, please ensure it is updated to the latest version and implement proper input validation and sanitation to protect your system from SQL injection attacks.


Published on: 11/01/2022 14:15:00 UTC
Last modified on: 11/01/2022 23:33:00 UTC