CVE-2024-7751

6.3 MEDIUM

📋 TL;DR

This is a critical SQL injection vulnerability in SourceCodester Clinics Patient Management System 1.0 that allows attackers to execute arbitrary SQL commands through the hidden_id parameter in /update_medicine.php. The vulnerability can be exploited remotely without authentication, potentially leading to data theft, manipulation, or system compromise. Healthcare organizations using this specific patient management system are affected.

💻 Affected Systems

Products:
  • SourceCodester Clinics Patient Management System
Versions: 1.0
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: The vulnerability exists in the default installation and requires no special configuration to be exploitable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete database compromise including patient medical records, administrative credentials theft, and potential remote code execution leading to full system takeover.

🟠

Likely Case

Unauthorized access to sensitive patient data (PII/PHI), modification of medical records, and potential ransomware deployment.

🟢

If Mitigated

Limited data exposure if proper input validation and WAF rules are in place, but system remains vulnerable to skilled attackers.

🌐 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 this easily weaponizable by attackers with basic SQL injection knowledge.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Unknown

Vendor Advisory: None available

Restart Required: No

Instructions:

1. Check SourceCodester website for security updates 2. If patch available, download and apply 3. Test functionality after patching 4. Monitor for any issues

🔧 Temporary Workarounds

WAF Rule Implementation

all

Deploy web application firewall rules to block SQL injection patterns targeting /update_medicine.php

# Example ModSecurity rule: SecRule ARGS:hidden_id "@detectSQLi" "id:1001,phase:2,deny,status:403,msg:'SQLi attempt detected'"

Input Validation Filter

all

Add server-side validation to sanitize hidden_id parameter before processing

# PHP example: $hidden_id = filter_var($_POST['hidden_id'], FILTER_SANITIZE_NUMBER_INT);

🧯 If You Can't Patch

  • Isolate the system behind a reverse proxy with strict input validation
  • Implement network segmentation to limit database access from web servers

🔍 How to Verify

Check if Vulnerable:

Test /update_medicine.php endpoint with SQL injection payloads in hidden_id parameter and observe database errors or unexpected responses.

Check Version:

Check system documentation or admin panel for version information; typically displayed in footer or about page.

Verify Fix Applied:

Attempt the same SQL injection tests after remediation; successful fixes should return proper error handling without database exposure.

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL error messages in web server logs
  • Multiple failed requests to /update_medicine.php with SQL keywords
  • Unexpected database query patterns

Network Indicators:

  • SQL injection payloads in POST requests to /update_medicine.php
  • Unusual outbound database connections from web server

SIEM Query:

source="web_logs" AND uri="/update_medicine.php" AND (message="sql" OR message="union" OR message="select" OR message="insert")

🔗 References

📤 Share & Export