HIGH 7.2

CVE-2026-40083: Cacti SQL Injection in SNMP Manager Feature (v1.2.30 and Prior)

Cacti, a widely-deployed open source framework for performance monitoring and fault management, contains a SQL injection flaw in its SNMP agent management feature. An authenticated attacker with SNMP manager permissions can manipulate serialized data in a request parameter to inject arbitrary SQL commands into the database. The vulnerability stems from unsafe deserialization followed by direct concatenation of unsanitized values into a DELETE query. Cacti versions 1.2.30 and earlier are affected; the fix is available in version 1.2.31.

Source data · NVD / CISA · public domain

CVSS
3.1 · 7.2 HIGH · CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H
Weaknesses (CWE)
CWE-89
Affected products
1 configuration(s)
Published / Modified
2026-06-25 / 2026-06-30

NVD description (verbatim)

Cacti is an open source performance and fault management framework. Versions 1.2.30 and prior have SQL Injection through unsanitized unserialize+implode in managers.php. At line 756 of managers.php, the application assigns $selected_items by calling cacti_unserialize(stripslashes(gnrv('selected_graphs_array'))). The cacti_unserialize() function calls unserialize() with allowed_classes set to false, which prevents object injection but still allows arbitrary string arrays to be deserialized. Then, at lines 760 to 766, the deserialized array values are passed directly into db_execute('DELETE FROM snmpagent_managers WHERE id IN (' . implode(',', $selected_items) . ')'), where they are imploded into the SQL statement without any integer validation, resulting in SQL Injection when using SNMP agent management permissions. This issue has been fixed in version 1.2.31.

3 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

The vulnerability exists in managers.php at lines 756–766. The application deserializes user-supplied input via cacti_unserialize(stripslashes(gnrv('selected_graphs_array'))), which calls PHP's unserialize() with allowed_classes=false to block object injection. However, this configuration still permits deserialization of arbitrary array structures. The resulting array is then directly imploded and injected into a DELETE statement: db_execute('DELETE FROM snmpagent_managers WHERE id IN (' . implode(',', $selected_items) . ')'). Because the array values undergo no integer type validation before concatenation, an attacker can supply malicious string payloads that escape the IN clause and inject additional SQL. Exploitation requires valid SNMP agent management permissions, limiting the attack surface to authenticated users with elevated privileges.

Business impact

This vulnerability allows a privileged insider or compromised admin account to exfiltrate sensitive data from the Cacti database, modify or delete monitoring records, or potentially escalate privileges depending on database user permissions. For organizations relying on Cacti for critical infrastructure monitoring (networks, servers, applications), database tampering could degrade visibility into system health and performance, obscure security events, or corrupt operational data. The high CVSS score (7.2) reflects the combination of high impact (confidentiality, integrity, availability all affected) and the authenticated but elevated-privilege attack vector.

Affected systems

Cacti versions 1.2.30 and all prior releases are vulnerable. The flaw is triggered only when an attacker possesses SNMP agent management permissions, so systems where that role is not assigned to any users face reduced risk. Organizations should audit who holds SNMP management roles and whether untrusted or former staff retain such access. Self-hosted and on-premises Cacti deployments are the primary concern; SaaS deployments depend on the provider's patching practices.

Exploitability

Exploitation requires valid authentication and SNMP agent management role assignment, which moderates the attack surface. No public exploit code has been reported, and the vulnerability is not tracked in CISA's Known Exploited Vulnerabilities catalog. However, the SQL injection mechanism is straightforward to weaponize once an attacker understands the serialization format and payload structure. The attack does not require user interaction and can be automated. Organizations should treat this as a moderately urgent but not imminent threat, with priority based on the number of high-privilege Cacti users and the sensitivity of data in the underlying database.

Remediation

Upgrade to Cacti version 1.2.31 or later. Before patching, restrict SNMP agent management permissions to only essential personnel and audit current role assignments. Ensure database user accounts running Cacti queries operate under the principle of least privilege (read/write only to required tables, not to system tables). Consider network segmentation to limit access to Cacti interfaces from trusted networks only. If immediate patching is not feasible, disable SNMP agent management features temporarily or restrict access to those pages via application-level controls.

Patch guidance

Verify the current Cacti version by checking /include/cacti/version.php or running the upgrade check in the Cacti web interface. Download version 1.2.31 or the latest stable release from the official Cacti website or repository. Test the upgrade in a non-production environment first, particularly if custom plugins or integrations are in use. Follow the official Cacti upgrade documentation and back up the database before applying patches. After upgrade, verify SNMP manager functionality works as expected and confirm the patched managers.php is in place.

Detection guidance

Monitor Cacti access logs for unusual requests to managers.php containing suspicious query parameters, especially those with uncommon characters or URL-encoded SQL syntax (e.g., %27, %20OR, UNION). Database query logs should be reviewed for unexpected DELETE statements against snmpagent_managers or similar tables. Web application firewalls (WAF) can be tuned to block requests with serialized array payloads or SQL injection patterns directed at manager-related endpoints. Additionally, monitor for database errors or warnings logged by the Cacti application that may indicate failed or malformed SQL execution.

Why prioritize this

This vulnerability merits prompt attention due to its HIGH severity rating, direct impact on data integrity and confidentiality, and the administrative context in which it operates. Although it requires authenticated access with elevated privileges, insider threats and compromised admin credentials are realistic scenarios. Cacti's role in infrastructure visibility makes database tampering particularly damaging. The existence of a tested patch (version 1.2.31) and the absence of known public exploits create a window to patch proactively before mass exploitation occurs.

Risk score, explained

The CVSS 3.1 score of 7.2 (HIGH) reflects: Attack Vector=Network (remotely exploitable), Attack Complexity=Low (no special conditions needed), Privileges Required=High (attacker must have SNMP manager role), User Interaction=None, Scope=Unchanged, and maximum impact on Confidentiality, Integrity, and Availability. The authentication requirement prevents an unauthenticated attacker from exploiting this, which moderates the overall score. However, the broad impact across all three CIA pillars and the straightforward nature of SQL injection keep the severity in the HIGH band.

Frequently asked questions

What data is at risk if this vulnerability is exploited?

Any data stored in the Cacti database is potentially at risk, including performance metrics, device configurations, user credentials, notification settings, and custom data. An attacker can extract, modify, or delete records from the snmpagent_managers table and potentially other tables depending on the database user's privileges. Sensitive information such as API keys or database credentials stored in configuration tables could also be compromised.

Do we need to patch if no users have SNMP manager permissions assigned?

If no users are assigned the SNMP agent management role, the direct attack vector is closed. However, you should still audit role assignments regularly to confirm this remains true. Additionally, upgrading to 1.2.31 is recommended as a general security hygiene measure to eliminate the code path entirely and protect against future misconfigurations or privilege escalations.

Can this vulnerability be exploited by an unauthenticated attacker?

No. The vulnerability requires valid Cacti authentication and explicit SNMP agent management permissions. Unauthenticated users cannot access the affected endpoint. This significantly limits the attack surface but does not eliminate risk from insider threats or compromised admin accounts.

Is there a workaround if we cannot patch immediately?

Yes. Disable SNMP agent management temporarily by removing or renaming the managers.php file, or use web server configuration to block access to that endpoint. Restrict Cacti access to a trusted network via firewall rules or VPN. Audit and minimize the number of users with SNMP manager role assignment. However, these are temporary measures; patching to 1.2.31 should be completed as soon as feasible.

This analysis is provided for informational purposes and is based on the published CVE description and CVSS scoring. SEC.co makes no warranty regarding the completeness or accuracy of this assessment. Readers should verify patch availability and applicability to their specific Cacti deployment with the official Cacti project advisories and documentation. Organizations should conduct their own risk assessment based on their environment, data sensitivity, and user access controls. No exploit code or weaponized proof-of-concept is provided or endorsed herein. Source: NVD (public-domain), retrieved 2026-08-04. Analysis generated by SEC.co (claude-haiku-4-5).