CVE-2025-68697: N8n Self-hosted N8n Has Legacy Code Vulnerability
HIGHCVE-2025-68697 is a HIGH (CVSS 7.1) self-hosted n8n has legacy code vulnerability (CWE-269: Improper Privilege Management) affecting N8n libraries in the npm ecosystem. The issue involves self-hosted n8n has legacy code node that enables arbitrary file read/write. Remediation is available by upgrading affected packages to version 2.0.0.
CVE-2025-68697 at a Glance
Security Impact
CVSS: 7.1
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:N).
How to Fix CVE-2025-68697
To remediate this vulnerability, upgrade all affected N8n dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install n8n@2.0.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls n8n
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2025-68697, inspect your project dependencies using npm:
npm ls n8n
Analyze the terminal output to locate any version of N8n in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.0.0), your application is affected.
Note: The npm ls n8n command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-269: Improper Privilege Management, where the product does not properly assign, modify, track, or check privileges for an actor, creating an unintended sphere of control for that actor. In N8n, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2025-68697 Affected N8n Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
n8n
|
npm |
≥ 1.2.1
< 2.0.0
|
2.0.0
|
References
Frequently Asked Questions
What is CVE-2025-68697?
Which N8n versions are affected?
What version fixes CVE-2025-68697?
Is n8n affected?
What is the CVSS score of CVE-2025-68697?
What CWE is associated with CVE-2025-68697?
How can I check npm dependencies for CVE-2025-68697?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-j4p8-h8mh-rh8q",
"modified" : "2025-12-31T00:20:06Z",
"published" : "2025-12-26T18:26:38Z",
"aliases" : [ "CVE-2025-68697" ],
"summary" : "Self-hosted n8n has Legacy Code node that enables arbitrary file read/write",
"details" : "### Impact\n\nIn self-hosted n8n instances where the Code node runs in legacy (non-task-runner) JavaScript execution mode, authenticated users with workflow editing access can invoke internal helper functions from within the Code node.\n\nThis allows a workflow editor to perform actions on the n8n host with the same privileges as the n8n process, including:\n\n- Reading files from the host filesystem (subject to any file-access restrictions configured on the instance and OS/container permissions)\n- Writing files to the host filesystem (subject to the same restrictions)\n\nStarting with n8n version 1.2.1, access to files in the n8n home directory (`.n8n`) is blocked by default. However, this does not restrict access to other parts of the filesystem unless additional file access limitations are configured.\n\n### Patches\n\n- Upgrade to **n8n version 2.0.0 or later**, where task runners are enabled by default for Code node execution.\n- On **n8n version 1.71.0 and above**, enable task runners by setting `N8N_RUNNERS_ENABLED=true`.\n\n### Workarounds\n\nIf you cannot immediately migrate to task runners:\n\n- Limit file operations by setting `N8N_RESTRICT_FILE_ACCESS_TO` to a dedicated directory (e.g., `~/.n8n-files`) and ensure it contains no sensitive data.\n- Keep `N8N_BLOCK_FILE_ACCESS_TO_N8N_FILES=true` (default) to block access to `.n8n` and user-defined config files.\n- If workflow editors are not fully trusted, consider disabling high-risk nodes (including the Code node) using `NODES_EXCLUDE`.\n\n### Resources\n\n- n8n Docs: [Task runners](https://docs.n8n.io/hosting/configuration/task-runners/)\n- n8n Docs: [Task runner environment variables](https://docs.n8n.io/hosting/configuration/environment-variables/task-runners/)\n- n8n Docs: [Security environment variables](https://docs.n8n.io/hosting/configuration/environment-variables/security/#security-environment-variables)\n- n8n Docs: [v2.0 breaking changes](https://docs.n8n.io/2-0-breaking-changes/#enable-task-runners-by-default)",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "n8n"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.2.1"
}, {
"fixed" : "2.0.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/n8n-io/n8n/security/advisories/GHSA-j4p8-h8mh-rh8q"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-68697"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/n8n-io/n8n"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-269", "CWE-749" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2025-12-26T18:26:38Z",
"nvd_published_at" : "2025-12-26T22:15:52Z"
}
}