CVE-2024-6216

6.3 MEDIUM

📋 TL;DR

This critical SQL injection vulnerability in SourceCodester Food Ordering Management System 1.0 allows attackers to manipulate database queries through the 'contact' parameter in add-users.php. Attackers can execute arbitrary SQL commands remotely, potentially compromising the entire database. All users running the affected version are vulnerable.

💻 Affected Systems

Products:
  • SourceCodester Food Ordering Management System
Versions: 1.0
Operating Systems: Any OS running PHP
Default Config Vulnerable: ⚠️ Yes
Notes: The vulnerability exists in the default installation. Any deployment using the vulnerable add-users.php file is affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete database compromise including data theft, data manipulation, privilege escalation, and potential remote code execution via database functions.

🟠

Likely Case

Unauthorized data access, user account compromise, and potential administrative access to the food ordering system.

🟢

If Mitigated

Limited impact with proper input validation, parameterized queries, and network segmentation preventing database access.

🌐 Internet-Facing: HIGH - The vulnerability is remotely exploitable and public exploit code exists.
🏢 Internal Only: MEDIUM - Internal attackers could exploit this if they have network access to the system.

🎯 Exploit Status

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

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

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Unknown

Vendor Advisory: None found

Restart Required: No

Instructions:

No official patch available. Consider manual code fixes or system replacement.

🔧 Temporary Workarounds

Input Validation and Sanitization

all

Add proper input validation and parameterized queries to the add-users.php file

Modify PHP code to use prepared statements: $stmt = $conn->prepare('INSERT INTO users (contact) VALUES (?)'); $stmt->bind_param('s', $contact);

Web Application Firewall (WAF)

all

Deploy WAF rules to block SQL injection patterns

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

🧯 If You Can't Patch

  • Isolate the system behind a firewall with strict access controls
  • Implement network segmentation to limit database access from web servers

🔍 How to Verify

Check if Vulnerable:

Test the add-users.php endpoint with SQL injection payloads in the 'contact' parameter

Check Version:

Check system documentation or admin panel for version information

Verify Fix Applied:

Attempt SQL injection after implementing parameterized queries and verify payloads are rejected

📡 Detection & Monitoring

Log Indicators:

  • Unusual SQL error messages in web server logs
  • Multiple failed login attempts from single IP
  • Suspicious database queries in application logs

Network Indicators:

  • SQL keywords in HTTP POST parameters
  • Unusual database connection patterns
  • High volume of requests to add-users.php

SIEM Query:

source="web_logs" AND ("union select" OR "' OR '1'='1" OR "--" OR ";--") AND uri="*add-users.php*"

🔗 References

📤 Share & Export