Summary
A critical SQL injection flaw in Cacti occurs when the rfilter request parameter is directly concatenated into an SQL RLIKE clause without proper sanitization.
On instances where guest graph viewing is enabled, attackers can exploit this pre-authentication endpoint to manipulate backend queries and potentially access or alter monitoring data.
Affected context
The vulnerability arises in Cacti deployments up to version 1.2.30 that expose graph viewing functionality to unauthenticated users via a configured guest account.
In this context, the rfilter request variable is used to build an SQL RLIKE condition for filtering graph data, but the input is incorporated directly into the query string.
Environments that allow guest access and rely on the same database for broader monitoring or operational data are at higher risk, as the injection point sits in a commonly used viewing endpoint.
Exploit preconditions
- Attack surface: Public or internal web interface for Cacti graph viewing.
- Required access: Network-level access to the Cacti web UI; no login needed when guest viewing is enabled.
- Trigger point: Submission of crafted
rfiltervalues to the vulnerable endpoint during graph filtering or viewing. - Why exploitation is possible: The application uses unsanitized user input to build an SQL
RLIKEclause, lacking parameterization or escaping, which allows user-controlled fragments to alter query structure.
Why this happens
This issue stems from constructing SQL statements by concatenating user-supplied data directly into a conditional clause, specifically an RLIKE predicate used for filtering graph data.
Because the rfilter parameter is not validated, normalized, or passed through a parameterized query mechanism, attackers can inject control characters and SQL syntax that change the query's logic.
Conceptually, this maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, where application logic treats externally controlled input as part of executable SQL rather than as data.
Potential impact
- Attackers may read or infer sensitive monitoring or configuration data from the Cacti database.
- Malicious queries could modify or delete records that underpin performance and fault monitoring.
- SQL injection can be chained to escalate privileges within the application by manipulating user or role data.
- In some deployment configurations, the database server itself may be further compromised via database-specific features.
General mitigation guidance
A robust mitigation strategy focuses on eliminating direct string concatenation for SQL commands and enforcing strict separation between query structure and user data.
Pattern-based improvements include adopting parameterized queries or prepared statements for all dynamic filters, constraining acceptable input for filter parameters to well-defined patterns, and centralizing query construction logic to avoid ad hoc SQL assembly.
Reducing the privileges of the application's database account and limiting accessible tables can further contain the impact of any residual injection flaws.
It is also advisable to review guest access configurations and ensure unauthenticated endpoints expose only minimal, non-sensitive functionality.
How teams detect issues like this
Detection typically starts with static analysis aimed at locating SQL queries built through string concatenation that incorporate request variables like $_GET or $_POST directly.
Code review should focus on endpoints that accept filter or search parameters, checking for parameterized query usage and proper input validation around regular-expression or pattern-based filters.
Security teams can enforce policies requiring prepared statements in database access layers and use automated scanning tools to probe for injection behavior on unauthenticated pages, particularly those related to reporting or graph viewing.

