CVE-2025-68697: n8n Arbitrary File Read/Write Vulnerability in Legacy Code Node
Summary
CVE-2025-68697: Self-hosted n8n has Legacy Code node that enables arbitrary file read/write. Affects n8n versions < 2.0.0. Fixed in 2.0.0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
n8n is an open-source workflow automation tool that allows users to connect various applications and services through customizable workflows. It features a Code node that enables users to execute JavaScript code within workflows. However, in self-hosted instances running in legacy mode, this Code node can be exploited to perform unauthorized file operations on the host system, posing significant security risks.
Vulnerability Detail
The vulnerability arises in self-hosted n8n instances where the Code node operates in legacy JavaScript execution mode. Authenticated users with workflow editing permissions can invoke internal helper functions, allowing them to read and write files on the host filesystem. While access to the n8n home directory is blocked by default in versions 1.2.1 and above, other filesystem areas remain vulnerable unless additional restrictions are applied. This can lead to unauthorized data exposure and potential system compromise.
How To Fix
Latest published version: 2.44.6 as of 22 Oct 2026
npm install n8n@2.44.6
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
2.0.0
This is the first release that contains the fix.
npm install n8n@2.0.0
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If immediate migration to task runners is not feasible, implement the following workarounds: Limit file operations by setting N8N_RESTRICT_FILE_ACCESS_TO to a dedicated directory (e.g., ~/.n8n-files) that contains no sensitive data. Keep N8N_BLOCK_FILE_ACCESS_TO_N8N_FILES=true to block access to the .n8n directory and user-defined config files. If workflow editors are not fully trusted, consider disabling high-risk nodes, including the Code node, using the NODES_EXCLUDE environment variable.
Conclusion
CVE-2025-68697 presents a significant security risk for self-hosted n8n instances, allowing unauthorized file access through the Code node. It is crucial to upgrade to the latest version or implement recommended workarounds to mitigate this vulnerability and protect sensitive data.
See every vulnerability recorded for n8n →
FAQ
CVE-2025-68697 is a vulnerability in n8n that allows authenticated users to perform arbitrary file read/write operations through the Code node in legacy execution mode.
If you are using a self-hosted n8n instance with the Code node running in legacy mode, you may be affected. Check your version and execution mode to assess risk.
Exploitation of this vulnerability can lead to unauthorized access to sensitive files on the host filesystem, potentially compromising the entire system.
Upgrade to n8n version 2.0.0 or later, or enable task runners in version 1.71.0 and above. Implement workarounds to limit file access until you can upgrade.
Yes, Vulert can monitor your n8n instance for vulnerabilities using package-lock.json. You can check your application for this vulnerability using the Vulert playground without signing up.
References
Related vulnerabilities
Recent vulnerabilities recorded for n8n.