Summary
Chartbrew's SQL dashboard-variable substitution can let crafted URL filter values alter a stored query used by a public or embedded chart. An unauthenticated user may be able to inject SQL, with a separate backslash-escaping issue affecting quoted MySQL and MariaDB contexts.
Affected context
The vulnerable surface is public and embedded chart requests that use URL-controlled variables in stored SQL queries and call applyMysqlOrPostgresVariables. Unsafe handling of JavaScript replacement-string sequences can affect SQL across connectors; separately, missing backslash escaping creates a quoted-string escape path for MySQL and MariaDB. The risk depends on a chart exposing such variables and on the permissions of its configured database account.
Exploit preconditions
- Attack surface: A public or embedded chart request that applies URL-controlled variables to a stored SQL query.
- Required access: No authentication is required when the target chart is publicly accessible or embedded in a way that permits the request.
- Trigger point: Variable substitution while processing the chart request.
- Why exploitation is possible: Replacement-string sequences can alter SQL independently of the database engine; in quoted MySQL or MariaDB contexts, unescaped backslashes provide an additional escape path.
Why this happens
The application substitutes attacker-controlled values into SQL using JavaScript replacement strings without safely handling their special replacement sequences. For MySQL and MariaDB quoted contexts, it also fails to escape backslashes. This is CWE-89: SQL Injection: untrusted input is incorporated into a SQL statement in a way that can change its intended structure.
Potential impact
- An attacker may read data accessible to the configured database account.
- An attacker could modify or delete accessible database records.
- The confidentiality, integrity, or availability of data used by the application may be affected.
- The impact may be limited or expanded by the database account's permissions.
General mitigation guidance
Defensive patterns focus on keeping untrusted values separate from SQL syntax. Parameterized queries or safely bound variables are preferable to string-based SQL substitution. Where dynamic query elements are necessary, applications can validate them against explicit schemas and allowlists, and apply context- and database-dialect-aware handling rather than relying on generic escaping. Public and embedded charts can also be configured to expose only necessary variables and use database accounts with least privilege.
How teams detect issues like this
- Use static analysis to identify SQL construction involving string replacement or concatenation with request-controlled values.
- Review code paths that process URL filters, especially JavaScript replacement-string handling and database-specific quoting or escaping.
- Enforce policies that favor parameterized queries and restrict unsafe dynamic SQL patterns.
- Test public and embedded chart variable flows with security-focused checks, without relying solely on database-specific protections.

