NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · n8n

GHSA-jwm3-qcfw-c5pp: n8n: Python Code Node AST Validator Bypass

mediumCVSS 4.0 5.3 · 3.1 5.0

A user who can edit n8n workflows can bypass the AST security validator of the Python Code node and reach the task executor's module namespace. With `N8N_BLOCK_RUNNER_ENV_ACCESS=false`, this also exposes the task runner's environment variables. Fixed in n8n 2.25.7 and 2.26.2.

Published Jun 16, 2026 · Analysis Nov 2, 2026

What an attacker can do

The Python Code node runs user code in a Python Task Runner. Before execution, an AST validator inspects the code and rejects dangerous constructs. A crafted script could slip past this validator and get at the task executor's module namespace, which the validator is meant to keep out of reach.

On self-hosted instances where N8N_BLOCK_RUNNER_ENV_ACCESS is false, the bypass goes further: the script can read environment variables available to the task runner process. Those can hold secrets such as database passwords, API keys and encryption keys, depending on how the runner is deployed.

The attacker needs an n8n login that can create or modify workflows containing a Python Code node. No user interaction is needed. The effect is limited to confidentiality, rated low. The advisory text is inconsistent about the setting: one sentence says the issue only affects instances with N8N_BLOCK_RUNNER_ENV_ACCESS=true, another ties the environment disclosure to false. Treat any instance with the Python Task Runner enabled as in scope.

Who is affected

n8n on npm below 2.25.7, plus 2.26.0 and 2.26.1, with the Python Task Runner enabled. Check your version and the setting:

npm ls n8n

Then check the N8N_BLOCK_RUNNER_ENV_ACCESS value in your environment or compose file, and look for Code nodes set to Python.

n8n

Ecosystem
npm
Affected
>= 2.26.0, < 2.26.2
Fixed in
2.26.2
Check
npm ls n8n

n8n

Ecosystem
npm
Affected
< 2.25.7
Fixed in
2.25.7
Check
npm ls n8n

How to fix it

Upgrade to n8n 2.25.7 or 2.26.2, or later.

npm install -g [email protected]

Temporary measures from the advisory, which it says do not fully fix the risk: limit workflow creation and editing to fully trusted users, disable the Code node by adding n8n-nodes-base.code to NODES_EXCLUDE, or disable the Python Task Runner. Excluding the Code node also disables JavaScript Code nodes. Keeping N8N_BLOCK_RUNNER_ENV_ACCESS set to true avoids the environment variable disclosure the advisory describes.

How to tell if you were hit

The advisory lists no indicators. Review recent edits to Python Code nodes by users who do not usually write code. Look in the code for access to module internals, __builtins__, os.environ, globals() or sys.modules. If a suspect script ran on an instance with N8N_BLOCK_RUNNER_ENV_ACCESS=false, assume the task runner's environment variables were read, and rotate the secrets they hold.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Impact

An authenticated user with permission to create or modify workflows containing a Python Code node could bypass the AST security validator and access the task executor module namespace. On self-hosted instances where N8N_BLOCK_RUNNER_ENV_ACCESS=false is set, this extended to disclosure of environment variables accessible to the task runner process.

This issue only affects instances where the Python Task Runner is enabled and N8N_BLOCK_RUNNER_ENV_ACCESS=true.

Patches

The issue has been fixed in n8n versions 2.25.7, and 2.26.2. Users should upgrade to one of these versions or later to remediate the vulnerability.

Workarounds

If upgrading is not immediately possible, administrators should consider the following temporary mitigations:

  • Limit workflow creation and editing permissions to fully trusted users only.
  • Disable the Python Code node by adding n8n-nodes-base.code to the NODES_EXCLUDE environment variable, or disable the Python Task Runner entirely.

These workarounds do not fully remediate the risk and should only be used as short-term mitigation measures.

Credited to Mistz1.

Questions

Does GHSA-jwm3-qcfw-c5pp leak environment variables?

Yes, when N8N_BLOCK_RUNNER_ENV_ACCESS is false on a self-hosted instance. The script can read variables available to the task runner process.

Do I need the Python Task Runner enabled to be affected?

Yes. The advisory says the issue concerns instances where the Python Task Runner is enabled. Disabling it is a listed workaround.

Which n8n version fixes GHSA-jwm3-qcfw-c5pp?

2.25.7 or 2.26.2, or later. Versions below 2.25.7, and 2.26.0 and 2.26.1, are affected.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More n8n vulnerabilities

All n8n entries