Summary
n8n contains a SQL injection vulnerability in the Snowflake node's Execute Query operation when externally controlled expression values are interpolated directly into raw SQL.
A workflow author who includes untrusted data in this way may allow attackers to alter query behavior, access unauthorized database information, or modify data.
Affected context
The vulnerability occurs in n8n workflows that use the Snowflake node's Execute Query operation and place externally controlled expression data directly into a raw SQL string. Risk is present when workflow inputs, webhook data, form submissions, or other untrusted sources reach the query without parameter binding.
Exploit preconditions
- Attack surface: n8n workflow execution through the Snowflake Execute Query operation
- Required access: Ability to influence an input consumed by the workflow, typically through an externally reachable trigger or integrated data source
- Trigger point: Evaluation and execution of a raw SQL query containing interpolated expression data
- Why exploitation is possible: Untrusted values are inserted into SQL syntax instead of being transmitted separately as bound parameters
Why this happens
The underlying flaw is direct string interpolation of expression values into a SQL statement. Because the database receives attacker-influenced content as part of the query text, crafted input may change the statement's intended structure.
This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command, commonly known as SQL injection. The insecure pattern is constructing executable SQL by concatenating or interpolating untrusted data rather than using parameterized queries.
Potential impact
- An attacker may bypass intended query conditions
- Sensitive Snowflake data could be disclosed
- Database records could be modified or deleted
- Query execution permissions could be abused within the connected account
- Downstream workflows may receive manipulated or poisoned results
General mitigation guidance
Mitigation generally centers on separating SQL code from user-controlled values.
Common defensive patterns include:
- Use bound query parameters with positional placeholders instead of string interpolation
- Treat workflow expressions and integration data as untrusted by default
- Validate input types, lengths, and permitted values before database operations
- Apply least-privilege permissions to Snowflake credentials used by workflows
- Restrict destructive operations and separate read-only and write-capable connections
- Avoid constructing SQL identifiers from untrusted input; use controlled allowlists when dynamic identifiers are necessary
How teams detect issues like this
Organizations can identify similar issues through:
- Static analysis rules for SQL strings containing workflow expressions or concatenation
- Code review checks for raw query fields that lack parameter binding
- Testing with inputs containing SQL metacharacters in workflow and integration boundaries
- Policy enforcement requiring parameterized queries for database nodes
- Monitoring for unusual query patterns, excessive data access, or unexpected write operations
Automated security review tools may help flag direct interpolation of untrusted values into SQL statements.

