CVE-2023-39359
📋 TL;DR
An authenticated SQL injection vulnerability in Cacti allows authenticated users to escalate privileges and execute arbitrary code remotely. The vulnerability affects Cacti versions before 1.2.25 through improper handling of the site_id parameter in graphs.php. Organizations running vulnerable Cacti instances are at risk.
💻 Affected Systems
- Cacti
📦 What is this software?
Cacti by Cacti
Fedora by Fedoraproject
Fedora by Fedoraproject
⚠️ Risk & Real-World Impact
Worst Case
Attackers gain full system control through remote code execution, potentially compromising the entire monitoring infrastructure and adjacent systems.
Likely Case
Authenticated attackers escalate privileges to administrative access, manipulate monitoring data, and execute arbitrary SQL commands.
If Mitigated
With proper network segmentation and least privilege authentication, impact is limited to the Cacti application and database.
🎯 Exploit Status
Exploitation requires authenticated access but SQL injection to RCE chain is straightforward for skilled attackers.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 1.2.25
Vendor Advisory: https://github.com/Cacti/cacti/security/advisories/GHSA-q4wh-3f9w-836h
Restart Required: Yes
Instructions:
1. Backup Cacti database and configuration files. 2. Download Cacti 1.2.25 from official repository. 3. Replace existing installation with new version. 4. Run database upgrade script if prompted. 5. Restart web server and Cacti poller services.
🔧 Temporary Workarounds
No known workarounds
allThe vendor advisory states there are no known workarounds for this vulnerability.
🧯 If You Can't Patch
- Restrict network access to Cacti web interface using firewall rules to only trusted IP addresses
- Implement strict authentication controls and monitor for suspicious authenticated user activity
🔍 How to Verify
Check if Vulnerable:
Check Cacti version via web interface or examine include/global.php for version number
Check Version:
grep '\$config\["cacti_version"\]' /path/to/cacti/include/global.php
Verify Fix Applied:
Confirm version is 1.2.25 or later and verify graphs.php has been updated
📡 Detection & Monitoring
Log Indicators:
- Unusual SQL queries in database logs
- Multiple failed authentication attempts followed by successful login
- Suspicious parameter values in web server access logs for graphs.php
Network Indicators:
- Unusual outbound connections from Cacti server
- SQL injection patterns in HTTP requests to graphs.php
SIEM Query:
source="web_server_logs" AND uri="*graphs.php*" AND (param="*site_id*" OR query="*SELECT*" OR query="*UNION*")
🔗 References
- https://github.com/Cacti/cacti/security/advisories/GHSA-q4wh-3f9w-836h
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/CFH3J2WVBKY4ZJNMARVOWJQK6PSLPHFH/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WOQFYGLZBAWT4AWNMO7DU73QXWPXTCKH/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WZGB2UXJEUYWWA6IWVFQ3ZTP22FIHMGN/
- https://www.debian.org/security/2023/dsa-5550
- https://github.com/Cacti/cacti/security/advisories/GHSA-q4wh-3f9w-836h
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/CFH3J2WVBKY4ZJNMARVOWJQK6PSLPHFH/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WOQFYGLZBAWT4AWNMO7DU73QXWPXTCKH/
- https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/WZGB2UXJEUYWWA6IWVFQ3ZTP22FIHMGN/
- https://www.debian.org/security/2023/dsa-5550