/modal_add_product.php
A SQL injection vulnerability was found in the '/modal_add_product.php' file of the 'Class and Exam Timetabling System' project. The reason for this issue is that attackers inject malicious code from the parameter 'fname' and use it directly in SQL queries without the need for appropriate cleaning or validation. This allows attackers to forge input values, thereby manipulating SQL queries and performing unauthorized operations.
Attackers can exploit this SQL injection vulnerability to achieve unauthorized database access, sensitive data leakage, data tampering, comprehensive system control, and even service interruption, posing a serious threat to system security and business continuity.
During the security review of "Class and Exam Timetabling System", I discovered a SQL injection vulnerability in the "/modal_add_product.php" file. This vulnerability stems from insufficient user input validation of the 'fname' parameter, allowing attackers to inject malicious SQL queries. Therefore, attackers can gain unauthorized access to databases, modify or delete data, and access sensitive information. Immediate remedial measures are needed to ensure system security and protect data integrity.
Source code evidence: the parameter is read from $_POST around line 59, and it is concatenated into mysqli_query() around line(s) 65-66 in D:\docker_projects\class_exam_timetabling_docker\app\admin\modal_add_product.php.
Local Docker validation: POST /admin/modal_add_product.php with a quoted fname payload returned HTTP 200 and SQL error output without sending an authenticated session cookie.
POST parameters in this request: fname, lname, arank, designation, department, go.
Vulnerability lonameion:
Raw HTTP request example:
The raw request has been saved as modal_add_product_request.txt for sqlmap testing.
The following are screenshots of some specific information obtained from testing and running with the sqlmap tool:
Use prepared statements and parameter binding: Preparing statements can prevent SQL injection as they separate SQL code from user input data. When using prepared statements, the value entered by the user is treated as pure data and will not be interpreted as SQL code.
Input validation and filtering: Strictly validate and filter user input data to ensure it conforms to the expected format.
Minimize database user permissions: Ensure that the account used to connect to the database has the minimum necessary permissions. Avoid using accounts with advanced permissions such as root or admin for daily operations.
Regular security audits: Regularly conduct code and system security audits to promptly identify and fix potential security vulnerabilities.
The full story
This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.
