CVE-2026-40078: Backend `ORDER BY` SQL Injection
CVE-2026-40078 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
## Backend ORDER BY SQL Injection ### Affected Components Multiple files concatenate `sort_column` directly into ORDER BY clauses: - `lib/html_reports.php:2117, 2132, 2147, 2163` - `user_log.php:104` - `utilities.php:596` - `user_domains.php:620` - `user_group_admin.php:1887` Additionally, `get_order_string()` in `lib/html_utility.php` has a session cache bypass: the regex allowlist check executes AFTER the cached `$_SESSION['sort_string']` return, so poisoned session values bypass validation. ### Root Cause `sort_column` passes through `sanitize_search_string` which strips quotes and backticks but allows spaces, dots, and alphanumeric characters. The value is concatenated into `ORDER BY` without an allowlist check. ### Authentication Post-auth (all affected pages require authentication). ### PoC ``` GET /cacti/user_log.php?sort_column=1 UNION SELECT password FROM user_auth--&sort_direction=ASC ``` ### Fix 1. Move the regex allowlist check in `get_order_string()` BEFORE the session cache return 2. Add validation in `update_order_string()` before session write 3. Convert all direct `ORDER BY " . grv('sort_column')` sites to use `get_order_string()` ### Note PR #6955 partially addresses this but the session cache bypass and direct-concatenation sites remain. ## Fix Addressed in: https://github.com/Cacti/cacti/pull/7072 ## Fix Addressed in: https://github.com/Cacti/cacti/pull/7054 --- **Fix:** https://github.com/Cacti/cacti/commit/efa632f62 --- ## Maintainer Remediation & Release Information This vulnerability is fixed in **Cacti 1.2.31** (`release/1.2.31`) via PR [#7098](https://github.com/Cacti/cacti/pull/7098) (and related hardening in [#7054](https://github.com/Cacti/cacti/pull/7054)), which enforces per-page sort column allowlists on `ORDER BY` clauses. All affected endpoints require an authenticated Cacti session (`PR:L`). Users should upgrade to **Cacti 1.2.31** or later.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N (GitHub)
Published by GitHub on 29 November 2026.
Sources
Check one version you run: look CVE-2026-40078 up, or pick a product and version in the quick lookup.
Updated 1 December 2026.