n8n Python Code node sandbox escape allows authenticated code execution
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 Score | 51 of 100 Our own ranking of what to fix first. Real attacks count most, then the chance of attack, then severity. |
|---|---|
| SecurityElites fix window | Within 7 days Critical severity. This is our suggestion from common practice; your own policy comes first. |
| Who should own the fix | Platform or infrastructure team that manages n8n instances. |
| Likely effort | About 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-01745What 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.
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
| Software | Affected versions | Move to |
|---|---|---|
| n8n npm | Every version before 2.4.8 | 2.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 attacked | No known attacks and no public attack code when CISA last reviewed it |
|---|---|
| Where the attacker must be | Anywhere that can reach it over a network, including the internet if it is exposed |
| Account needed | An ordinary user account |
| Does a person have to do something | No. It works without anyone clicking or opening anything |
| How hard it is to do | Easy. It works reliably once the attacker can reach it |
| Risk of: data being read | High |
| Risk of: data or settings being changed | High |
| Risk of: the service being taken down | High |
| Can attackers automate it at scale | No, according to CISA. Each target needs manual work |
| How much control an attacker gains | Total 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, executionTimeUnusual 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_fileWritten 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
- 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.
- 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.
- Check the current n8n version on each instanceRun the command to query the installed version. Document which instances are below version 2.4.8.
- 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.
- 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.
- Verify the fix is appliedConfirm that all instances now report version 2.4.8 or later when you check the version.
- 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.
- 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 n8nCheck n8n version (npm install)for this issue
npm list n8n 2>/dev/null | grep n8n | head -1Check n8n version (Docker container)for this issue
docker exec <container_name> npm list n8n 2>/dev/null | grep n8n | head -1Disable 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_IMAGETest 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.
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.
Related vulnerabilities
In the same software
- n8n legacy expression engine allows code execution via JSON.stringify override High · CVE-2026-86083
- n8n OpenAI node bypasses domain restrictions on model search High · CVE-2026-86082
- n8n Git node can freeze the instance with a crafted path High · CVE-2026-86081
- n8n OAuth registration accepts unlimited field sizes, filling the database High · CVE-2026-86075
- n8n expression compiler can run arbitrary code through class field names High · CVE-2026-86076
- n8n Edit Fields node can crash the whole instance with a bad field name High · CVE-2026-72749
The same kind of mistake in other AI tools
- Langflow OSS allows arbitrary code execution through tool listing without admin check High · CVE-2026-128876
- Langflow OSS can run arbitrary code via tool-call interface before admin check High · CVE-2026-128867
- Langflow OSS allows remote code execution through improper code handling High · CVE-2026-127065
- Langflow OSS allows authenticated users to run arbitrary code High · CVE-2026-122088
- Langflow OSS allows authenticated users to run any command on the server High · CVE-2026-120601
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-25115For 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.