/

CVE-2026-86083

Severity:

HIGH RISK

(8.8)

Code Injection (CWE-94) in n8n Legacy Expression Engine

CVE-2026-86083

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Arbitrary Code Execution

Severity:

HIGH RISK

(8.8)

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 code-generation flaw in n8n's legacy expression engine allows an expression to replace the mutable global JSON.stringify function. When later expressions generate source code, attacker-controlled content may be inserted into that source and executed.

The issue becomes risky when an attacker can create or influence expressions processed by the legacy engine. The separate vm expression engine is not affected.

Affected context

The vulnerability occurs in n8n deployments that use the legacy expression engine and process attacker-influenced expressions through its source-generation paths. The affected behavior involves synthetic string literal generation and timezone interpolation that rely on the mutable global JSON.stringify. Deployments using the vm expression engine are outside the described affected path.

Exploit preconditions

  • Attack surface: n8n expression evaluation and code-generation components
  • Required access: The ability to create, modify, or cause execution of expressions processed by the legacy engine
  • Trigger point: Later source generation after the global JSON.stringify behavior has been altered
  • Why exploitation is possible: Generated source is constructed using a mutable global function without sufficiently isolating or validating the resulting text, allowing expression-controlled content to become executable code

Why this happens

The underlying bug is a code-generation trust-boundary failure. The legacy expression engine uses the mutable global JSON.stringify while emitting source text, including synthetic string literals and timezone-related values. Because expression-controlled code can replace or influence that function, later generated source may contain executable attacker-controlled text.

This maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), where data incorporated into generated source is not reliably constrained to remain non-executable.

Potential impact

  • An attacker may execute arbitrary code in the n8n process context.
  • Workflow credentials, configuration, or stored data could be exposed.
  • The application could be modified, disrupted, or used to access connected services.
  • A compromised n8n instance could facilitate lateral movement depending on its permissions and network access.

General mitigation guidance

Mitigation generally focuses on removing executable interpretation from generated source and isolating all code-generation dependencies from expression-controlled state.

Common defensive patterns include:

  • Replacing source generation with structured values, AST-based construction, or fixed safe templates where practical.
  • Capturing trusted serialization behavior outside the expression-controlled environment rather than resolving mutable globals at generation time.
  • Separating expression evaluation from privileged application code and restricting the available runtime surface.
  • Applying strict expression-language allowlists and rejecting access to mutation or code-construction primitives.
  • Running workflow automation with least-privilege identities and minimizing access to secrets, filesystems, and connected services.
  • Using maintained releases that contain the vendor's corrective changes, while validating the selected expression engine in deployment policy.

How teams detect issues like this

Detection can combine source review, runtime controls, and dependency policy:

  • Use static analysis to identify generated source construction, dynamic evaluation, mutable global lookups, and serialization functions used in code emitters.
  • Review whether expression-controlled values can alter parser, serializer, or code-generation functions.
  • Add tests that attempt to mutate global helpers and verify that generated expressions remain data-only.
  • Monitor workflow definitions and expression changes, especially when they are submitted by less-trusted users or automation.
  • Enforce policy requiring approved expression engines and disallowing dynamic code generation in workflow runtimes.
  • Automated code review and software composition analysis tools may help identify related code-generation and injection patterns.

Sources

SourceLink
github.comgithub.com/n8n-io/n8n/releases/tag/n8n@1.123.76
github.comgithub.com/n8n-io/n8n/releases/tag/n8n@2.37.7
github.comgithub.com/n8n-io/n8n/releases/tag/n8n@2.38.2
github.comgithub.com/n8n-io/n8n/security/advisories/GHSA-6xcw-7xm6-48c6

Frequently asked

questions

Exploitability depends on how n8n is exposed and who can create or influence workflows and expressions. It may be reachable through a web-accessible workflow management surface, but an attacker generally needs an accepted path to expression execution.

Usually, some form of workflow or expression access is required. Whether authentication is needed depends on n8n access controls, exposed APIs, and integrations that can modify workflow content.

Use a vendor-maintained release containing the correction and ensure affected deployments do not use the vulnerable legacy code-generation path. In application design, keep generated source independent of mutable expression state.

Prefer structured evaluation over source generation, isolate untrusted expressions, restrict runtime capabilities, test mutation and sandbox boundaries, and enforce least privilege for workflow processes.

Find out what's already
exploitable in your codebase.