CVE-2026-56777: n8n: AST validator bypass leaks env vars in Python node

MEDIUM
Published June 30, 2026
CISO Take

A validator that is supposed to sandbox the Python Code node in n8n can be bypassed by any authenticated user who is allowed to create or edit workflows, giving them access to the task executor's module namespace and, where N8N_BLOCK_RUNNER_ENV_ACCESS is misconfigured to allow it, the environment variables available to that process. This only matters on self-hosted instances running the Python Task Runner, and the CVSS 5.0 (confidentiality-only, no integrity/availability impact) reflects a narrow but real insider-risk: n8n is frequently wired up as an AI agent/automation hub, so those env vars can include OpenAI/Anthropic keys, database credentials, or webhook secrets shared across workflows. There's no public exploit, no Nuclei template, and it isn't in CISA KEV, and EPSS puts real-world exploitation likelihood at 0.00245 — low urgency for opportunistic attackers, but the low privilege bar (PR:L, any workflow editor, not an admin) makes it relevant anywhere workflow-creation rights aren't tightly scoped. Patch to n8n 2.25.7 / 2.26.2, and in the interim confirm N8N_BLOCK_RUNNER_ENV_ACCESS blocks runner env access and restrict who can author or modify workflows containing Python Code nodes.

Sources: NVD GitHub Advisory EPSS OpenSSF ATLAS vulncheck.com

What is the risk?

Medium severity per CVSS (5.0, confidentiality-low only) but the practical risk is config-dependent: exploitation requires an authenticated account with workflow create/edit rights, a self-hosted deployment with the Python Task Runner enabled, and N8N_BLOCK_RUNNER_ENV_ACCESS configured permissively. Where all three conditions hold, the low privilege bar (PR:L, not admin-only) and network-reachable, no-user-interaction profile (AV:N/UI:N) make this meaningfully exploitable by any semi-trusted internal user or compromised low-privilege account — an insider-threat and lateral-movement primitive rather than an internet-wide mass-exploitation risk. No KEV listing, no public PoC, and a low EPSS score all argue against treating this as an emergency, but n8n's role as an AI/automation backbone means any credential leaked via env vars can have outsized downstream impact.

How does the attack unfold?

Initial Access
Attacker holds or obtains an authenticated n8n account with permission to create or modify workflows on a self-hosted instance running the Python Task Runner.
AML.T0012
Validator Bypass
Attacker crafts Python code in a Code node that evades the AST-based security validator's disallowed-input checks.
AML.T0107
Sandbox Escape
The bypassed code executes with access to the task executor's module namespace, beyond the intended sandbox boundary.
AML.T0050
Impact — Credential Disclosure
If N8N_BLOCK_RUNNER_ENV_ACCESS permits it, the attacker reads environment variables containing API keys or credentials, enabling theft or lateral movement.
AML.T0055

What systems are affected?

Package Ecosystem Vulnerable Range Patched
n8n npm No patch
201.9K OpenSSF 6.7 Pushed today 51% patched ~6d to patch Full package profile →

Do you use n8n? You're affected.

How severe is it?

CVSS 3.1
5.0 / 10
EPSS
0.2%
chance of exploitation in 30 days
Higher than 16% of all CVEs
Exploitation Status
No known exploitation
Sophistication
Moderate

What is the attack surface?

AV AC PR UI S C I A
AV Network
AC Low
PR Low
UI None
S Changed
C Low
I None
A None

What should I do?

1 step
  1. 1) Upgrade to n8n 2.25.7 or 2.26.2+ immediately on any self-hosted instance running the Python Task Runner. 2) Until patched, verify N8N_BLOCK_RUNNER_ENV_ACCESS is NOT set to allow runner env access — set/confirm it blocks it. 3) Restrict workflow create/edit permissions to trusted admins only; audit current role assignments for who can add Python Code nodes. 4) Rotate any credentials stored as environment variables accessible to the Python Task Runner as a precaution. 5) For detection, review n8n audit/task-runner logs for anomalous Python Code node executions or module-namespace access patterns from non-admin accounts.

What does CISA's SSVC say?

Decision Track
Exploitation none
Automatable No
Technical Impact partial

Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.

How is it classified?

Which compliance frameworks are affected?

This CVE is relevant to:

EU AI Act
Article 15 - Accuracy, robustness and cybersecurity
ISO 42001
A.6.2.6 - AI system security
OWASP LLM Top 10
LLM08 - Excessive Agency

Frequently Asked Questions

What is CVE-2026-56777?

A validator that is supposed to sandbox the Python Code node in n8n can be bypassed by any authenticated user who is allowed to create or edit workflows, giving them access to the task executor's module namespace and, where N8N_BLOCK_RUNNER_ENV_ACCESS is misconfigured to allow it, the environment variables available to that process. This only matters on self-hosted instances running the Python Task Runner, and the CVSS 5.0 (confidentiality-only, no integrity/availability impact) reflects a narrow but real insider-risk: n8n is frequently wired up as an AI agent/automation hub, so those env vars can include OpenAI/Anthropic keys, database credentials, or webhook secrets shared across workflows. There's no public exploit, no Nuclei template, and it isn't in CISA KEV, and EPSS puts real-world exploitation likelihood at 0.00245 — low urgency for opportunistic attackers, but the low privilege bar (PR:L, any workflow editor, not an admin) makes it relevant anywhere workflow-creation rights aren't tightly scoped. Patch to n8n 2.25.7 / 2.26.2, and in the interim confirm N8N_BLOCK_RUNNER_ENV_ACCESS blocks runner env access and restrict who can author or modify workflows containing Python Code nodes.

Is CVE-2026-56777 actively exploited?

No confirmed active exploitation of CVE-2026-56777 has been reported, but organizations should still patch proactively.

How to fix CVE-2026-56777?

1) Upgrade to n8n 2.25.7 or 2.26.2+ immediately on any self-hosted instance running the Python Task Runner. 2) Until patched, verify N8N_BLOCK_RUNNER_ENV_ACCESS is NOT set to allow runner env access — set/confirm it blocks it. 3) Restrict workflow create/edit permissions to trusted admins only; audit current role assignments for who can add Python Code nodes. 4) Rotate any credentials stored as environment variables accessible to the Python Task Runner as a precaution. 5) For detection, review n8n audit/task-runner logs for anomalous Python Code node executions or module-namespace access patterns from non-admin accounts.

What systems are affected by CVE-2026-56777?

This vulnerability affects the following AI/ML architecture patterns: agent frameworks, AI workflow orchestration, API integration pipelines.

What is the CVSS score for CVE-2026-56777?

CVE-2026-56777 has a CVSS v3.1 base score of 5.0 (MEDIUM). The EPSS exploitation probability is 0.24%.

What is the AI security impact?

Affected AI Architectures

agent frameworksAI workflow orchestrationAPI integration pipelines

MITRE ATLAS Techniques

AML.T0050 Command and Scripting Interpreter
AML.T0055 Unsecured Credentials
AML.T0083 Credentials from AI Agent Configuration
AML.T0107 Exploitation for Defense Evasion

Compliance Controls Affected

EU AI Act: Article 15
ISO 42001: A.6.2.6
OWASP LLM Top 10: LLM08

What are the technical details?

Original Advisory

n8n before 2.25.7 and 2.26.x before 2.26.2 contains an abstract syntax tree (AST) security validator bypass in the Python Code node. An authenticated user with permission to create or modify workflows containing a Python Code node can bypass the validator and access the task executor module namespace. The issue only affects self-hosted instances where the Python Task Runner is enabled; where N8N_BLOCK_RUNNER_ENV_ACCESS is configured to allow it, this can disclose environment variables accessible to the task runner process.

Exploitation Scenario

A contractor or low-trust employee with legitimate but limited access to a self-hosted n8n instance (workflow-editor role, not admin) creates a new workflow containing a Python Code node. They craft Python that evades the AST-based validator's blocklist checks, reaching into the task executor's module namespace. Because the instance has N8N_BLOCK_RUNNER_ENV_ACCESS configured to allow access, the code reads environment variables — surfacing an OpenAI/Anthropic API key and a database credential used by other AI-agent workflows. The attacker exfiltrates these via the workflow's own output, then uses the stolen API key to run up billing on the victim's account and the database credential to pivot into an adjacent system.

Weaknesses (CWE)

CWE-184 — Incomplete List of Disallowed Inputs: The product implements a protection mechanism that relies on a list of inputs (or properties of inputs) that are not allowed by policy or otherwise require other action to neutralize before additional processing takes place, but the list is incomplete.

  • [Implementation] Do not rely exclusively on detecting disallowed inputs. There are too many variants to encode a character, especially when different environments are used, so there is a high likelihood of missing some variants. Only use detection of disallowed inputs as a mechanism for detecting suspicious activity. Ensure that you are using other protection mechanisms that only identify "good" input - such as lists of allowed inputs - and ensure that you are properly encoding your outputs.

Source: MITRE CWE corpus.

CVSS Vector

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:N/A:N

Timeline

Published
June 30, 2026
Last Modified
July 1, 2026
First Seen
July 1, 2026

Related Vulnerabilities