Summary
Trigger.dev contains a SQL injection vulnerability in its TSQL query compiler, which inserts window-function names into generated ClickHouse SQL without sufficient allowlisting or escaping.
An authenticated customer may be able to manipulate a query submitted through the query API and access analytics data belonging to other organizations when tenant filtering is bypassed.
Trigger.dev contains a SQL injection vulnerability in its TSQL query compiler, which inserts window-function names into generated ClickHouse SQL without sufficient allowlisting or escaping.
An authenticated customer may be able to manipulate a query submitted through the query API and access analytics data belonging to other organizations when tenant filtering is bypassed.
Affected context
The vulnerability occurs in Trigger.dev deployments that use the affected TSQL query compiler to generate ClickHouse queries. It becomes risky when authenticated customers can control window-function identifiers and the compiler concatenates those values into SQL without enforcing a restricted identifier set or applying context-appropriate escaping.
The vulnerability occurs in Trigger.dev deployments that use the affected TSQL query compiler to generate ClickHouse queries. It becomes risky when authenticated customers can control window-function identifiers and the compiler concatenates those values into SQL without enforcing a restricted identifier set or applying context-appropriate escaping.
Exploit preconditions
- Attack surface: The authenticated query API and its TSQL-to-ClickHouse query compilation path
- Required access: An authenticated customer account with permission to submit analytics queries
- Trigger point: Processing a customer-controlled window-function name during SQL generation
- Why exploitation is possible: Untrusted identifier data is concatenated into SQL, allowing query structure to be altered and tenant-scoping protections to be bypassed
- Attack surface: The authenticated query API and its TSQL-to-ClickHouse query compilation path
- Required access: An authenticated customer account with permission to submit analytics queries
- Trigger point: Processing a customer-controlled window-function name during SQL generation
- Why exploitation is possible: Untrusted identifier data is concatenated into SQL, allowing query structure to be altered and tenant-scoping protections to be bypassed
Why this happens
The underlying bug is unsafe construction of SQL statements from untrusted input. Window-function names are treated as trusted SQL fragments rather than being restricted to a predefined set of valid identifiers.
This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command (SQL Injection). The absence of strict allowlisting and context-aware query construction permits attacker-controlled input to change the meaning of generated ClickHouse SQL.
The underlying bug is unsafe construction of SQL statements from untrusted input. Window-function names are treated as trusted SQL fragments rather than being restricted to a predefined set of valid identifiers.
This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command (SQL Injection). The absence of strict allowlisting and context-aware query construction permits attacker-controlled input to change the meaning of generated ClickHouse SQL.
Potential impact
- An authenticated customer may access analytics data belonging to other organizations
- Tenant-isolation guarantees could be weakened or bypassed
- Confidential business metrics and query results may be disclosed
- Crafted queries could increase database resource consumption
- An authenticated customer may access analytics data belonging to other organizations
- Tenant-isolation guarantees could be weakened or bypassed
- Confidential business metrics and query results may be disclosed
- Crafted queries could increase database resource consumption
General mitigation guidance
Mitigation generally focuses on preventing user-controlled values from becoming executable SQL syntax.
Common defensive patterns include:
- Allowlisting window functions and mapping accepted names to fixed internal SQL expressions
- Using structured query builders or parameterized query mechanisms where supported
- Separating identifiers from values and applying context-specific escaping only where unavoidable
- Enforcing tenant predicates independently of customer-controlled query fragments
- Applying authorization and least-privilege controls at the database and application layers
- Limiting returned fields and query scope according to the authenticated tenant
Mitigation generally focuses on preventing user-controlled values from becoming executable SQL syntax.
Common defensive patterns include:
- Allowlisting window functions and mapping accepted names to fixed internal SQL expressions
- Using structured query builders or parameterized query mechanisms where supported
- Separating identifiers from values and applying context-specific escaping only where unavoidable
- Enforcing tenant predicates independently of customer-controlled query fragments
- Applying authorization and least-privilege controls at the database and application layers
- Limiting returned fields and query scope according to the authenticated tenant
How teams detect issues like this
Organizations can look for:
- Static analysis findings involving string concatenation or interpolation of request data into SQL
- Code review signals such as dynamic identifiers without allowlists or query construction performed outside a trusted query builder
- Tests that verify tenant predicates remain mandatory when optional query clauses are supplied
- Database audit records showing unexpected subqueries, cross-tenant access patterns, or unusual query shapes
- API policy enforcement that constrains query grammar and permitted analytical functions
Automated security review tools may help identify risky SQL construction patterns, but database-level monitoring and authorization tests should complement source analysis.
Organizations can look for:
- Static analysis findings involving string concatenation or interpolation of request data into SQL
- Code review signals such as dynamic identifiers without allowlists or query construction performed outside a trusted query builder
- Tests that verify tenant predicates remain mandatory when optional query clauses are supplied
- Database audit records showing unexpected subqueries, cross-tenant access patterns, or unusual query shapes
- API policy enforcement that constrains query grammar and permitted analytical functions
Automated security review tools may help identify risky SQL construction patterns, but database-level monitoring and authorization tests should complement source analysis.

