/

CVE-2026-72765

Severity:

CRITICAL RISK

(9.9)

Code Injection (CWE-94) in n8n Expression Sandbox Eval

CVE-2026-72765

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution

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

A critical sandbox escape in n8n expression evaluation allows an authenticated workflow author to bypass restrictions using specially crafted arrow-function expressions. Under affected versions and sufficient workflow permissions, this may execute system commands on the host running n8n.

Affected context

The vulnerability occurs in n8n deployments that evaluate user-controlled workflow expressions inside the expression sandbox. It becomes risky when an authenticated user can create or modify workflows and the affected expression evaluator processes arrow-function bodies without adequately restricting their behavior.

Exploit preconditions

  • Attack surface: n8n workflow expression evaluation
  • Required access: An authenticated account with permission to create or modify workflows
  • Trigger point: Evaluation of a crafted expression containing an arrow-function body
  • Why exploitation is possible: The expression sandbox can be bypassed, allowing expression logic to reach host-level system command execution

Why this happens

The underlying issue is insufficient isolation of executable expression logic within n8n's sandbox. Certain arrow-function bodies are handled in a way that permits sandbox restrictions to be bypassed, allowing attacker-controlled expressions to invoke capabilities outside the intended evaluation model. This maps to CWE-94: Improper Control of Generation of Code, because input-controlled expression content can be interpreted as executable code beyond the permitted boundaries.

Potential impact

  • An attacker may execute system commands on the n8n host
  • The attacker could access or alter workflow data and credentials available to the process
  • The n8n service may be compromised or disrupted
  • Connected systems and downstream automation could be affected
  • A compromised host could support lateral movement, depending on runtime privileges and network access

General mitigation guidance

Mitigation focuses on ensuring that expression evaluation cannot cross the intended trust boundary.

Common defensive patterns include:

  • Use a release containing the vendor's security fix rather than relying on sandbox restrictions alone
  • Replace general-purpose expression execution with narrowly scoped, allowlisted operations
  • Reject or safely transform unsupported function constructs before evaluation
  • Limit workflow-authoring permissions to trusted users and groups
  • Run n8n with least-privilege operating-system and network permissions
  • Keep secrets and sensitive host capabilities outside the workflow execution context where possible
  • Apply container, filesystem, and network isolation to reduce the consequences of a sandbox failure

How teams detect issues like this

Organizations can look for this issue through:

  • Static analysis and code review of expression evaluators, sandbox boundaries, and dynamic code-generation paths
  • Tests covering arrow functions, nested expressions, generated functions, and attempts to access host APIs
  • Audit logs for unexpected workflow creation or modification by authenticated users
  • Monitoring n8n processes for unusual child-process creation, shell invocation, or unexpected outbound connections
  • Policy enforcement that restricts workflow editing and flags high-risk expression constructs
  • Automated security review tools that identify code-generation and sandbox-escape patterns

Sources

SourceLink
github.comgithub.com/n8n-io/n8n/security/advisories/GHSA-gv7g-jm28-cr3m
vulncheck.comvulncheck.com/advisories/n8n-before-remote-code-execution-via-expression-sandbox-escape

Frequently asked

questions

It can be exploitable through the n8n application when an authenticated user has workflow creation or modification privileges and the instance evaluates the affected expressions.

Not necessarily. The key requirement is permission to create or modify workflows; the exact scope depends on the deployment's role and access-control configuration.

Use a release containing the vendor's fix and ensure that expression evaluation uses a narrowly defined, deny-by-default execution model rather than relying on a broad sandbox.

Minimize workflow-authoring privileges, test expression sandboxes against language edge cases, monitor for anomalous process activity, and run the automation service with least privilege and strong isolation.

Find out what's already
exploitable in your codebase.