/

CVE-2026-42234

Severity:

HIGH RISK

(8.8)

Code Injection in n8n Python Task Runner

CVE-2026-42234

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution within Task Runner Environment

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

An authenticated user with permission to create or modify workflows in n8n can exploit the Python Code Node to escape its sandbox and execute arbitrary code on the Python Task Runner container.

This issue is only relevant when the Python Task Runner feature is enabled, and it allows malicious workflow authors to run commands on the underlying task runner environment.

Affected context

The vulnerability occurs in n8n deployments that:

  • Have the Python Task Runner feature enabled
  • Allow users to add or edit workflows containing a Python Code Node
  • Rely on a sandboxed execution model for Python code within the task runner container

It primarily affects multi-tenant or shared n8n instances where workflow authors are not fully trusted and are expected to be constrained by the Python sandbox.

Exploit preconditions

  • Attack surface: Authenticated application users interacting with n8n's workflow editor
  • Required access: Ability to create or modify workflows that include a Python Code Node
  • Trigger point: Execution of a malicious workflow that causes the Python Code Node to bypass sandbox controls
  • Why exploitation is possible: The sandboxing mechanism for the Python Task Runner does not fully isolate user-supplied code, allowing crafted Python input to break out of the intended restricted environment and execute arbitrary commands on the task runner container

Why this happens

The root cause lies in incomplete sandboxing of user-provided Python code executed through the Python Code Node in the task runner.

While the node is intended to run in a restricted environment, the implementation leaves pathways for code to escape those restrictions, effectively enabling arbitrary code injection and execution.

This maps to CWE-94: Improper Control of Generation of Code ('Code Injection'), where dynamically supplied input is allowed to influence the code that runs, without sufficiently robust isolation or validation to prevent abuse.

Potential impact

  • Execution of arbitrary Python code within the task runner container
  • Reading or modification of data accessible to the task runner environment
  • Lateral movement to other services or systems reachable from the task runner
  • Disruption of workflows or denial of service on the affected task runner instance
  • Use of the compromised task runner as a foothold for broader infrastructure attacks, depending on surrounding controls

General mitigation guidance

Mitigation efforts generally focus on minimizing trust in user-authored code and strengthening execution isolation:

  • Restrict which users or roles are allowed to create or modify Python Code Nodes, especially in shared environments
  • Treat any user-supplied code as untrusted and design task runners to run with minimal privileges and tightly scoped permissions
  • Employ strong sandboxing or container hardening patterns, such as dropping unnecessary capabilities, using seccomp profiles, and isolating network access from task runners where feasible
  • Provide safer, higher-level building blocks for common automation tasks so users do not need to write arbitrary Python code
  • Separate high-privilege infrastructure from task runner networks to limit the blast radius if a task runner is compromised

How teams detect issues like this

High-level detection approaches may include:

  • Reviewing workflow definitions for Python Code Nodes that use suspicious patterns, such as dynamic imports, system calls, or access to environment variables and file system paths
  • Using static analysis or linters on embedded Python code to flag dangerous constructs or usage of sensitive modules and functions
  • Implementing logging and monitoring on task runner containers to capture unusual process behavior, file access, or outbound network connections originating from Python Code Nodes
  • Establishing code review or change-approval processes for workflows that incorporate arbitrary code execution nodes in multi-user environments

Sources

SourceLink
github.comgithub.com/n8n-io/n8n/security/advisories/GHSA-44v6-jhgm-p3m4

Frequently asked

questions

Exploitation is feasible where users can define or change workflows with a Python Code Node and the Python Task Runner is enabled; within that context, a malicious or compromised user account can reliably achieve code execution on the task runner.

The attack can typically be carried out through the n8n user interface or API by an authenticated user who can create or modify workflows using the Python Code Node; no direct network access to the task runner host is required beyond what n8n itself provides.

The safest general pattern is to harden or redesign the execution model so that user-supplied code cannot escape its sandbox, combined with strict least-privilege for task runner processes and strong role-based restrictions around who may use arbitrary code nodes.

Future designs can reduce risk by avoiding arbitrary code execution features where possible, isolating any necessary dynamic code execution in rigorously confined environments, enforcing clear trust boundaries for user content, and incorporating security reviews focused on sandbox and isolation mechanisms before deployment.

Find out what's already
exploitable in your codebase.