/

CVE-2026-42237

Severity:

HIGH RISK

(8.8)

SQL Injection in n8n Snowflake and Legacy MySQL v1 Nodes

CVE-2026-42237

Analyzed

Vulnerability type

Category:

SQL Injection

CWE:

CWE-89

Impact:

SQL Injection leading to data exfiltration, modification, or potential remote compromise through the connected database

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

n8n's Snowflake and legacy MySQL v1 nodes construct SQL queries by directly interpolating user-controlled identifiers such as table names, column names, and update keys into query strings without proper escaping.

Under certain workflow configurations, this allows an attacker who can influence these node parameters to perform SQL injection against the connected database, potentially leading to data exposure, tampering, or further compromise.

Affected context

This vulnerability arises in n8n workflows that use:

  • The Snowflake node, or
  • The legacy MySQL v1 node

In affected contexts, workflow authors or integrations allow user-supplied or otherwise untrusted data to flow into node parameters that determine:

  • Table names
  • Column names
  • Update/where keys

Because these identifiers are concatenated directly into SQL query strings without proper identifier quoting or escaping, any environment where these node parameters are influenced by external input (e.g., HTTP triggers, webhooks, form submissions, or upstream automation) can become vulnerable.

Exploit preconditions

  • Attack surface: The workflow execution path that uses the Snowflake or legacy MySQL v1 node.
  • Required access: Ability to influence or configure node parameters such as table name, column name, or update keys. This can be through:
  • Direct access to n8n workflow configuration, or
  • Indirect control via external inputs bound to these parameters (e.g., incoming requests, API payloads, or other nodes).
  • Trigger point: Execution of a workflow run where the vulnerable node builds and runs its SQL query using the attacker-controlled identifiers.
  • Why exploitation is possible: The node constructs SQL statements by string concatenation with unvalidated and unescaped identifier fields, bypassing proper parameterization or identifier quoting, which allows crafted input to alter the intended structure of the SQL query.

Why this happens

The core bug is the construction of SQL queries via string concatenation with user-controlled identifiers, rather than treating those values as data.

While many libraries provide mechanisms for parameterizing values, identifiers like table names and column names require careful quoting or whitelisting. In this case, the Snowflake and legacy MySQL v1 nodes interpolate these identifier parameters directly into the SQL text without:

  • Applying proper identifier quoting/escaping rules for the target database, or
  • Restricting them to a controlled set of allowed values.

This aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection'), where untrusted input is embedded directly into SQL commands, enabling attackers to modify query semantics, access unintended data, or affect database state.

Potential impact

  • Unauthorized reading of database records the workflow's DB user can access.
  • Modification or deletion of data in the connected Snowflake or MySQL database.
  • Creation or alteration of database objects (tables, views, users) if the DB account has elevated privileges.
  • Circumvention of application-level access controls enforced via database logic.
  • Potential execution of database-specific features (e.g., stored procedures) that could lead to broader system impact depending on configuration.

General mitigation guidance

Effective mitigation focuses on eliminating raw string interpolation for SQL construction and tightening trust boundaries on workflow inputs:

  • Prefer parameterized queries for values wherever possible, even if identifiers require separate handling.
  • For table and column names:
  • Constrain them to a whitelisted set that is defined in configuration or code, not user input.
  • Apply database-appropriate identifier quoting and validation, ensuring only expected characters (e.g., alphanumerics and underscores) are allowed.
  • Encapsulate database operations behind higher-level abstractions (e.g., data access layers, ORM-like helpers) that expose only safe operations instead of raw SQL construction.
  • Apply least privilege to database accounts used by n8n nodes so that, if injection occurs, the impact is limited to the minimal necessary tables and operations.
  • Treat all external input into workflow nodes as untrusted and design workflows so that user-supplied data cannot directly control structural aspects of SQL statements.

How teams detect issues like this

Detection typically involves both code-level and configuration-level reviews:

  • Static analysis / code scanning:
  • Look for concatenation patterns in node implementations involving SQL keywords and variables (e.g., SELECT ... FROM + tableName).
  • Flag any use of dynamic identifiers in query strings without centralized escaping utilities or whitelist checks.
  • Configuration and workflow review:
  • Inspect workflows using Snowflake or legacy MySQL v1 nodes where table/column names are bound to expressions or external inputs.
  • Identify nodes where the same variable or expression controls both data values and structural SQL elements.
  • Logging and anomaly detection:
  • Enable detailed database query logging to spot unusual or malformed queries originating from n8n.
  • Monitor for queries containing unexpected SQL keywords or multiple statements in contexts that should be simple operations.
  • Policy enforcement:
  • Establish internal guidelines or CI checks for custom nodes to forbid raw SQL string construction from untrusted inputs.
  • Use automated review tools that can scan node code and workflow configurations for insecure SQL composition patterns.

Sources

SourceLink
github.comgithub.com/n8n-io/n8n/security/advisories/GHSA-hp3c-vfpm-q4f7

Frequently asked

questions

Exploitability depends on how workflows are designed. If untrusted input (such as webhooks, forms, or external APIs) is used to populate the Snowflake or legacy MySQL v1 node parameters controlling table or column names, an attacker could craft input that results in SQL injection. In closed, admin-only workflows with strictly controlled parameters, the risk is reduced.

At minimum, an attacker must be able to influence the values used for table names, column names, or update keys in the affected nodes. This could be via direct access to n8n (e.g., a compromised or malicious workflow editor) or indirect access through endpoints and integrations that feed data into these nodes.

The safest pattern is to avoid constructing SQL with string concatenation. Instead, use parameterized queries for values, restrict identifiers to a predefined set, and ensure any remaining dynamic identifiers are properly validated and quoted using database-specific escaping utilities. Encapsulating database access behind reusable, vetted helper functions also reduces the chance of insecure query construction.

Future prevention relies on adopting secure-by-default patterns: prohibit raw SQL concatenation with untrusted input, mandate parameterization, enforce strong input validation, and incorporate security reviews into node and workflow development. Automated scanning, code review checklists, and security-focused tests can help detect insecure query patterns before they reach production.

Find out what's already
exploitable in your codebase.