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

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
Low
User interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
Low

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
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