CVE-2024-8342
📋 TL;DR
This critical vulnerability in SourceCodester Petshop Management System 1.0 allows attackers to upload arbitrary files via the /controllers/add_client.php endpoint. Remote attackers can exploit this to upload malicious files like web shells, potentially gaining full control of affected systems. All deployments of version 1.0 are vulnerable.
💻 Affected Systems
- SourceCodester Petshop Management System
📦 What is this software?
⚠️ Risk & Real-World Impact
Worst Case
Complete system compromise via web shell upload leading to remote code execution, data theft, and lateral movement within the network.
Likely Case
Attackers upload PHP web shells to gain persistent access, deface websites, or steal sensitive pet shop data and customer information.
If Mitigated
File uploads are blocked or properly validated, preventing malicious file execution while maintaining legitimate functionality.
🎯 Exploit Status
Public exploit details are available on GitHub. The vulnerability requires no authentication and has simple exploitation steps.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Unknown
Vendor Advisory: https://www.sourcecodester.com/
Restart Required: No
Instructions:
No official patch available. Check vendor website for updates or consider alternative solutions.
🔧 Temporary Workarounds
Block access to vulnerable endpoint
allUse web server configuration to block access to /controllers/add_client.php
# Apache: Add to .htaccess
RewriteRule ^controllers/add_client\.php$ - [F,L]
# Nginx: Add to server block
location ~ /controllers/add_client\.php$ { deny all; }
Implement file upload validation
allAdd server-side validation to restrict file types and extensions
# Example PHP validation
$allowed_extensions = ['jpg', 'png', 'gif'];
$file_extension = strtolower(pathinfo($_FILES['image_profile']['name'], PATHINFO_EXTENSION));
if (!in_array($file_extension, $allowed_extensions)) {
die('Invalid file type');
}
🧯 If You Can't Patch
- Remove or disable the Petshop Management System entirely
- Implement network segmentation and isolate the vulnerable system from critical assets
🔍 How to Verify
Check if Vulnerable:
Check if /controllers/add_client.php exists and accepts file uploads without proper validation. Attempt to upload a test file with disallowed extension.
Check Version:
Check application files or documentation for version 1.0 references
Verify Fix Applied:
Verify that file uploads are properly validated or the endpoint is blocked. Test with malicious file upload attempts.
📡 Detection & Monitoring
Log Indicators:
- Unusual file uploads to /controllers/add_client.php
- Uploads of non-image files (php, exe, etc.)
- Multiple failed upload attempts
Network Indicators:
- POST requests to /controllers/add_client.php with file uploads
- Traffic patterns suggesting web shell communication
SIEM Query:
source="web_server" AND (uri="/controllers/add_client.php" OR file_upload="true")