CVE-2025-4818

7.3 HIGH

📋 TL;DR

This critical SQL injection vulnerability in SourceCodester Doctor's Appointment System 1.0 allows remote attackers to execute arbitrary SQL commands via the ID parameter in /admin/delete-doctor.php. Attackers can potentially read, modify, or delete database content, including sensitive patient and doctor information. All installations of version 1.0 are affected.

💻 Affected Systems

Products:
  • SourceCodester Doctor's Appointment System
Versions: 1.0
Operating Systems: All platforms running PHP
Default Config Vulnerable: ⚠️ Yes
Notes: All installations of version 1.0 are vulnerable regardless of configuration.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete database compromise leading to data theft, data destruction, and potential remote code execution via database functions.

🟠

Likely Case

Unauthorized access to sensitive medical records, appointment data, and administrative credentials stored in the database.

🟢

If Mitigated

Limited impact if proper input validation and database permissions restrict damage to non-critical tables.

🌐 Internet-Facing: HIGH - The vulnerability is remotely exploitable and affects web-facing systems directly.
🏢 Internal Only: MEDIUM - Internal systems are still vulnerable but have reduced attack surface compared to internet-facing deployments.

🎯 Exploit Status

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

Exploit requires admin access to reach /admin/delete-doctor.php endpoint, but SQL injection itself is straightforward once authenticated.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Unknown

Vendor Advisory: https://www.sourcecodester.com/

Restart Required: No

Instructions:

No official patch available. Consider implementing parameterized queries or input validation as workaround.

🔧 Temporary Workarounds

Input Validation and Sanitization

all

Add server-side validation to ensure ID parameter contains only numeric characters

Modify /admin/delete-doctor.php to include: if(!is_numeric($_GET['ID'])) { die('Invalid input'); }

Web Application Firewall Rules

all

Block SQL injection patterns targeting the delete-doctor.php endpoint

WAF rule: Block requests to /admin/delete-doctor.php containing SQL keywords in GET parameters

🧯 If You Can't Patch

  • Restrict access to /admin/ directory using IP whitelisting or authentication requirements
  • Implement database user with minimal privileges (read-only where possible) for the application

🔍 How to Verify

Check if Vulnerable:

Test by accessing /admin/delete-doctor.php?ID=1' OR '1'='1 and checking for SQL errors or unexpected behavior

Check Version:

Check system version in admin panel or review source code for version markers

Verify Fix Applied:

Attempt SQL injection payloads and verify they are rejected or sanitized

📡 Detection & Monitoring

Log Indicators:

  • SQL syntax errors in web server logs
  • Multiple failed delete requests with malformed ID parameters
  • Unusual database queries from web application user

Network Indicators:

  • HTTP requests to /admin/delete-doctor.php containing SQL keywords (UNION, SELECT, INSERT, etc.)
  • Abnormal traffic patterns to admin endpoints

SIEM Query:

source="web_server" AND (uri="/admin/delete-doctor.php" AND (query="*UNION*" OR query="*SELECT*" OR query="*INSERT*"))

🔗 References

📤 Share & Export