/

CVE-2026-71287

Severity:

HIGH RISK

(8.8)

SQL Injection (CWE-89) in Cacti ORDER BY Parameters

CVE-2026-71287

Received

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

Time-Based Blind SQL Injection

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Cacti improperly sanitizes user-controlled sorting column names, allowing SQL expressions such as time-delay functions to pass through into ORDER BY clauses. Any authenticated Cacti user may be able to perform time-based blind SQL injection, subject to the database account's permissions and the exposed sorting functionality.

Affected context

The vulnerability occurs in Cacti sorting functionality that accepts a sort_column GET parameter and inserts the resulting value into raw SQL ORDER BY clauses. It affects deployments where the relevant pages are accessible to authenticated users and where the database connection account has query permissions beyond the minimum required by the application.

Exploit preconditions

  • Attack surface: HTTP GET endpoints that use the sort_column parameter, including affected user-management and utility pages
  • Required access: Authentication to Cacti; the vulnerable behavior is not limited to administrative roles
  • Trigger point: Construction and execution of a database query containing a user-controlled ORDER BY expression
  • Why exploitation is possible: The sanitization allowlist retains parentheses and other characters that can form SQL expressions, and the resulting value is concatenated into SQL rather than safely constrained to a predefined column

Why this happens

The underlying defect is insufficient neutralization of user-controlled SQL identifiers and expressions. The sanitize_sql_column() regular expression removes some characters but permits syntax such as parentheses and dots, so values that resemble SQL functions can remain intact. Because the sanitized result is concatenated into an ORDER BY clause, the application treats attacker-influenced text as SQL syntax rather than as a member of a fixed set of sortable fields. This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').

Potential impact

  • An attacker may infer database behavior through response timing
  • Sensitive database values could potentially be extracted through blind SQL techniques
  • Application data may be exposed or altered if the database account has corresponding privileges
  • Database performance and application availability could be degraded by resource-intensive expressions
  • The vulnerability could provide a stepping stone for broader compromise if combined with other weaknesses

General mitigation guidance

Mitigation generally focuses on eliminating free-form SQL expressions from sorting controls and reducing database trust boundaries.

Common defensive patterns include:

  • Mapping externally supplied sort identifiers to a fixed, server-side allowlist of column names
  • Rejecting unknown fields and expressions rather than attempting to sanitize them
  • Keeping ORDER BY fragments separate from general user input and generating them only from validated internal values
  • Applying least privilege to the Cacti database account
  • Limiting database access to required schemas, operations, and network locations
  • Preserving centralized authorization checks for all affected endpoints
  • Avoiding reliance on character-stripping filters as a substitute for structural query construction

How teams detect issues like this

Detection can combine application review, runtime monitoring, and policy enforcement:

  • Use static analysis to identify concatenation of request parameters into SQL statements, especially ORDER BY clauses
  • Review functions that sanitize identifiers with regular expressions but permit punctuation associated with SQL syntax
  • Search code and templates for sort_column or equivalent parameters reaching database query builders
  • Monitor database and application logs for unusual sorting expressions, repeated requests, or response-time anomalies
  • Add automated tests that verify unknown sort fields and SQL-like expressions are rejected
  • Enforce code-review policies requiring fixed mappings for dynamic SQL identifiers

Sources

SourceLink
github.comgithub.com/Cacti/cacti
github.comgithub.com/Cacti/cacti/blob/develop/lib/functions.php

Frequently asked

questions

Yes, when affected Cacti pages are reachable over the application interface. Exploitation still requires an authenticated account and depends on the deployment's access controls.

Not necessarily. The described behavior may be reachable by authenticated users regardless of privilege level, although endpoint authorization and deployment configuration can affect exposure.

Replace free-form sorting input with a strict server-side mapping from approved request values to known column identifiers. Unknown values should be rejected, and database privileges should remain minimal.

Treat SQL identifiers as structured application data rather than values that can be made safe through character removal. Combine fixed query construction, negative and positive validation tests, least-privilege database roles, and static analysis for dynamic SQL concatenation.

Find out what's already
exploitable in your codebase.