Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2025-68697

CVE-2025-68697: N8n Workflow Automation Privilege Escalation

CVE-2025-68697 is a privilege escalation vulnerability in N8n workflow automation platform that allows authenticated users to execute arbitrary code with host-level privileges. This article covers technical details, affected versions, security impact, and recommended mitigation strategies.

Updated:

CVE-2025-68697 Overview

CVE-2025-68697 affects n8n, an open source workflow automation platform. The vulnerability exists 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 grants a workflow editor the ability to read and write files on the n8n host with the same privileges as the n8n process. The issue has been patched in version 2.0.0. This is classified under [CWE-269] Improper Privilege Management.

Critical Impact

Authenticated workflow editors can read and write files on the host filesystem with n8n process privileges, potentially exposing sensitive data or enabling further compromise.

Affected Products

  • n8n self-hosted instances prior to version 2.0.0
  • Instances with Code node in legacy (non-task-runner) JavaScript execution mode
  • Deployments where workflow editors are not fully trusted

Discovery Timeline

  • 2025-12-26 - CVE-2025-68697 published to NVD
  • 2026-06-17 - Last updated in NVD database

Technical Details for CVE-2025-68697

Vulnerability Analysis

The Code node in n8n allows workflow authors to execute JavaScript as part of a workflow. In legacy execution mode, this code runs inside the same process context as the n8n server, without the isolation boundary that the task runner architecture provides. Authenticated users with workflow editing permissions can call internal helper functions that were not intended to be exposed to user-authored code. These helpers expose filesystem primitives, letting an editor read arbitrary files the n8n process can access and write files to any location writable by that process.

Root Cause

The root cause is improper privilege management [CWE-269] in the legacy Code node execution environment. Internal helper functions are reachable from user-supplied JavaScript rather than being scoped away from the sandbox exposed to workflow editors. Legacy execution mode does not enforce a boundary between untrusted workflow code and privileged host operations.

Attack Vector

An authenticated attacker with workflow editing rights creates or modifies a workflow that includes a Code node. Inside the node, the attacker references the exposed internal helper functions to invoke filesystem operations. The operations execute with the privileges of the n8n process, subject only to any N8N_RESTRICT_FILE_ACCESS_TO configuration and OS or container permissions. On instances without those restrictions, the attacker can exfiltrate configuration files, credentials cached on disk, or overwrite files reachable by the n8n user. No verified public exploit code is available. See the GitHub Security Advisory GHSA-j4p8-h8mh-rh8q for vendor technical details.

Detection Methods for CVE-2025-68697

Indicators of Compromise

  • Unexpected Code nodes in workflows that reference internal helper functions or perform filesystem operations
  • n8n process reads or writes to paths outside the configured workflow data directory
  • Access attempts to .n8n directory, environment files, or credential stores from the n8n process
  • New or modified workflows created by editor accounts shortly before anomalous file access

Detection Strategies

  • Audit exported workflow JSON for Code node scripts that call non-standard helper identifiers or reference file paths
  • Review n8n audit logs for workflow create and update events by non-admin editor accounts
  • Compare running n8n version against 2.0.0 and flag instances still running the legacy Code node execution mode

Monitoring Recommendations

  • Enable filesystem auditing (auditd, Sysmon) on the n8n host to capture reads and writes by the n8n process user
  • Forward n8n application logs and host audit logs to a central analytics platform for correlation
  • Alert on n8n process access to sensitive paths such as /etc, SSH key locations, and the .n8n configuration directory

How to Mitigate CVE-2025-68697

Immediate Actions Required

  • Upgrade self-hosted n8n to version 2.0.0 or later
  • Review all Code nodes in existing workflows for unauthorized filesystem access patterns
  • Restrict workflow editor permissions to trusted users only and rotate any credentials that may have been exposed on the host
  • Enable the task runner execution mode for Code nodes instead of legacy mode where supported

Patch Information

The vendor has patched this issue in n8n version 2.0.0. Refer to the GitHub Security Advisory GHSA-j4p8-h8mh-rh8q for the official fix details and upgrade guidance.

Workarounds

  • Set N8N_RESTRICT_FILE_ACCESS_TO to a dedicated directory such as ~/.n8n-files and ensure it contains no sensitive data
  • Keep N8N_BLOCK_FILE_ACCESS_TO_N8N_FILES=true (default) to block access to .n8n and user-defined config files
  • Disable high-risk nodes including the Code node using NODES_EXCLUDE if workflow editors are not fully trusted
  • Run n8n as an unprivileged user inside a container with a read-only root filesystem where possible
bash
# Configuration example: restrict file access and disable Code node
export N8N_RESTRICT_FILE_ACCESS_TO=/home/n8n/.n8n-files
export N8N_BLOCK_FILE_ACCESS_TO_N8N_FILES=true
export NODES_EXCLUDE='["n8n-nodes-base.code"]'

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.