/

CVE-2026-77077

Severity:

HIGH RISK

(7.6)

JavaScript Sandbox Escape (CWE-94) in n8n Task Runner

CVE-2026-77077

Analyzed

Vulnerability type

Category:

Sandbox Escape

CWE:

CWE-94

Impact:

Arbitrary Command Execution

Severity:

HIGH RISK

(7.6)

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 JavaScript task runner sandbox escape in n8n allows an authenticated user with Code node access to bypass intended isolation through prototype pollution. Successful exploitation may enable arbitrary command execution in the runner container and can affect other tenants sharing the same runner.

Affected context

The vulnerability occurs in n8n deployments where authenticated users can create or run JavaScript Code nodes. It is particularly relevant to shared task runners whose prototype-freezing protections do not cover internal module constructors. On deployments without task runners, JavaScript may execute in the main n8n process, which could increase the scope of compromise.

Exploit preconditions

  • Attack surface: JavaScript Code node execution
  • Required access: An authenticated account with permission to use Code nodes
  • Trigger point: Processing attacker-controlled JavaScript within the task runner
  • Why exploitation is possible: Prototype protections omit certain internal module constructors, allowing prototype pollution to alter process-wide behavior and escape the intended VM boundary

Why this happens

The underlying bug is an incomplete JavaScript sandbox hardening routine. Although functions exposed through globalThis are protected, internal module constructors such as EventEmitter remain mutable and can be reached through prototype relationships. This permits prototype pollution to modify shared runtime behavior and maps to CWE-94: Improper Control of Generation of Code, because attacker-controlled input can influence execution beyond the intended restricted code environment.

Potential impact

  • Arbitrary commands may execute within the task runner container
  • The runner process could be compromised
  • Other tenants' Code node executions may be affected through process-wide prototype corruption
  • Secrets or data available to the runner could be exposed
  • On deployments executing Code nodes in the main process, the n8n application may be at greater risk

General mitigation guidance

Mitigation generally focuses on using a thoroughly isolated execution architecture and preventing untrusted Code node users from reaching mutable runtime internals.

Common defensive patterns include:

  • Use a maintained, strongly restricted JavaScript execution boundary with comprehensive prototype hardening
  • Prefer process or container isolation over relying solely on an in-process VM sandbox
  • Restrict Code node access to trusted users and apply least-privilege authorization
  • Avoid sharing runners across tenants when prototype or process state can persist between executions
  • Limit runner access to credentials, filesystems, networks, and administrative interfaces
  • Keep task runner and sandbox components maintained through the organization's standard security update process
  • Apply resource, network, and filesystem policies that reduce the consequences of a sandbox escape

How teams detect issues like this

Detection can combine code review, runtime monitoring, and policy enforcement:

  • Review sandbox code for incomplete freezing of prototypes, constructors, globals, and module-provided objects
  • Use static analysis to identify exposed constructors, prototype mutation, dynamic property assignment, and unsafe VM boundaries
  • Monitor Code node executions for unexpected process APIs, child-process activity, filesystem changes, or outbound connections
  • Alert on prototype modifications involving shared built-in objects or internal module types
  • Enforce authorization policies that restrict Code node creation and execution to approved roles
  • Use automated security review tools to identify sandbox escape and code-generation patterns during development

Sources

SourceLink
github.comgithub.com/n8n-io/n8n/security/advisories/GHSA-m3hg-p5r9-fg9h
vulncheck.comvulncheck.com/advisories/n8n-before-remote-code-execution-via-eventemitter-prototype-pollution

Frequently asked

questions

Exploitation generally requires an authenticated user who is authorized to create or execute JavaScript Code nodes. Anonymous access alone is not typically sufficient.

Shared runners increase the risk because process-wide prototype corruption may affect subsequent executions and other tenants. Deployments that execute Code nodes in the main n8n process may face a broader impact.

Use a properly isolated execution boundary with comprehensive protection of built-in and internal objects, and avoid placing untrusted Code node execution in the main application process.

Restrict Code node privileges, isolate tenants and execution processes, minimize runner permissions, test sandbox boundaries against prototype and constructor abuse, and continuously monitor runner behavior.

Find out what's already
exploitable in your codebase.