/

CVE-2026-85165

Severity:

CRITICAL RISK

(9.9)

Expression Sandbox Bypass (CWE-95) in n8n Workflows

CVE-2026-85165

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-95

Impact:

Process-Wide Host Object Modification

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 expression sandbox bypass in n8n allows certain free identifiers used in expressions to resolve against process-global objects. An authenticated user with workflow-edit permission may mutate host objects during expression evaluation, causing changes to persist across the process until it is restarted.

Affected context

The issue occurs in n8n deployments that evaluate user-controlled workflow expressions inside a sandbox and permit authenticated users to edit workflows. It becomes risky when expression evaluation exposes process globals through spread, computed-key, switch-case, or class-extension contexts, allowing mutations to affect shared runtime state rather than only the current expression.

Exploit preconditions

  • Attack surface: n8n workflow expression evaluation - Required access: An authenticated account with permission to edit

workflows

  • Trigger point: Evaluation of an expression using affected language

constructs

  • Why exploitation is possible: The sandbox incorrectly resolves certain

free identifiers against process-global objects, permitting expression

evaluation to reach and mutate shared host state

Why this happens

The underlying bug is an incomplete isolation boundary in the expression sandbox. Identifier resolution for specific syntactic positions can escape the intended expression scope and bind to process-global objects. This behavior maps to CWE-95: Improper Neutralization of Directives in Dynamically-Evaluated Code, because user-influenced expressions are evaluated with access to runtime behavior that should remain outside the sandbox.

Potential impact

  • An attacker may alter shared objects within the n8n process.
  • Malicious changes could persist across workflow executions until restart.
  • Workflow behavior, execution results, or connected integrations could be affected.
  • The issue could enable broader application compromise depending on exposed host objects and process privileges.
  • Data integrity or automation reliability could be degraded.

General mitigation guidance

Mitigation generally focuses on strengthening expression isolation and reducing the authority available to evaluated code. Secure-by-default patterns include using a narrowly defined allowlist of expression capabilities, preventing access to process globals and host objects, and resolving identifiers only within an explicit evaluation scope. Expression inputs can be treated as untrusted, with structural validation and policy enforcement applied before evaluation. Workflow-edit permissions should follow least privilege, and execution processes should run with only the permissions required for their tasks. Shared mutable state should also be minimized or isolated so that expression evaluation cannot create process-wide side effects.

How teams detect issues like this

Detection approaches include static analysis for dynamic evaluation paths, unsafe global-object exposure, and incomplete identifier allowlists. Code review should examine sandbox scope construction, handling of computed properties, spread expressions, switch cases, and class inheritance expressions. Runtime monitoring can look for unexpected mutations to shared process objects or changes in workflow behavior after expression execution. Policy enforcement can require security review for expression-engine changes and restrict workflow-edit permissions. Automated code review tools may help identify sandbox escapes and dangerous host-object references.

Sources

SourceLink
github.comgithub.com/n8n-io/n8n/security/advisories/GHSA-fg85-4wv2-p98j
vulncheck.comvulncheck.com/advisories/n8n-before-2.36.2-expression-sandbox-bypass-via-spreadelement

Frequently asked

questions

Exploitation generally requires authentication and permission to edit or otherwise modify workflows that contain evaluated expressions.

It may be possible through a reachable n8n instance when an authenticated user has the required workflow-edit permissions. The exact scope depends on deployment exposure and access controls.

Strengthen the expression sandbox by using explicit capability allowlists, preventing access to process globals, and ensuring evaluated expressions cannot mutate shared host state.

Treat workflow expressions as untrusted code, test every supported syntax form, enforce least-privilege workflow permissions, and add static and runtime checks for sandbox boundary violations.

Find out what's already
exploitable in your codebase.