/

CVE-2026-27577

Severity:

CRITICAL RISK

(9.9)

Code Injection / Expression Injection in n8n Workflow

CVE-2026-27577

Analyzed

Vulnerability type

Category:

Code Injection / Expression Injection

CWE:

CWE-94

Impact:

Remote Code Execution by Authenticated Users

Severity:

CRITICAL RISK

(9.9)

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 expression evaluation engine contained flaws that allowed crafted workflow expressions to be interpreted as executable system commands on the host.

An authenticated user with permissions to create or modify workflows could embed malicious expressions in workflow parameters, potentially achieving remote code execution in environments running vulnerable n8n versions.

Affected context

This vulnerability occurs in n8n instances where users can author or modify workflows that include dynamic expressions in node parameters.

The risk is present when:

  • Expression evaluation is enabled and used to compute values at runtime
  • Workflow designers can input free-form expressions without strong sandboxing
  • The n8n server process runs with access to sensitive system resources or internal networks

It is particularly relevant in multi-user deployments or shared automation environments where not all users are fully trusted.

Exploit preconditions

  • Attack surface: n8n's web interface and API for workflow creation and editing.
  • Required access: Authenticated account with permission to create or modify workflows (or specific nodes/parameters that support expressions).
  • Trigger point: Execution of a workflow containing malicious expressions in parameters, typically when the workflow is run manually, triggered by an event, or executed on a schedule.
  • Why exploitation is possible: The expression evaluation engine insufficiently isolates or validates expression content, allowing it to resolve into constructs that are ultimately executed as system commands on the host instead of being treated purely as data.

Why this happens

The underlying issue stems from unsafe handling of user-controlled expressions within n8n's expression evaluation engine.

Instead of treating expressions as constrained, declarative templates, the engine permits constructs that can influence low-level command execution on the host system.

This aligns with CWE-94: Improper Control of Generation of Code ('Code Injection'), where attacker-controlled input is incorporated into an evaluation context that can generate or execute code.

In abstract terms, the system creates a bridge from "expression string" to "runtime code or OS command" without adequately constraining the allowed operations, leading to the possibility of arbitrary command execution when a workflow runs.

Potential impact

  • Execution of arbitrary system commands on the host running n8n
  • Access to environment variables, configuration secrets, and API keys reachable from the n8n process
  • Unauthorized access to internal services or databases reachable from the n8n host
  • Exfiltration or tampering of workflow data and connected system data
  • Use of the n8n host as a pivot point for further lateral movement within the infrastructure
  • Denial-of-service by consuming system resources or disrupting the n8n process

General mitigation guidance

Effective mitigation focuses on reducing the power of expression evaluation and narrowing trust boundaries around workflow authors:

  • Treat all dynamic expressions as untrusted input and avoid feeding them directly into code or command execution paths.
  • Introduce strict whitelisting in the expression language, exposing only safe, side-effect-free functions and removing any capability that can interact with the underlying operating system or unrestricted execution primitives.
  • Enforce clear separation between data transformation logic and any functionality that runs system-level commands or scripts.
  • Apply least-privilege to the n8n runtime: run the service under a dedicated low-privilege account, restrict file system and process-level capabilities, and isolate it using containers or sandboxes where feasible.
  • Limit workflow creation and editing permissions to trusted users and apply role-based access controls that distinguish between read-only, execution-only, and authoring privileges.
  • Regularly review workflows that use advanced expressions or powerful nodes, especially in shared or multi-tenant environments.

How teams detect issues like this

Detection approaches can combine configuration review, static analysis of workflow definitions, and runtime monitoring:

  • Implement automated checks that scan stored workflow definitions for suspicious expression patterns, such as references to command execution helpers, shell-like constructs, or unusual use of advanced expression features.
  • Use policy-based controls to flag or block workflows that include high-risk expressions or nodes, routing them for manual security review before activation.
  • Enable logging of expression evaluation and workflow execution outcomes; monitor logs for anomalies such as unexpected command invocations, access to sensitive paths, or unusual failure patterns.
  • During code review of the platform itself or custom extensions, look for any paths where expression outputs are passed to process-spawning APIs, dynamic evaluation constructs, or OS-level interfaces without strict mediation.
  • Complement these measures with general runtime monitoring of the n8n host for unusual processes, network connections, or file-access patterns indicative of command injection abuse.

Sources

SourceLink
docs.n8n.iodocs.n8n.io/hosting/securing/overview
github.comgithub.com/n8n-io/n8n/commit/1479aab2d32fe0ee087f82b9038b1035c98be2f6
github.comgithub.com/n8n-io/n8n/commit/9e5212ecbc5d2d4e6f340b636a5e84be6369882e
github.comgithub.com/n8n-io/n8n/security/advisories/GHSA-v98v-ff95-f3cp
github.comgithub.com/n8n-io/n8n/security/advisories/GHSA-vpcf-gvg4-6qwr

Frequently asked

questions

Exploitation requires an authenticated user account with the ability to create or modify workflows. Anonymous users cannot exploit it directly, but in environments where many users can design workflows, the attack surface is broader.

No OS-level privileges are required beyond those of the n8n process itself. However, the impact depends on what the n8n service account can access—if it runs with high privileges or broad network reach, the consequences can be severe.

The safest approach is to harden the expression evaluation model: remove or strictly constrain any expression capabilities that can generate or execute code or commands, and ensure that expression output is always treated as data, not executable instructions.

Design expression and scripting features under a "safe by default" principle, using sandboxed interpreters, minimal function surfaces, and strict validation. Combine this with strong RBAC for workflow authors, regular security review of powerful automation features, and least-privilege deployment of the automation platform itself.

Find out what's already
exploitable in your codebase.