CVE-2026-46530: Cacti vulnerable to stored XSS in graph preset names leading to privilege escalation
CVE-2026-46530 affects 48 listed versions of Cacti in the Dawnsentry catalogue.
Affected products and versions
The versions in the Dawnsentry catalogue this CVE affects, judged from the vendor's own advisory where there is one, otherwise from the CVE record and NVD, as each version's own page says.
Cacti
48 of 50 listed versions are affected. Fixed in 1.2.31. The newest release, 1.2.32, is not affected.
1.2.30 1.2.29 1.2.28 1.2.27 1.2.26 1.2.25 1.2.24 1.2.23 1.2.22 1.2.21 1.2.20 1.2.19 1.2.18 1.1.38 1.1.36 1.1.27 1.1.25 1.1.17 1.1.15 1.1.13 1.1.12 1.0.0 0.8.8g 0.8.8f 0.8.8d 0.8.8c 0.8.8b 0.8.8a 0.8.8 0.8.7i 0.8.7h 0.8.7g 0.8.7f 0.8.7e 0.8.7d 0.8.7c 0.8.7b 0.6.8a 0.6.8 0.6.7 0.6.6 0.6.5 0.6.4 0.6.3 0.6.2 0.6.1 0.6 0.5
What it is
### 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§ion1=on§ion2=on§ion3=on§ion4=on§ion7=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 lo
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N (GitHub)
Published by GitHub on 29 November 2026.
Sources
Check one version you run: look CVE-2026-46530 up, or pick a product and version in the quick lookup.
Updated 1 December 2026.