CVE-2026-56351: n8n: SQL Injection in MySQL, PostgreSQL, and Microsoft SQL nodes
n8n before 2.4.0 does not escape identifier values in its MySQL, PostgreSQL and Microsoft SQL nodes. A user who can edit workflows and has a database credential can inject SQL through table or column names. Upgrade to n8n 2.4.0, or exclude the three nodes.
Published Feb 26, 2026 · Updated Jul 20, 2026 · Analysis Nov 8, 2026
What an attacker can do
These nodes build queries from node configuration parameters. Values go through escaped parameters, but identifiers such as table and column names were inserted without escaping. A workflow author who expects safe handling can still create a workflow where crafted identifier values change the SQL. The issue is classed as CWE-89.
The advisory says the author may do this unknowingly, for example by wiring data from a webhook or another node into a table or column name field. In that case input from outside n8n reaches the query, and the person who sent it needs no n8n account.
The attacker's rights come from the database credential attached to the node. SQL injection there can read, change or delete data beyond what the workflow was meant to touch. The CVSS 3.1 vector has scope changed with high confidentiality and integrity impact, and it needs low privileges. CVSS 4.0 gives a medium 5.3.
Who is affected
npm package n8n, versions before 2.4.0. Workflows that use the MySQL, PostgreSQL or Microsoft SQL nodes with table or column names set by expressions are at risk. Check the version:
npm ls -g n8nIn a Docker deployment, check the image tag. The Settings page of the n8n UI also shows the version.
n8n
- Ecosystem
- npm
- Affected
- < 2.4.0
- Fixed in
- 2.4.0
- Check
npm ls n8n
How to fix it
Upgrade to n8n 2.4.0 or later.
npm install -g [email protected]If you cannot upgrade at once, the advisory suggests two short-term steps that do not fully remove the risk:
- Limit workflow creation and editing to fully trusted users.
- Add n8n-nodes-base.mySql, n8n-nodes-base.postgres and n8n-nodes-base.microsoftSql to the NODES_EXCLUDE environment variable to disable the nodes.
How to tell if you were hit
Review workflows that use the three database nodes and find table or column fields set by expressions from webhooks, forms or other external data. Check database logs for queries with unexpected statements, UNION clauses, comments or access to tables the workflow does not normally use. Look at which n8n users hold the database credentials and which edited those workflows recently.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Impact
An authenticated user with permission to create or modify workflows and access to a database credential could unknowingly create a workflow that was vulnerable to SQL injection, even while expecting inputs to be handled safely through escaped parameters. By supplying specially crafted table or column names, an attacker could inject arbitrary SQL because the MySQL, PostgreSQL, and Microsoft SQL nodes did not escape identifier values when constructing queries, enabling injection through node configuration parameters.
Patches
The issue has been fixed in n8n version 2.4.0. Users should upgrade to this version or later to remediate the vulnerability.
Workarounds
If upgrading is not immediately possible, administrators should consider the following temporary mitigations:
- Limit workflow creation and editing permissions to fully trusted users only.
- Disable the MySQL, PostgreSQL, and Microsoft SQL nodes by adding
n8n-nodes-base.mySql,n8n-nodes-base.postgres, andn8n-nodes-base.microsoftSqlto theNODES_EXCLUDEenvironment variable.
These workarounds do not fully remediate the risk and should only be used as short-term mitigation measures.
Credit
Reporter: Pawel Bednarz from the NATO Cyber Security Centre (NCSC)
Questions
- Which n8n nodes are affected by CVE-2026-56351?
The MySQL, PostgreSQL and Microsoft SQL nodes. They did not escape table and column identifiers when building queries.
- Which n8n version fixes CVE-2026-56351?
n8n 2.4.0. The sources list no earlier fixed branch, so upgrade to 2.4.0 or later.
- Does CVE-2026-56351 need a logged-in user?
The CVSS vector needs low privileges: an authenticated user who can create or edit workflows and use a database credential. Outside data can reach the query if a workflow passes it into identifiers.
- Can I mitigate CVE-2026-56351 without upgrading?
Partly. Restrict workflow editing to trusted users and disable the three nodes with NODES_EXCLUDE. The advisory says these steps do not fully remove the risk.
References
Read for this analysis:
- https://github.com/n8n-io/n8n/security/advisories/GHSA-f3f2-mcxc-pwjx
- https://github.com/n8n-io/n8n/commit/f73fae6fe7fc34907bba102648a9997186aa4385
- https://github.com/n8n-io/n8n/releases/tag/n8n%402.4.0
- https://nvd.nist.gov/vuln/detail/CVE-2026-56351
- https://www.vulncheck.com/advisories/n8n-sql-injection-in-mysql-postgresql-and-microsoft-sql-nodes
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More n8n vulnerabilities
All n8n entriesCVE-2026-86073
n8n: Per-Resource OAuth Consent Bypass via Unbound Refresh Token Resource Substitution
medium5.9Sep 10, 2026CVE-2026-86074
n8n: Instance AI Credential Setup Accepts Unvalidated Probe URL from Fetched Content
medium5.9Sep 10, 2026CVE-2026-86075
n8n: Unauthenticated Persistent Storage Exhaustion via OAuth Dynamic Client Registration Endpoint
high8.7Sep 10, 2026CVE-2026-86076
n8n: Expression Sandbox Escape via Class-Field Sanitizer Rebinding Can Lead to Code Execution
high8.7Sep 10, 2026CVE-2026-86077
n8n: Anonymous Approval-Gate Bypass via Reused resumeToken over the Chat WebSocket
medium6.3Sep 10, 2026CVE-2026-86078
n8n: Prototype Pollution via Workflow Structure Summary Can Lead to Denial of Service
medium6.0Sep 10, 2026
