CVE-2026-46530: cacti/cacti XSS

CVE-2026-46530

NVD

Vulnerability Summary

Summary The name parameter of the CDEF, VDEF, and GPRINT preset save handlers is vulnerable to Stored XSS. An authenticated user with editorial privileges (realms 10 + 14) can inject JavaScript that executes in an administrator's browser when the administrator opens any graph template referencing the poisoned preset, resulting in full administrative takeover via a self-granted realm update. Details The vulnerable code path combines two sinks with three enabling conditions. 1. Input validation — empty regex accepts arbitrary HTML. The three preset save handlers call `form_input_validate()` with an empty 3rd argument for `name`, accepting `<script>` verbatim into the database: - `cdef.php` L125–L129 — https://github.com/Cacti/cacti/blob/release/1.2.30/cdef.php#L125-L129 - `vdef.php` L113–L116 — https://github.com/Cacti/cacti/blob/release/1.2.30/vdef.php#L113-L116 - `gprint_presets.php` L69–L72 — https://github.com/Cacti/cacti/blob/release/1.2.30/gprint_presets.php#L69-L72 ``` php $save['name'] = form_input_validate(get_nfilter_request_var('name'), 'name', '', false, 3); ``` `gprint_presets.php:72` applies the same empty-regex pattern to `gprint_text` and is a second candidate stored-XSS sink. 2. Output encoding — raw `print` with no escape. `draw_graph_items_list()` in `lib/html.php` emits the three preset-name columns as raw markup: `lib/html.php` L1279–L1285 — https://github.com/Cacti/cacti/blob/release/1.2.30/lib/html.php#L1279-L1285 ``` php print $item['gprint_name']; ... print $item['cdef_name']; ... print $item['vdef_name']; ``` The helper is reached at `GET /graph_templates.php?action=template_edit&id=<tid>` (L492) and `GET /graphs.php?action=graph_edit&id=<lgid>` (L1383). 3. CSRF token exposed as JS global. `include/global_session.php` emits the per-session csrf-magic token as `var csrfMagicToken = "…";` on every authenticated page, so the injected same-origin script reads it directly and the forged POST is accepted. 4. CSP permits inline scripts. The default response header contains `script-src 'self' 'unsafe-inline'`, so the injected `<script>` block executes without further bypass. 5. Privesc handler is total-set. `/user_admin.php` with `action=save&save_component_realm_perms=1` treats missing `sectionN=on` parameters as removals. The payload re-asserts the attacker's baseline realms (`section2,3,4,7`) alongside the newly-added `section1=on`, preserving the attacker's UI and avoiding any visible change to the admin. PoC 1. Set up Cacti 1.2.30 with default configuration. 2. As a low-privilege user holding realms `{10, 14}`, save a CDEF with the following payload in the `name` field: ``` html <script>fetch("/user_admin.php",{method:"POST",body:new URLSearchParams("action=save&save_component_realm_perms=1&id=4&section1=on&section2=on&section3=on&section4=on&section7=on&_csrf_magic="+csrfMagicToken)})</script> ``` 3. Attach the poisoned CDEF to any existing graph template via `POST /graph_templates_items.php`. 4. Wait for an administrator to open `GET /graph_templates.php?action=template_edit&id=<tid>` — a routine template review action. 5. The injected script reads the admin's `csrfMagicToken` JS global and issues a forged `POST /user_admin.php` that grants realm `1` (Users/Groups) to the attacker's account while re-asserting the attacker's baseline realms to preserve stealth. Impact This XSS would allow a low-privilege editorial user to escalate to full administrator on any Cacti instance via passive admin interaction with routine template review — no click or form submission by the admin is required. Post-exploitation, the attacker can self-grant any remaining realm from their own session (the `save_component_realm_perms` handler is total-set and usable by the newly-acquired realm 1), access stored credentials (`host.snmp_community`, `host.snmp_password`, `host.snmp_priv_passphrase`, `user_domains_ldap.specific_password`), and disable or lock out the legitimate administrator via `/user_admin.php` bulk actions. Suggested remediation Required fix. Wrap the three preset-name prints in `draw_graph_items_list()` with `html_escape()`: ``` diff - print $item['gprint_name']; + print html_escape($item['gprint_name']); - print $item['cdef_name']; + print html_escape($item['cdef_name']); - print $item['vdef_name']; + print html_escape($item['vdef_name']); ``` Defense in depth. Replace the empty 3rd argument at `cdef.php:128`, `vdef.php:116`, `gprint_presets.php:71`, and `gprint_presets.php:72` with a restrictive character-set regex such as `'^[a-zA-Z0-9 \-\.\/\(\)]+$'`. Longer-term. Remove `'unsafe-inline'` from `script-src` in the default CSP and migrate Cacti's inline scripts to nonce- or hash-based allowlisting. Fix Branch: `fix/consolidated-security-hardening` Commit: `f822256244e39265cc761ff7ec40f466924221f6` Repo: https://github.com/somethingwithproof/cacti/tree/fix/consolidated-security-hardening - `lib/html.php`: `html_escape()` on `gprint_name`, `cdef_name`, `vdef_name` in `draw_graph_items_list()` - `cdef.php`, `vdef.php`, `gprint_presets.php`: character allowlist in `form_input_validate()` for `name` and `gprint_text` Fix Addressed in: https://github.com/Cacti/cacti/pull/7109 --- Maintainer Remediation & Release Information This vulnerability is fixed in Cacti 1.2.31 (`release/1.2.31`) via PR #7109, which escapes CDEF, VDEF, and GPRINT preset names on output and restricts preset input characters. Users should upgrade to Cacti 1.2.31 or later.
Severity Level
MEDIUM(5.4)
Published Date
Nov 29, 2026
Last Modified
Nov 29, 2026
Exploitation Status
No confirmed exploitation yet
CVE Record Status
Reserved
This CVE ID is referenced in a public advisory, but the CVE Program has not published its official CVE Record yet. Full CVSS/CPE data from NVD will appear here once it does.
Root Weakness (CWE)
The software does not neutralize user-controllable input before it is placed in output that is used as a web page.
CVSS v3.1 Base Metrics — Score 5.4
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
Attack VectorNetwork
Attack ComplexityLow
Privileges RequiredLow
User InteractionRequired
ScopeChanged
ConfidentialityLow
IntegrityLow
AvailabilityNone

Affected & Patched Versions

Affected Versions
  • cacti/cacti <= 1.2.30
Patched Versions
  • cacti/cacti 1.2.31

What to do

Fix it during your normal patch cycle. No exploitation is confirmed yet.

  1. Check whether you run cacti/cacti and which version.
  2. Update to a patched version listed above, then confirm the new version.

Timeline

  • Nov 29, 2026Published
  • Nov 29, 2026Record last modified

Score, severity and exploitation changes are tracked from the day Watchtower started logging them.

Get notified about new cacti/cacti CVEsYou are reading CVE-2026-46530. Get an email when KEV listings, exploits or new CVEs match your stack.
Set up CVE alerts

Data last checked: Nov 29, 2026 23:01 UTC