VYPR
Unrated severityNVD Advisory· Published May 13, 2024· Updated Dec 16, 2025

Cacti RCE vulnerability by file include in lib/plugin.php

CVE-2024-31459

Description

Cacti provides an operational monitoring and fault management framework. Prior to version 1.2.27, there is a file inclusion issue in the lib/plugin.php file. Combined with SQL injection vulnerabilities, remote code execution can be implemented. There is a file inclusion issue with the api_plugin_hook() function in the lib/plugin.php file, which reads the plugin_hooks and plugin_config tables in database. The read data is directly used to concatenate the file path which is used for file inclusion. 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

Patches

Vulnerability mechanics

Root cause

"Missing input sanitization in file path construction from database values in lib/plugin.php and link.php allows local file inclusion when combined with SQL injection."

Attack vector

An authenticated attacker first exploits a separate SQL injection vulnerability (e.g., in `automation_tree_rules.php` [ref_id=2]) to insert a malicious payload into the `plugin_hooks` or `external_links` table. The payload sets a path traversal string (e.g., `....//....//....//....//opt/cacti/log/cacti.log`) as the file to include [ref_id=1]. The attacker then poisons the Cacti log file with PHP code via error-based SQL injection [ref_id=1]. Finally, by triggering the vulnerable include path (e.g., clicking a crafted external link or invoking the plugin hook), the poisoned log file is included and the PHP code executes, achieving remote code execution [ref_id=1][ref_id=3].

Affected code

The vulnerability resides in `lib/plugin.php` within the `api_plugin_hook()` function. This function reads data from the `plugin_hooks` and `plugin_config` database tables and directly concatenates it into a file path used for inclusion, without proper sanitization [ref_id=3]. Additionally, `link.php` (line 79–82) constructs a file path from the `external_links.contentfile` column and includes it without adequate validation [ref_id=1].

What the fix does

The patch in version 1.2.27 improves data escaping to prevent local file inclusion [ref_id=1]. Specifically, it sanitizes the file path constructed from database values before inclusion, blocking path traversal sequences. Combined with proper escaping of SQL inputs, this closes both the injection vector and the subsequent file inclusion, preventing an attacker from including arbitrary files (such as a poisoned log) and executing code.

Preconditions

  • authThe attacker must have an authenticated Cacti session with sufficient privileges to trigger the vulnerable SQL injection (e.g., Automation or External Link permissions).
  • networkThe attacker must be able to reach the Cacti web interface over the network.
  • inputThe attacker must craft SQL injection payloads to insert malicious data into the plugin_hooks or external_links tables.

Generated on Jun 14, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

4

News mentions

0

No linked articles in our index yet.