CVE-2025-3697

6.3 MEDIUM

📋 TL;DR

This critical SQL injection vulnerability in SourceCodester Web-based Pharmacy Product Management System 1.0 allows remote attackers to execute arbitrary SQL commands via the ID parameter in /edit-product.php. This could lead to unauthorized data access, modification, or deletion. All users running version 1.0 are affected.

💻 Affected Systems

Products:
  • SourceCodester Web-based Pharmacy Product Management System
Versions: 1.0
Operating Systems: Any OS running PHP and MySQL/MariaDB
Default Config Vulnerable: ⚠️ Yes
Notes: Affects all installations of version 1.0. The vulnerability is in the core application code.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete database compromise including theft of sensitive pharmacy data (patient records, prescriptions), data destruction, and potential server takeover via SQL injection escalation.

🟠

Likely Case

Unauthorized access to product and inventory data, modification of pharmacy records, and potential extraction of user credentials.

🟢

If Mitigated

Limited impact with proper input validation and database permissions, potentially only allowing data viewing without modification.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

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

Public exploit available on GitHub. SQL injection is straightforward with known payloads.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Unknown

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

Restart Required: No

Instructions:

No official patch available. Consider migrating to alternative software or implementing workarounds.

🔧 Temporary Workarounds

Input Validation and Sanitization

all

Add parameterized queries or input validation to /edit-product.php

Modify edit-product.php to use prepared statements: $stmt = $conn->prepare('UPDATE products SET ... WHERE id = ?'); $stmt->bind_param('i', $_POST['ID']);

Web Application Firewall (WAF)

all

Deploy WAF rules to block SQL injection patterns

Add WAF rule: SecRule ARGS:ID "@rx (union|select|insert|update|delete|drop|--|#|\/\*|\*\/)" "id:1001,phase:2,deny,status:403,msg:'SQLi attempt'"

🧯 If You Can't Patch

  • Isolate the system behind a firewall with strict access controls
  • Implement database monitoring and alerting for suspicious SQL queries

🔍 How to Verify

Check if Vulnerable:

Test /edit-product.php with SQL injection payloads like: ID=1' OR '1'='1

Check Version:

Check application version in admin panel or readme files

Verify Fix Applied:

Test with same payloads after implementing fixes - should return error or no data

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL errors in application logs
  • Multiple failed login attempts after SQL injection attempts
  • Requests to /edit-product.php with SQL keywords in parameters

Network Indicators:

  • HTTP requests containing SQL injection patterns in ID parameter
  • Unusual database query patterns from application server

SIEM Query:

source="web_logs" AND uri="/edit-product.php" AND (query="*union*" OR query="*select*" OR query="*' OR '*" OR query="*--*" OR query="*#*")

🔗 References

📤 Share & Export