n8n Python Code node sandbox escape allows authenticated code execution

CriticalSE Fix-First Score 51/100CVE-2026-25115SE-AIV-01745Remote code executionAI softwareMade public 5 Feb 2026

Download as PDF

What this means

An authenticated user can run code outside the Python sandbox in n8n and potentially access the main process or server. Depending on how n8n is set up, they could read files, steal credentials, or take over the server. The risk is lower if Task Runners use external mode, which isolates code in a separate container.

SecurityElites Manager Brief: the decision in one minute

Authenticated users in n8n can break out of the Python sandbox and run any code on your server if Task Runners and Python are enabled. You must upgrade to version 2.4.8 or disable Python execution and the Code node immediately. External mode for Task Runners reduces the risk.

SecurityElites Fix-First Score51 of 100
Our own ranking of what to fix first. Real attacks count most, then the chance of attack, then severity.
SecurityElites fix windowWithin 7 days
Critical severity. This is our suggestion from common practice; your own policy comes first.
Who should own the fixPlatform or infrastructure team that manages n8n instances.
Likely effortAbout 15 minutes: upgrade n8n to version 2.4.8 and restart it. If you cannot upgrade, disabling the Code node or switching to external mode takes similar time but requires testing workflows. Estimate could increase if you have many n8n instances or complex dep

Questions to ask your team or supplier

  • Do we have Task Runners enabled with Python support, and which of our n8n instances are affected? Have we checked all production and non-production instances?
  • What workflows use the Python Code node, and who has permission to edit them? Could an insider or disgruntled user exploit this vulnerability?
  • If we cannot upgrade immediately, can we safely disable the Code node or switch to external mode without breaking critical workflows?

Message you can forward to the owning team

Security notice: n8n Python Code node sandbox escape allows authenticated code execution (CVE-2026-25115)

Severity: Critical
SecurityElites Fix-First Score: 51 of 100
SecurityElites fix window: Within 7 days
Action: upgrade to n8n 2.4.8 or later.
What we need from you: confirm whether we run this software, who owns it, and the date it will be fixed.
Full guide: https://securityelites.com/ai-vulnerabilities/cve-2026-25115-n8n-python-code-node-sandbox-escape-allows-authenticated-code/
Source: SecurityElites AI Vulnerabilities Database, record SE-AIV-01745

What is at stake in your AI setup

  • Credentials for external AI services or APIs: an attacker could steal API keys and tokens stored in n8n and use them to run expensive queries or modify AI integrations.
  • Prompts and chat history: sensitive prompt templates, conversation logs, or examples stored in n8n workflows could be read and exfiltrated.
  • Tools and systems connected to agents: if n8n runs AI agents with access to databases, APIs, or other services, the attacker could use the sandbox escape to access or manipulate those connections.
  • Training or retrieval data: if n8n is used to manage data for model training or retrieval systems, an attacker could read or delete that data.

Map where your company uses AI

Who is exposed

  • n8n instances with Task Runners enabled, Python enabled, and Code node enabled (all three conditions required).
  • Instances where N8N_RUNNERS_MODE is set to internal (the default).
  • Any authenticated user of an affected n8n instance.

Upgrades you need

SoftwareAffected versionsMove to
n8n
npm
Every version before 2.4.82.4.8 or later

Am I affected?

Enter the version you run. Nothing you type is stored.

SecurityElites Developer Brief: the technical picture

Is it being attackedNo known attacks and no public attack code when CISA last reviewed it
Where the attacker must beAnywhere that can reach it over a network, including the internet if it is exposed
Account neededAn ordinary user account
Does a person have to do somethingNo. It works without anyone clicking or opening anything
How hard it is to doEasy. It works reliably once the attacker can reach it
Risk of: data being readHigh
Risk of: data or settings being changedHigh
Risk of: the service being taken downHigh
Can attackers automate it at scaleNo, according to CISA. Each target needs manual work
How much control an attacker gainsTotal control of the affected software, according to CISA

Read from the official severity rating: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H

Kind of coding mistake

  • CWE-693

If you cannot upgrade today

  • Disable the Code node immediately by setting environment variable NODES_EXCLUDE to n8n-nodes-base.code and restart n8n. Users will not be able to run Python code until it is re-enabled.
  • If you must keep the Code node enabled, switch Task Runners to external mode (set N8N_RUNNERS_MODE=external) so code runs in an isolated sidecar container. See n8n documentation for setup instructions.
  • Restrict who can create or edit workflows and Code nodes through role-based access control in n8n until you can upgrade.

Signs it may already have been used against you

  • Check n8n audit logs and execution history for Python Code node usage by authenticated users, especially any runs that failed or had unusual output.
  • Look for unexpected file access, environment variable reads, or process creation events on the n8n server around the time of Code node execution.
  • Search for any Python Code nodes in workflows that use uncommon modules, system calls, or imports related to process control or file I/O.
  • Check error logs for sandbox-related messages or permission denials that may indicate a sandbox escape attempt.

Log searches to start from

Python Code node execution by authenticated users (adapt source and field names to your environment)Splunk

source="n8n" nodeType="code" language="python" | stats count by user, executionTime

Unusual process or file access after Code node execution (adapt index and field names)Elastic

process.name:n8n AND (process.created_after:"Code node execution" OR file.access.type:read) | where unusual_process OR sensitive_file

Written with AI as a starting point. Review them and change the index and field names to match your own logs before you rely on the result.

SecurityElites Fix Guide: step by step

  1. Find all n8n instances in your environmentList every server or container running n8n. Check your infrastructure, container registry, and deployment tools to find all instances.
  2. Check which instances have Task Runners and Python enabledFor each n8n instance, check the environment variables. Look for N8N_RUNNERS_ENABLED=true and N8N_PYTHON_ENABLED=true. If either is false or not set, that instance is not at risk from this vulnerability.
  3. Check the current n8n version on each instanceRun the command to query the installed version. Document which instances are below version 2.4.8.
  4. Review access logs for suspicious activityCheck whether any authenticated user has executed code through the Python Code node recently. Look for unusual code execution patterns or file access that should not have happened.
  5. Upgrade n8n to version 2.4.8 or laterApply the upgrade to all affected instances. Follow your normal deployment process. Test that workflows still execute correctly after the upgrade.
  6. Verify the fix is appliedConfirm that all instances now report version 2.4.8 or later when you check the version.
  7. If you cannot upgrade immediately, disable the Code nodeSet the environment variable NODES_EXCLUDE to include n8n-nodes-base.code on all instances. Restart each instance. Notify workflow owners that the Code node is disabled.
  8. If using internal mode, consider switching to external modeIf you use N8N_RUNNERS_MODE=internal, changing to external mode will isolate code execution to a separate container and reduce risk. This requires configuration changes and testing.

How to confirm it is fixed: Confirm that all n8n instances now report version 2.4.8 or later when you check the installed version, or that the Code node is disabled with NODES_EXCLUDE set to n8n-nodes-base.code.

SecurityElites Quick Fixes: copy and paste

Upgrade n8n with npmupgrade

npm install n8n@2.4.8
npm ls n8n

Check n8n version (npm install)for this issue

npm list n8n 2>/dev/null | grep n8n | head -1

Check n8n version (Docker container)for this issue

docker exec <container_name> npm list n8n 2>/dev/null | grep n8n | head -1

Disable Code node via environment variablefor this issue

export NODES_EXCLUDE='n8n-nodes-base.code'

Run the service in a locked-down containergeneral hardening

docker run --read-only --cap-drop ALL \
  --security-opt no-new-privileges --user 1000:1000 \
  -p 127.0.0.1:8080:8080 YOUR_IMAGE

Test in a non-production environment first. General hardening examples use placeholder names and ports; change them to match your setup.

Let your AI coding assistant do the upgrade

Paste this into the coding assistant you already use, inside the project. It checks first and asks before it changes anything.

Instruction for your coding assistant

You are helping me fix a security vulnerability (CVE-2026-25115) in this project.\n\n1. Search the whole repository, including lock files, container files and CI configuration, for these packages and list every place they are pinned or installed:\n   - n8n (npm): must be 2.4.8 or later
2. Tell me which version we use now and whether it is affected. Stop and ask me before changing anything.
3. After I agree, raise each one to the safe version, update the lock files, and keep every other dependency as it is.
4. Run the tests and tell me what failed.
5. Give me a short summary of the files you changed that I can put in the pull request.

SecurityElites Incident Drill: could your team handle this?

Four questions to ask in your next team meeting. If any has no clear answer, that is the gap to close.

What three conditions must all be true for this vulnerability to be exploitable in an n8n instance?A good answer: Task Runners must be enabled (N8N_RUNNERS_ENABLED=true), Python must be enabled (N8N_PYTHON_ENABLED=true), and the Code node must be enabled (default: true).
Who can exploit this vulnerability?A good answer: Only authenticated users of the n8n instance can exploit this vulnerability by running code through the Python Code node.
What is the difference in risk between internal and external mode for Task Runners?A good answer: In internal mode, code runs in the main n8n process and can access the whole server. In external mode, code runs in a separate sidecar container, limiting access to that container only.
What should we do right now if we cannot upgrade to version 2.4.8 today?A good answer: Disable the Code node by setting NODES_EXCLUDE to n8n-nodes-base.code, or switch Task Runners to external mode to isolate code execution.

Run a full timed drill with your team

Ticket for your backlog

Paste into Jira, GitHub Issues or any tracker that reads Markdown.

Ready-made ticket

## n8n Python Code node sandbox escape allows authenticated code execution (CVE-2026-25115)

**Severity:** Critical  |  **SE Fix-First Score:** 51/100  |  **Fix window:** Within 7 days
**Record:** SE-AIV-01745 https://securityelites.com/ai-vulnerabilities/cve-2026-25115-n8n-python-code-node-sandbox-escape-allows-authenticated-code/

### Why this matters
An authenticated user can run code outside the Python sandbox in n8n and potentially access the main process or server. Depending on how n8n is set up, they could read files, steal credentials, or take over the server. The risk is lower if Task Runners use external mode, which isolates code in a separate container.

### What to do
1. Find all n8n instances in your environment
2. Check which instances have Task Runners and Python enabled
3. Check the current n8n version on each instance
4. Review access logs for suspicious activity
5. Upgrade n8n to version 2.4.8 or later
6. Verify the fix is applied
7. If you cannot upgrade immediately, disable the Code node
8. If using internal mode, consider switching to external mode

Full steps: https://securityelites.com/ai-vulnerabilities/cve-2026-25115-n8n-python-code-node-sandbox-escape-allows-authenticated-code/

### Done when
- [ ] n8n is at 2.4.8 or later everywhere it is installed
- [ ] Lock files, container images and CI configuration are updated
- [ ] Confirm that all n8n instances now report version 2.4.8 or later when you check the installed version, or that the Code node is disabled with NODES_EXCLUDE set to n8n-nodes-base.code.
- [ ] Logs were checked for signs of earlier use

SecurityElites Fix Tracker

Record who owns this fix, the date it is due and when it is done, and see everything still open in one list. Free with a SecurityElites account.

Sign in to track this fix

Change history

  • 4 Feb 2026: Made public
  • 2 Dec 2026: Published

Official record

## ImpactA vulnerability in the Python Code node allows authenticated users to break out of the Python sandbox environment and execute code outside the intended security boundary.Only authenticated users are able to execute code through Task Runners.This issue affected any deployment in which the following conditions were met:- Task Runners were enabled using `N8N_RUNNERS_ENABLED=true` (default: false) - Python was enabled `N8N_PYTHON_ENABLED=true` - Code Node was enabled (default: true)In case the `N8N_RUNNERS_MODE` is set to `external` (default: `internal`) the sandbox escape is limited to the sidecar container with lower risk for lateral movement. In that case a lower high severity is more appropriate.## PatchesThis vulnerability is fixed in version 2.4.8 and later.## WorkaroundsIf an immediate upgrade cannot be applied, the following hardening steps are recommended:- Disable the Code Node by adding `n8n-nodes-base.code` to the `NODES_EXCLUDE` environment variable - Prefer external mode for isolation: run Task Runners in external mode so that untrusted task code executes in a separate sidecar container rather than within the main n8n process. This configuration significantly reduces the risk of in-process memory disclosure caused by unsafe buffer [allocations.In](http://allocations.in/) external mode, a launcher manages Task Runner processes in a dedicated sidecar environment, separate from the primary n8n instance. See the [[n8n documentation](https://docs.n8n.io/hosting/configuration/task-runners/)](https://docs.n8n.io/hosting/configuration/task-runners/) for configuration details and required environment variables.## Resources- [n8n Documentation — Task Runners](https://docs.n8n.io/hosting/configuration/task-runners/) — external mode, setup guide, and environment configuration details - [n8n Documentation — Blocking nodes](https://docs.n8n.io/hosting/securing/blocking-nodes/) — how to globally disable specific nodes

Weakness type: CWE-693

Use this record in your own tools

Get this record as JSON

curl https://securityelites.com/wp-json/se-aivd/v1/vulns/CVE-2026-25115

For scanners and pipelines: OSV format · CycloneDX format · API guide · Email alerts · Fix tracker

The plain-language sections were written with AI from the official record, and the upgrade versions come directly from the official data. Last updated 2 Dec 2026. Read the vendor advisory before changing a production system.