Local File Inclusion (RCE) in Cacti
Description
Cacti is a robust performance and fault management framework and a frontend to RRDTool - a Time Series Database (TSDB). While using the detected SQL Injection and insufficient processing of the include file path, it is possible to execute arbitrary code on the server. Exploitation of the vulnerability is possible for an authorized user. The vulnerable component is the link.php. Impact of the vulnerability execution of arbitrary code on the server.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Affected products
9(expand)+ 1 more
- (no CPE)
- (no CPE)range: = 1.2.25
- osv-coords7 versionspkg:rpm/opensuse/cacti&distro=openSUSE%20Leap%2015.5pkg:rpm/opensuse/cacti&distro=openSUSE%20Tumbleweedpkg:rpm/opensuse/cacti-spine&distro=openSUSE%20Leap%2015.5pkg:rpm/suse/cacti&distro=SUSE%20Package%20Hub%2012pkg:rpm/suse/cacti&distro=SUSE%20Package%20Hub%2015%20SP5pkg:rpm/suse/cacti-spine&distro=SUSE%20Package%20Hub%2012pkg:rpm/suse/cacti-spine&distro=SUSE%20Package%20Hub%2015%20SP5
< 1.2.26-bp155.2.6.1+ 6 more
- (no CPE)range: < 1.2.26-bp155.2.6.1
- (no CPE)range: < 1.2.26-1.1
- (no CPE)range: < 1.2.26-bp155.2.6.1
- (no CPE)range: < 1.2.26-bp155.2.6.1
- (no CPE)range: < 1.2.26-bp155.2.6.1
- (no CPE)range: < 1.2.26-bp155.2.6.1
- (no CPE)range: < 1.2.26-bp155.2.6.1
Patches
Vulnerability mechanics
Root cause
"Insufficient sanitization of the `contentfile` path from the `external_links` table in `link.php` allows directory traversal, enabling local file inclusion of a log file previously poisoned with PHP code via SQL injection."
Attack vector
An authenticated attacker first exploits a separate SQL injection vulnerability in `pollers.php` to insert a malicious row into the `external_links` table, setting the `contentfile` field to a path like `....//....//....//....//opt/cacti/log/cacti.log` [ref_id=1]. The same SQL injection is then used to poison the Cacti log file by injecting PHP code (e.g., `<?php system('id') ?>`) via an error-based technique [ref_id=1]. Finally, the attacker enables the "External Link Permissions" for their user in the Cacti UI, which causes `link.php` to include the poisoned log file, executing the injected PHP code on the server [ref_id=1].
Affected code
The vulnerable component is `link.php`. The advisory states that line 27 reads from the `external_links` table, line 56 checks permissions, line 79 forms the file path, line 81 checks existence, and line 82 includes the file [ref_id=1]. The path construction on line 79 does not adequately sanitize the `contentfile` value retrieved from the database, allowing directory traversal sequences such as `....//` to bypass the sanitization check shown in Figure 3 [ref_id=1].
What the fix does
The advisory recommends improving data escaping to prevent Local File Inclusion [ref_id=1]. No patch diff is provided in the bundle, so the exact code changes are not visible. The mitigation should ensure that the `contentfile` value retrieved from the database is properly sanitized to block directory traversal sequences (such as `....//`) before being used in a file include operation in `link.php` [ref_id=1].
Preconditions
- authAttacker must be an authenticated user of Cacti
- inputAttacker must be able to exploit a SQL injection vulnerability in pollers.php to write to the external_links table
- configAttacker must have the ability to enable 'External Link Permissions' for their user account via the Cacti UI
Reproduction
1. As an authenticated user, send a POST request to `/cacti/pollers.php?header=false` with a SQL injection payload in the `dbhost` parameter to insert a row into `external_links` with `contentfile` set to `....//....//....//....//opt/cacti/log/cacti.log` [ref_id=1]. 2. Send another POST request to the same endpoint with an error-based SQL injection payload in `dbhost` to inject PHP code (e.g., `<?php system('id') ?>`) into `/opt/cacti/log/cacti.log` [ref_id=1]. 3. In the Cacti UI, navigate to Configuration → Users → User → Permissions → External Link Permissions and enable the permission for the attacker's user [ref_id=1]. 4. Click the "Test" menu item that appears; the poisoned log file is included and the PHP code executes, displaying the output of the `id` command [ref_id=1].
Generated on May 27, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.
References
4- github.com/Cacti/cacti/security/advisories/GHSA-pfh9-gwm6-86vpmitrex_refsource_CONFIRM
- packetstormsecurity.com/files/176995/Cacti-pollers.php-SQL-Injection-Remote-Code-Execution.htmlmitre
- lists.debian.org/debian-lts-announce/2024/03/msg00018.htmlmitre
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RBEOAFKRARQHTDIYSL723XAFJ2Q6624X/mitre
News mentions
0No linked articles in our index yet.