Cacti SQL Injection vulnerability in lib/api_automation.php caused by reading dirty data stored in database
Description
Cacti provides an operational monitoring and fault management framework. Prior to version 1.2.27, some of the data stored in automation_tree_rules.php is not thoroughly checked and is used to concatenate the SQL statement in create_all_header_nodes() function from lib/api_automation.php , finally resulting in SQL injection. Using SQL based secondary injection technology, attackers can modify the contents of the Cacti database, and based on the modified content, it may be possible to achieve further impact, such as arbitrary file reading, and even remote code execution through arbitrary file writing. Version 1.2.27 contains a patch for the issue.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected products
13<1.2.27+ 1 more
- (no CPE)range: <1.2.27
- (no CPE)range: < 1.2.27
- osv-coords11 versionspkg:rpm/opensuse/cacti&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/cacti&distro=openSUSE%20Leap%2015.6pkg:rpm/opensuse/cacti&distro=openSUSE%20Tumbleweedpkg:rpm/opensuse/cacti-spine&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/cacti-spine&distro=openSUSE%20Leap%2015.6pkg:rpm/suse/cacti&distro=SUSE%20Package%20Hub%2012pkg:rpm/suse/cacti&distro=SUSE%20Package%20Hub%2015%20SP5pkg:rpm/suse/cacti&distro=SUSE%20Package%20Hub%2015%20SP6pkg:rpm/suse/cacti-spine&distro=SUSE%20Package%20Hub%2012pkg:rpm/suse/cacti-spine&distro=SUSE%20Package%20Hub%2015%20SP5pkg:rpm/suse/cacti-spine&distro=SUSE%20Package%20Hub%2015%20SP6
< 1.2.27-bp155.2.9.1+ 10 more
- (no CPE)range: < 1.2.27-bp155.2.9.1
- (no CPE)range: < 1.2.27-bp156.2.3.1
- (no CPE)range: < 1.2.27-1.1
- (no CPE)range: < 1.2.27-bp155.2.9.1
- (no CPE)range: < 1.2.27-bp156.2.3.1
- (no CPE)range: < 1.2.27-bp155.2.9.1
- (no CPE)range: < 1.2.27-bp155.2.9.1
- (no CPE)range: < 1.2.27-bp156.2.3.1
- (no CPE)range: < 1.2.27-bp155.2.9.1
- (no CPE)range: < 1.2.27-bp155.2.9.1
- (no CPE)range: < 1.2.27-bp156.2.3.1
Patches
Vulnerability mechanics
Root cause
"Stored data from automation_tree_rules.php is not sanitized before being concatenated into an SQL statement in create_all_header_nodes(), enabling SQL injection."
Attack vector
An attacker with administrator privileges for Automation can POST dirty data to `automation_tree_rules.php`, injecting a malicious payload into the `field` column of the `automation_match_rule_items` table [ref_id=1]. Later, when an administrator triggers `host.php?action=actions&drp_action=6` or a similar action in `graphs.php`, the stored payload is read and concatenated into an SQL query without sanitization, causing SQL injection [ref_id=1]. This secondary injection can then be used to insert rows into `plugin_hooks` and `plugin_config`, which are subsequently read by `api_plugin_hook()` to construct a file‑include path, enabling arbitrary file reading and, via log poisoning, remote code execution [ref_id=2].
Affected code
The vulnerability resides in `automation_tree_rules.php` where data is stored without thorough validation, and in the `create_all_header_nodes()` function in `lib/api_automation.php` where that stored data is concatenated directly into an SQL statement [ref_id=1]. A secondary SQL injection path through `lib/plugin.php`'s `api_plugin_hook()` function enables file inclusion leading to RCE [ref_id=2].
What the fix does
Version 1.2.27 contains a patch that addresses the SQL injection by properly sanitizing or parameterizing the data read from the `automation_tree_rule_items` table before it is used in SQL concatenation [ref_id=1]. The patch also likely addresses the file‑inclusion issue in `lib/plugin.php` to prevent the chained attack [ref_id=2]. Without the patch, an attacker can leverage the stored dirty data to execute arbitrary SQL and subsequently achieve file inclusion and remote code execution.
Preconditions
- authAttacker must have administrator privileges for Automation to store dirty data via automation_tree_rules.php
- authA privileged user must trigger the vulnerable code path (e.g., via host.php or graphs.php) to read the stored payload
- networkThe attack requires network access to the Cacti web interface
- inputThe dirty data is injected into the 'field' column of the automation_match_rule_items table
Generated on Jun 14, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
3News mentions
0No linked articles in our index yet.