Summary
A SQL injection flaw in n8n's Oracle Database node allowed user-controlled data in the Limit field to be interpolated directly into SELECT queries without sanitization or parameterization.
In workflows that route external input (for example, from webhooks) into this field, an attacker could inject arbitrary SQL and exfiltrate data from the connected Oracle database.
Affected context
This vulnerability occurs in n8n workflows that use the Oracle Database node's select operation and accept dynamic input into the Limit field via expressions.
It becomes relevant when workflow authors bind data from external or semi-trusted sources (such as webhooks, HTTP forms, or other user-controlled channels) into this field.
Environments where the Oracle node has access to sensitive schemas, production databases, or shared database accounts are particularly exposed, but even internal-only deployments can be affected if untrusted or less-controlled data is allowed to flow into the Limit expression.
Exploit preconditions
- Attack surface: n8n workflows using the Oracle Database node's select operation with expression-driven Limit values.
- Required access: Ability to supply or influence the data that flows into the Limit field expression (e.g., sending HTTP requests to a webhook or API endpoint that the workflow consumes).
- Trigger point: Execution of the affected Oracle select node when it constructs and sends the SQL query using the unsanitized Limit expression value.
- Why exploitation is possible: The Limit field content is concatenated directly into the SQL query string without proper parameterization or validation, allowing crafted input to alter the structure of the query instead of being treated as a simple numeric limit.
Why this happens
The underlying bug is a classic SQL injection pattern mapped to CWE-89: Improper Neutralization of Special Elements used in an SQL Command.
Instead of treating the Limit value as data, the implementation interpolated expressions directly into the SQL query string, assuming numeric content and not applying any parameterization or strict validation.
Because the query builder did not constrain or sanitize the resulting string, any special SQL characters or fragments embedded in the Limit expression could break out of the intended context and modify the query, enabling arbitrary SQL to be executed under the database credentials configured for the Oracle node.
Potential impact
- An attacker could exfiltrate data from the connected Oracle database, including sensitive tables reachable by the node's credentials.
- The attacker could read or enumerate additional schemas and metadata, depending on database permissions.
- Malicious queries could modify or delete data (INSERT/UPDATE/DELETE) if the configured account has write privileges.
- In some deployments, chained SQL features (e.g., stored procedures, database jobs) could be leveraged for further lateral movement or escalation within the database environment.
General mitigation guidance
Effective mitigation centers on treating all dynamic query components as untrusted and ensuring they cannot alter SQL structure:
- Prefer parameterized queries or query builder abstractions that strictly separate data from SQL syntax, even for fields like Limit and offset.
- Constrain dynamic numeric fields by validating input types and ranges before building queries (for example, enforcing integer-only values and safe bounds).
- Avoid directly concatenating expression outputs into SQL; use whitelisting for allowable patterns if dynamic behavior is required (such as a fixed set of safe numeric limits).
- Isolate database credentials used by automation workflows to least-privilege accounts, limiting the impact if a query is compromised.
- Encourage workflow authors to treat any data coming from webhooks or other external integrations as untrusted and subject to validation before use in database nodes.
How teams detect issues like this
Organizations can detect and monitor for similar flaws through multiple approaches:
- Static analysis and code review: Flag any query-building logic that string-concatenates user-controlled or expression-derived values into SQL clauses (including Limit, ORDER BY, or WHERE) without parameterization or type checks.
- Configuration and workflow review: Periodically review n8n workflows for database nodes that accept raw external input into advanced fields, especially those controlling query structure.
- Database-level monitoring: Use SQL logging, database audit trails, and anomaly detection to surface unusual query patterns, such as unexpected concatenated fragments or attempts to access unrelated tables.
- Policy enforcement: Establish guardrails in CI/CD or deployment pipelines that prevent shipping automation workflows or extensions with ad-hoc SQL string construction from unvalidated inputs.

