VYPR
Unrated severityOSV Advisory· Published Jan 16, 2019· Updated Aug 5, 2024

CVE-2018-20726

CVE-2018-20726

Description

A cross-site scripting (XSS) vulnerability exists in host.php (via tree.php) in Cacti before 1.2.0 due to lack of escaping of unintended characters in the Website Hostname field for Devices.

AI Insight

LLM-synthesized narrative grounded in this CVE's description and references.

Affected products

9

Patches

Vulnerability mechanics

Root cause

"Missing HTML escaping of the Website Hostname field value before rendering in the Tree table allows stored XSS."

Attack vector

An attacker with the ability to edit a Device's "Website Hostname" field can inject a JavaScript payload such as `<img src=xss onerror=alert(1)>` [ref_id=1]. When a victim visits `tree.php?action=edit&id=1`, the stored payload is rendered unsanitized in the Tree table, causing the script to execute in the victim's browser [ref_id=1]. No authentication bypass is needed — the attacker must have access to edit device settings.

Affected code

The vulnerability exists in `host.php` (via `tree.php`) in Cacti before 1.2.0. The "Website Hostname" field for Devices is stored without escaping, and when rendered in the Tree table the value is printed directly without sanitization [ref_id=1].

What the fix does

The commit [ref_id=2] applies `html_escape()` to user-supplied values before they are output in HTML context. For example, `$name` is wrapped with `html_escape($name)` and `$value` is passed through `form_selectable_ecell()` (which escapes its content) instead of `form_selectable_cell()`. This ensures that any HTML or JavaScript embedded in the Hostname field is rendered as plain text, preventing XSS.

Preconditions

  • authAttacker must have privileges to edit a Device's Website Hostname field
  • inputVictim must visit the tree.php page that renders the stored Hostname value

Reproduction

1. Navigate to `http://localhost:4040/cacti/host.php?action=edit&id=1` and set the Hostname field to `<img src=xss onerror=alert(1)>`. 2. Visit `http://localhost:4040/cacti/tree.php?action=edit&id=1` — the payload executes [ref_id=1].

Generated on May 26, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

7

News mentions

0

No linked articles in our index yet.