CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-F3F2-MCXC-PWJX

n8n SQL Injection: When Low-Code Meets High-Risk

Amit Schendel
Amit Schendel
Senior Security Researcher

Feb 26, 2026·7 min read·23 visits

Executive Summary (TL;DR)

Improper sanitization in n8n's database nodes allowed SQL injection via table names (MSSQL), LIMIT clauses, and WHERE conditions (MySQL/PostgreSQL). Fixed in version 2.4.0.

n8n, the beloved workflow automation tool that glues the internet together, has patched a critical SQL Injection vulnerability affecting its Microsoft SQL, MySQL, and PostgreSQL nodes. The flaw allowed attackers with workflow editing permissions—or external actors feeding data into dynamic workflow inputs—to break out of SQL contexts via unsanitized table identifiers, LIMIT clauses, and WHERE conditions. This wasn't just a simple query manipulation; in some database configurations, it effectively handed over the keys to the kingdom, allowing for arbitrary command execution and total data exfiltration.

The Hook: Automation or Automagical Pwnage?

We all love n8n. It’s the 'Swiss Army Knife' of the modern web, letting developers and ops teams stitch together disparate APIs into beautiful, flowing pipelines of data. It executes code, moves files, and—crucially—talks to your databases. But here is the thing about Swiss Army Knives: if you hold them wrong, you cut your fingers off.

In this case, the knife slipped in the most classic way possible: SQL Injection. The vulnerability (GHSA-f3f2-mcxc-pwjx) resides deep within the core nodes that n8n uses to communicate with Microsoft SQL Server, MySQL, and PostgreSQL. It turns out that n8n was trusting user inputs a little too much when constructing dynamic queries.

Imagine a scenario where a low-level analyst has permission to create workflows to generate reports. Usually, they are confined to SELECT statements on harmless tables. With this bug, that analyst could craft a table name or a filter condition that convinces the database server to drop the users table, exfiltrate password hashes, or—in the case of MS SQL—potentially pop a shell if xp_cmdshell is enabled. It is a stark reminder that 'low-code' often means 'low-visibility' on security flaws.

The Flaw: Trusting the Bracket

The root cause here is a tale as old as time: string concatenation. Developers often assume that if they wrap an identifier in quotes or brackets, it's safe. It is not.

The MS SQL Mistake

In Microsoft SQL Server, it is common practice to wrap table and column names in square brackets (e.g., [MyTable]) to handle spaces or reserved keywords. The n8n developers implemented this, but they forgot one crucial detail: you have to escape the closing bracket.

If the application takes your input MyTable and wraps it as [MyTable], what happens if you input MyTable] ; DROP TABLE secrets; --?

The application naïvely constructs: [MyTable] ; DROP TABLE secrets; --]. The database sees a valid identifier [MyTable], followed by a semicolon terminating the statement, followed by your malicious payload. The trailing ] becomes a syntax error or is commented out, but by then, the damage is done.

The MySQL & PostgreSQL Mistake

For the open-source databases, the flaw was slightly different but equally embarrassing. The LIMIT and WHERE clauses were being constructed by directly appending user-supplied strings to the query.

In many n8n nodes, you can set a 'Limit' for the number of rows returned. If you set that limit to 10; DROP TABLE users, and the code just does ... LIMIT + input, you have just successfully executed a stacked query injection (depending on the driver configuration).

The Code: The Smoking Gun

Let's look at the diffs. The vulnerability existed in GenericFunctions.ts and specific node implementation files. The fix involved moving from naive string manipulation to robust validation and escaping.

The Vulnerable MS SQL Logic:

Before the patch, the code essentially did this for column mapping:

// Vulnerable: Naive wrapping
return columns.split(',').map((column) => `[${column.trim()}]`).join(', ');

It blindly trusts that column does not contain a closing bracket ].

The Fix (Commit f73fae6):

The patch introduces a validator or stricter escaping. For the WHERE clauses in MySQL/Postgres, they implemented an allowlist for operators. Instead of letting the user type any operator (like = 1; DROP...), the code now checks if the operator is in a safe list:

// The Fix: Whitelisting operators
const allowedOperators = [
  'equal', '=', '!=', 'LIKE', '>', '<', '>=', '<=', 
  'IS NULL', 'IS NOT NULL'
];
 
if (!allowedOperators.includes(operator)) {
  throw new Error('Invalid operator');
}

This simple check neutralizes the attack vector for the WHERE clause by ensuring that the "operator" is actually a mathematical or logical symbol, not an arbitrary SQL string. For identifiers, they likely moved to using the database driver's native escaping methods or rigorously escaping the delimiter characters.

The Exploit: Breakout

How would an attacker weaponize this? Let's assume you have access to an n8n instance, or you can trigger a webhook that feeds data into a vulnerable node.

Scenario 1: MS SQL Injection via Table Name

You are creating a workflow that inserts data into a dynamic table. The table name is pulled from a JSON input.

  • Input: AuditLog] WITH (NOLOCK); WAITFOR DELAY '0:0:05'; --
  • Generated SQL: INSERT INTO [AuditLog] WITH (NOLOCK); WAITFOR DELAY '0:0:05'; --] ...

If the application pauses for 5 seconds, you have confirmed injection. From here, you can escalate to data extraction or xp_cmdshell if you are lucky (or unlucky, if you are the admin).

Scenario 2: PostgreSQL LIMIT Injection

Postgres allows stacked queries if the underlying driver supports it (which is common in Node.js environments using pg).

  • Target: A workflow querying a customer list.
  • Malicious Input (Limit): 1; UPDATE users SET password_hash = '...' WHERE admin = true; --
  • Generated SQL: SELECT * FROM customers LIMIT 1; UPDATE users SET password_hash = '...' WHERE admin = true; --

The first query runs (returns 1 row), and the second query runs immediately after, resetting the admin password.

> [!CAUTION] > Re-exploitation Potential: Even after patching, always verify that your database drivers are configured to disable multiple statements (stacked queries) unless absolutely necessary. This is a defense-in-depth measure that n8n's code fix essentially emulates by validating input, but the database config is the final backstop.

The Impact: Keys to the Kingdom

Why is this a big deal? n8n is an integration tool. It is designed to have access to everything: your CRM, your payment processor, your internal databases, and your Slack.

If an attacker compromises the n8n database connection:

  1. Lateral Movement: They can pivot from the database to other connected services.
  2. Data Exfiltration: SELECT * FROM users is just the start. They could dump your entire customer database.
  3. Data Destruction: DROP TABLE or DELETE FROM commands are trivial to execute.
  4. RCE: In some configurations (Postgres COPY TO PROGRAM, MS SQL xp_cmdshell, MySQL INTO OUTFILE), SQL injection leads directly to Remote Code Execution on the database server itself.

Since n8n is often deployed internally behind a firewall but accessible via webhooks, this vulnerability could turn a minor SSRF or a compromised low-level account into a full infrastructure compromise.

The Fix: Patch Tuesday came early

The remediation is straightforward but urgent.

1. Update n8n Upgrade to version 2.4.0 or later immediately. The patch creates a hard whitelist for query operators and sanitizes identifiers correctly.

2. Least Privilege (The Real Fix) Why does your n8n instance need DROP TABLE permissions? It probably doesn't.

Review the database users credentials stored in n8n credentials:

  • Revoke DROP, ALTER, and GRANT permissions.
  • Restrict access to only the specific schemas/tables the workflow actually needs.
  • Disable stacked queries in your database driver configuration if possible.

3. Audit Workflows Check your existing workflows for any nodes that accept user input for Table Names or raw SQL parameters. Even with the patch, passing raw user input into a "Execute Query" node (if used explicitly) remains a risky design pattern.

Official Patches

n8nn8n v2.4.0 Release Notes

Fix Analysis (1)

Technical Appendix

CVSS Score
8.8/ 10
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
EPSS Probability
0.04%
Top 100% most exploited

Affected Systems

n8n (Self-hosted)n8n (Cloud)Microsoft SQL Server NodesMySQL NodesPostgreSQL Nodes

Affected Versions Detail

Product
Affected Versions
Fixed Version
n8n
n8n.io
< 2.4.02.4.0
AttributeDetail
CWE IDCWE-89
Attack VectorNetwork (Authenticated/Webhook)
CVSS8.8 (Estimated)
RiskCritical
Exploit StatusPoC Available
Patchv2.4.0

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1505Server Software Component
Persistence
CWE-89
SQL Injection

Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection')

Known Exploits & Detection

GitHub AdvisoryOfficial advisory containing PoC payloads for MS SQL, MySQL, and Postgres.

Vulnerability Timeline

Vulnerability Disclosed
2025-01-09
Patch Released (v2.4.0)
2025-01-09

References & Sources

  • [1]GitHub Advisory GHSA-f3f2-mcxc-pwjx
  • [2]Fix Commit

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•4 days ago•CVE-2026-9354
6.9

CVE-2026-9354: Arbitrary Mass Mention Bypass in NousResearch hermes-agent Slack and Mattermost Adapters

A vulnerability in the Slack and Mattermost platform adapters for NousResearch hermes-agent permits an unauthenticated remote attacker to execute arbitrary mass mentions. By leveraging prompt injection, an attacker can bypass output sanitization logic and trigger workspace-wide notification exhaustion.

Alon Barad
Alon Barad
32 views•6 min read
•4 days ago•CVE-2026-9306
6.3

CVE-2026-9306: Unauthenticated Insecure Direct Object Reference (IDOR) in QuantumNous new-api Midjourney Relay

CVE-2026-9306 is a critical unauthenticated Insecure Direct Object Reference (IDOR) vulnerability located in the QuantumNous new-api application, affecting versions up to and including 0.12.1. The flaw is caused by improper middleware ordering combined with a lack of object-level authorization checks. This allows remote, unauthenticated attackers to retrieve sensitive Midjourney images belonging to other users by supplying a valid task identifier.

Amit Schendel
Amit Schendel
13 views•5 min read
•5 days ago•GHSA-GGXF-37HM-9WQF
6.5

GHSA-GGXF-37HM-9WQF: Session Leakage via Unsafe Challenge Path Parsing in instagrapi

The instagrapi library prior to version 2.6.9 contains an improper input validation vulnerability within its challenge handling mechanism. Maliciously crafted server responses can manipulate the client into forwarding session cookies and credentials to an external attacker-controlled domain.

Amit Schendel
Amit Schendel
20 views•6 min read
•5 days ago•GHSA-QQQM-5547-774X
9.1

GHSA-QQQM-5547-774X: Unauthenticated Path Traversal in FileBrowser Quantum PATCH Handler

GHSA-QQQM-5547-774X is a critical path traversal vulnerability in the FileBrowser Quantum application, specifically within the Go backend package. The vulnerability resides in the HTTP handler responsible for processing bulk file modifications via the public API. Unauthenticated attackers can exploit an order-of-operations flaw in the path sanitization logic to bypass intended directory restrictions. This allows adversaries to arbitrarily read, move, and overwrite files on the underlying filesystem by supplying specially crafted HTTP PATCH requests.

Alon Barad
Alon Barad
6 views•6 min read
•5 days ago•CVE-2026-8723
5.3

CVE-2026-8723: Synchronous Denial of Service in qs npm Package via TypeError

The qs query string parsing and serialization library for Node.js is vulnerable to a synchronous Denial of Service (DoS) attack. The vulnerability manifests as a process-terminating TypeError when processing arrays with null or undefined elements under specific configuration parameters.

Amit Schendel
Amit Schendel
35 views•7 min read
•5 days ago•GHSA-7M8F-HGJQ-8GC9
7.5

GHSA-7M8F-HGJQ-8GC9: Pre-Authentication Denial of Service via Insecure Deserialization Order in aiosend

The aiosend library prior to version 3.0.6 contains a pre-authentication Denial of Service (DoS) vulnerability in its webhook handling mechanism. The software processes and deserializes incoming JSON payloads before verifying the cryptographic signature, allowing unauthenticated attackers to exhaust server CPU and memory resources by sending large, complex payloads.

Amit Schendel
Amit Schendel
3 views•6 min read