Cacti <= 1.2.26 (import.php) Remote Code Execution Vulnerability
The import_package() function in Cacti's import.php trusts the filename and content of uploaded XML data, allowing arbitrary file writes including path traversal. An attacker could write or overwrite files on the web server, leading to PHP code execution.
karmainsecurity.com
Published on karmainsecurity.com
The vulnerability is located within the importpackage() function defined into the /lib/import.php script. This function blindly trusts the filename and file content provided within the uploaded XML data, and writes such files into the Cacti base path (or even outside, since Path Traversal sequences are not filtered).
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The import_package() function does not validate or sanitise the filename and file content from uploaded XML data before writing files to disk.
Impact
An attacker could write or overwrite arbitrary files on the web server, potentially leading to execution of arbitrary PHP code.
What the attacker needed
Access to the package import feature
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
Cacti is a tool for monitoring network devices. Its package import feature takes a file from the user and saves it on the server, but it does not check the name or contents properly. That means someone could make it save a harmful script in a place where the server will run it, giving them control of the server.
What is Path traversal?
Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.