CVE-2020-22174

7.5 HIGH

📋 TL;DR

CVE-2020-22174 is a SQL injection vulnerability in PHPGurukul Hospital Management System v4.0 that allows remote unauthenticated attackers to execute arbitrary SQL commands via the book-appointment.php file. This enables attackers to extract sensitive database information including patient records, user credentials, and system data. Any organization using the vulnerable version of this PHP-based hospital management software is affected.

💻 Affected Systems

Products:
  • PHPGurukul Hospital Management System
Versions: Version 4.0
Operating Systems: Any OS running PHP
Default Config Vulnerable: ⚠️ Yes
Notes: The vulnerability exists in the default installation of version 4.0. No special configuration is required for exploitation.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete database compromise leading to theft of all patient medical records, financial data, and administrative credentials, potentially enabling further system takeover and data manipulation.

🟠

Likely Case

Extraction of sensitive patient information and user credentials, leading to data breaches and potential unauthorized access to the hospital management system.

🟢

If Mitigated

Limited information disclosure if proper input validation and database permissions are in place, though SQL injection would still be possible.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Public exploit code is available on GitHub, making exploitation trivial for attackers with basic SQL injection knowledge.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Unknown

Vendor Advisory: No official vendor advisory found

Restart Required: No

Instructions:

1. Review the vulnerable book-appointment.php file
2. Implement proper input validation and parameterized queries
3. Sanitize all user inputs before database interaction
4. Consider upgrading to a newer version if available

🔧 Temporary Workarounds

Input Validation and Sanitization

all

Add input validation and sanitization to the book-appointment.php file to prevent SQL injection

# Edit book-appointment.php to implement prepared statements
# Example: Replace direct SQL with mysqli_prepare() or PDO prepared statements

Web Application Firewall (WAF)

all

Deploy a WAF with SQL injection protection rules to block exploitation attempts

# Configure WAF rules to block SQL injection patterns
# Example mod_security rules for Apache

🧯 If You Can't Patch

  • Isolate the system from internet access and restrict to internal network only
  • Implement strict network segmentation and monitor all database queries from the application

🔍 How to Verify

Check if Vulnerable:

Check if the system is running PHPGurukul Hospital Management System v4.0 and examine the book-appointment.php file for lack of input validation and parameterized queries.

Check Version:

# Check version in system files or database configuration
# Look for version information in admin panel or configuration files

Verify Fix Applied:

Test the book-appointment.php endpoint with SQL injection payloads to ensure they are properly blocked or sanitized.

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL error messages in application logs
  • Multiple failed login attempts or SQL queries with suspicious patterns
  • Requests to book-appointment.php with SQL keywords in parameters

Network Indicators:

  • HTTP requests containing SQL injection payloads to the book-appointment.php endpoint
  • Unusual database query patterns from the application server

SIEM Query:

source="web_logs" AND uri="/hms/book-appointment.php" AND (query CONTAINS "UNION" OR query CONTAINS "SELECT" OR query CONTAINS "OR 1=1")

🔗 References

📤 Share & Export