/

CVE-2026-54313

Severity:

HIGH RISK

(7.7)

NoSQL Injection (CWE-89) in n8n MongoDB Node Filters

CVE-2026-54313

Analyzed

Vulnerability type

Category:

Injection Vulnerability

CWE:

CWE-89

Impact:

Unauthorized Data Modification and NoSQL Injection

Severity:

HIGH RISK

(7.7)

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

An input validation flaw in n8n's MongoDB node allows an authenticated workflow editor to craft malicious filter values that are passed directly to MongoDB as query filters.

Under these conditions, an attacker can cause unintended documents to be matched and overwritten with attacker-controlled content, risking data integrity wherever such workflows run.

Affected context

This vulnerability arises in n8n workflows that use the MongoDB node's "Find And Replace" operation and accept dynamic, user-influenced filter values.

It becomes relevant when authenticated users can edit workflows or configure node parameters, and those filter values are treated as trusted and forwarded directly to the database engine.

The risk is higher in environments where the MongoDB node points to production databases or where workflow designers share access across teams without strict role boundaries.

Exploit preconditions

  • Attack surface: n8n workflow editor and MongoDB node configuration.
  • Required access: Authenticated access with permissions to create or edit workflows containing MongoDB "Find And Replace" operations.
  • Trigger point: Execution of a workflow where the MongoDB node uses an attacker-supplied filter value as the query filter.
  • Why exploitation is possible: The filter value is not validated, normalized, or constrained before being passed to MongoDB, enabling crafted input to match broader or unintended sets of documents and drive overwrite operations.

Why this happens

The underlying issue is an injection-style flaw where application logic passes externally controlled data into a database query without sufficient validation or constraint.

In the affected MongoDB node, filter parameters are treated as trusted and forwarded as-is to the query engine, which corresponds to CWE-89: Improper Neutralization of Special Elements used in an SQL Command when generalized to NoSQL query construction.

Abstractly, the insecure pattern is: allowing workflow-configurable query filters to be fully expressive objects without schema restrictions, type checks, or safe construction helpers, so the database interprets attacker-designed filters as legitimate query criteria.

Potential impact

  • Unintended modification or overwrite of legitimate documents in MongoDB collections.
  • Data corruption in workflows that rely on the "Find And Replace" operation for critical records.
  • Loss of application integrity where downstream processes consume tainted or incorrect data.
  • Potential expansion of access to data that the workflow designer did not intend to touch, depending on filter scope.

General mitigation guidance

Effective mitigation focuses on constraining and sanitizing query filters before they reach the database.

Common defensive patterns include:

  • Applying strict schema validation to MongoDB node input, limiting which fields and operators can be used in filters.
  • Constructing queries through well-defined, typed configuration objects rather than accepting arbitrary filter structures.
  • Enforcing role-based workflows so only trusted users can author database-modifying operations, and using least-privilege database credentials.
  • Adding server-side checks that reject overly broad or ambiguous filters for data modification operations.

How teams detect issues like this

Teams can look for this class of issue by:

  • Using static analysis or configuration linting to identify nodes or components that pass user-controlled filters directly into database APIs.
  • Reviewing workflow definitions for MongoDB operations that both read and write data, especially "Find And Replace" patterns with unconstrained filter fields.
  • Implementing policy checks in CI/CD that flag workflows containing arbitrary query objects or dangerous operators for manual review.
  • Leveraging automated security scanning tools that understand infrastructure-as-code or workflow-as-code formats to surface injection-like patterns in database nodes.

Sources

SourceLink
github.comgithub.com/n8n-io/n8n/security/advisories/GHSA-jpq7-226w-6cxx

Frequently asked

questions

Exploitation is limited to environments where an attacker has workflow edit access and can influence MongoDB node filters, but within those constraints they may impact any documents reachable by the configured database connection and collection.

The attacker must be an authenticated user with permissions to create or modify workflows that use the MongoDB "Find And Replace" operation; they do not need direct database access outside the workflow engine.

The most robust fix is to treat filter values as untrusted input, enforce strict validation and schema constraints on them, and ensure that queries are built through hardened helper functions that eliminate unsafe operators or overly broad matches.

Adopt a design standard that any node or component building database queries uses validated, typed parameters, apply role-based restrictions around data-modifying operations, and integrate security-focused reviews or automated checks into the workflow development lifecycle.

Find out what's already
exploitable in your codebase.