/

CVE-2026-85169

Severity:

HIGH RISK

(8.8)

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

CVE-2026-85169

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote 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

n8n contains an expression sandbox escape in the $fromAI handler that can expose host-language functionality through unsafe property resolution. An attacker with workflow-build privileges may use this behavior to execute arbitrary code in the main n8n process.

Affected context

The vulnerability affects n8n workflows that use the $fromAI handler and run on versions with the unsafe placeholder-resolution behavior. Risk arises when a user who can build or modify workflows can cause the handler to process attacker-controlled placeholder names, including reserved properties, within the expression sandbox.

Exploit preconditions

  • Attack surface: n8n workflow expressions using the $fromAI handler
  • Required access: Permission to create or modify workflows
  • Trigger point: Resolution of a caller-supplied placeholder name
  • Why exploitation is possible: Property resolution does not sufficiently restrict access to own, non-reserved properties and can expose a live host-prototype reference, allowing the sandbox boundary to be bypassed

Why this happens

The underlying bug is insufficient isolation between expression data and host-language object capabilities. The $fromAI handler resolves caller-controlled property names without requiring own-property access and permits reserved keys; when the input is a primitive, this behavior can expose an object prototype associated with the host runtime. That reference can provide a path to dynamic function construction and code execution, matching CWE-94: Improper Control of Generation of Code ('Code Injection').

Potential impact

  • An attacker may execute arbitrary JavaScript in the main n8n process
  • Workflow execution credentials and stored secrets could be exposed
  • The n8n service could be modified, disrupted, or used for persistence
  • Connected systems and data may be accessed or altered
  • The host environment could be used for further lateral movement, depending on privileges

General mitigation guidance

Mitigation generally focuses on preserving a strict separation between workflow data and host-language capabilities.

Common defensive patterns include:

  • Resolve only explicitly allowlisted data properties and require own-property checks
  • Reject reserved names and prototype-related property paths
  • Normalize or constrain primitive and object inputs before expression evaluation
  • Use capability-limited expression runtimes that do not expose constructors, prototypes, or dynamic code-generation APIs
  • Apply least privilege to the n8n service account and isolate its execution environment
  • Restrict workflow-building permissions to trusted users and separate authoring from execution privileges
  • Treat workflow definitions and expression inputs as untrusted content by default

How teams detect issues like this

Organizations can identify similar issues through:

  • Static analysis rules for unrestricted dynamic property access, prototype traversal, and use of dynamic function construction
  • Code review checks for expression handlers that accept caller-controlled property names
  • Tests covering reserved keys, inherited properties, primitive inputs, and prototype-chain exposure
  • Policy enforcement that blocks dynamic code generation and disallowed host objects in sandboxed runtimes
  • Monitoring for unexpected workflow changes, unusual process behavior, and access to sensitive environment resources

Automated security review tools may help flag dangerous property-resolution and sandbox-boundary patterns, but should be supplemented with runtime isolation testing.

Sources

SourceLink
github.comgithub.com/n8n-io/n8n/security/advisories/GHSA-9x83-43r8-5hwc
vulncheck.comvulncheck.com/advisories/n8n-before-1.123.73-remote-code-execution-via-fromai-prototype-leak

Frequently asked

questions

It may be exploitable through the n8n service when an attacker has workflow-building access and can cause a vulnerable expression path to run. Network reachability alone is not sufficient without the required application privilege.

The key prerequisite is permission to create or modify workflows that use the affected $fromAI behavior. The exact exposure depends on n8n account roles and deployment configuration.

Remove host-object exposure from expression evaluation, enforce own-property and allowlist checks, reject reserved names, and prevent access to constructors, prototypes, and dynamic code-generation capabilities.

Treat workflow expressions as untrusted programs, use capability-limited runtimes, test sandbox boundaries against inherited and reserved properties, and apply least privilege to both workflow authors and the n8n runtime.

Find out what's already
exploitable in your codebase.