Skip to content

XSS vulnerability when reading tree rules with Automation API

Moderate
netniV published GHSA-p4ch-7hjw-6m87 May 12, 2024

Package

Cacti (PHP)

Affected versions

<= 1.2.26

Patched versions

1.2.27

Description

Summary

Some of the data stored in automation_tree_rules_form_save() function in automation_tree_rules.php is not thoroughly checked and is used to concatenate the HTML statement in form_confirm() function from lib/html.php , finally resulting in XSS.

Details

In the SQL table automation_tree_rules stored in database, the name field is controllable. The writing of dirty data can be done from automation_tree_rules_form_save() function in automation_tree_rules.php.
Both writing and reading require administrator privileges
image

The attack starts with the automation_tree_rules_remove() function in automation_tree_rules.php. Reading table automation_tree_rules and calling form_confirm() function.
image

Finally arriving at lib/html.php. Variable $text is not checked and concatenated directly, resulting in XSS.
image
image

PoC

POST access automation_tree_rules.php and submit the following data:

  • 'save_component_automation_graph_rule' => 1,
  • 'action'=>'save',
  • '__csrf_magic'=> '',
  • 'id'=>'4',
  • 'name'=>'<script>alert(1);</script>',
  • 'snmp_query_id'=>0,

check field in tableautomation_tree_rules table.
image

GET access : "http://ip:port/automation_graph_rules.php?action=remove&id=4".
image

Researcher: ISHGARD-2, USTC

Severity

Moderate
4.6
/ 10

CVSS base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
Low
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:L

CVE ID

CVE-2024-31444

Weaknesses

No CWEs

Credits