CVE-2024-7931
📋 TL;DR
This critical SQL injection vulnerability in SourceCodester Online Graduate Tracer System 1.0 allows remote attackers to execute arbitrary SQL commands via the 'id' parameter in the /tracking/admin/view_csprofile.php file. This can lead to unauthorized data access, modification, or deletion. Organizations using this specific version of the software are affected.
💻 Affected Systems
- SourceCodester Online Graduate Tracer System
📦 What is this software?
⚠️ Risk & Real-World Impact
Worst Case
Complete database compromise including data exfiltration, data destruction, or full system takeover via SQL injection leading to remote code execution.
Likely Case
Unauthorized access to sensitive student/graduate data, administrative credential theft, and potential data manipulation.
If Mitigated
Limited impact with proper input validation, parameterized queries, and network segmentation in place.
🎯 Exploit Status
Exploit details publicly available on GitHub. SQL injection via GET parameter manipulation.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Unknown
Vendor Advisory: None available
Restart Required: No
Instructions:
1. Check vendor website for updates
2. Apply parameterized queries to /tracking/admin/view_csprofile.php
3. Implement input validation for 'id' parameter
4. Test thoroughly before deployment
🔧 Temporary Workarounds
Web Application Firewall (WAF) Rules
allImplement WAF rules to block SQL injection patterns targeting the vulnerable endpoint
# Example ModSecurity rule:
SecRule REQUEST_URI "@streq /tracking/admin/view_csprofile.php" \
"id:1001,phase:2,deny,status:403,msg:'SQLi attempt blocked'" \
"chain"
SecRule ARGS:id "@detectSQLi"
Input Validation Filter
allAdd input validation to only accept numeric values for the 'id' parameter
// PHP code snippet:
$id = $_GET['id'];
if (!is_numeric($id) || $id <= 0) {
http_response_code(400);
exit('Invalid ID');
}
// Use prepared statement:
$stmt = $conn->prepare('SELECT * FROM profiles WHERE id = ?');
$stmt->bind_param('i', $id);
$stmt->execute();
🧯 If You Can't Patch
- Isolate the vulnerable system behind a reverse proxy with strict input validation
- Implement network segmentation to limit database access from web server
🔍 How to Verify
Check if Vulnerable:
Test the endpoint with SQL injection payloads: /tracking/admin/view_csprofile.php?id=1' OR '1'='1
Check Version:
Check system documentation or admin panel for version information
Verify Fix Applied:
Test with same payloads and verify proper error handling or rejection occurs
📡 Detection & Monitoring
Log Indicators:
- Multiple failed SQL queries in web server logs
- Unusual database access patterns from web server IP
- HTTP 500 errors on /tracking/admin/view_csprofile.php
Network Indicators:
- SQL keywords in HTTP GET parameters (SELECT, UNION, etc.)
- Unusual database port traffic from web servers
SIEM Query:
source="web_logs" AND uri="/tracking/admin/view_csprofile.php" AND (query="*SELECT*" OR query="*UNION*" OR query="*OR '1'='1*")