Skip to content

RCE vulnerability when plugins include files

High
netniV published GHSA-cx8g-hvq8-p2rv May 12, 2024

Package

Cacti (PHP)

Affected versions

<= 1.2.26

Patched versions

1.2.27

Description

Summary

There is a file inclusion issue in the lib/plugin.php file. Combined with SQL injection vulnerabilities, RCE can be implemented.

Details

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.
image

PoC

Use sql injection vulnerability described in url below.
https://github.com/Cacti/cacti/security/advisories/GHSA-gj3f-p326-gh8r

Insert dirty data into database and trigger SQL injection vulnerability with payload below:
plugin_hooks: 1;INSERT INTO plugin_hooks VALUES (3,'.','login_after','../../myVul/FileIncludeofgraph_image/test.php','.','1');#
image

plugin_config: 1;INSERT INTO plugin_config VALUES (1,'.','FI',1,1,1,1);#
image

prepare poc file to be included like this.
image

Finally:
image

To realize RCE, try to output payload to log file and include it.
The detailed methods are described in the following article :
https://github.com/Cacti/cacti/security/advisories/GHSA-pfh9-gwm6-86vp

Researcher: ISHGARD-2, USTC

Severity

High

CVE ID

CVE-2024-31459

Weaknesses

No CWEs

Credits