/

CVE-2026-27498

Severity:

HIGH RISK

(8.8)

Code Injection in n8n Workflow Automation

CVE-2026-27498

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution on n8n Host

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

An authenticated code injection vulnerability in n8n allows a user who can create or modify workflows to achieve remote code execution on the n8n host.

By combining the Read/Write Files from Disk node with git operations, an attacker can write malicious configuration and trigger arbitrary shell commands during git execution.

Affected context

This vulnerability affects n8n instances where:

  • Users are allowed to create or edit workflows, and
  • The "Read/Write Files from Disk" node is enabled, and
  • Workflows can trigger git-related operations that run on the n8n host.

In such deployments, workflows effectively gain indirect access to host-level configuration and command execution mechanisms, increasing the risk if users are not fully trusted.

Exploit preconditions

  • Attack surface: Authenticated n8n web interface / API used to design and run workflows.
  • Required access: Ability to create or modify workflows that include both file system access and git operation steps.
  • Trigger point: Execution of a crafted workflow that writes controlled data into configuration files and then runs a git operation on the host.
  • Why exploitation is possible: Workflow nodes expose file write capabilities and git commands without sufficient separation between user-controlled content and the execution context, enabling user input to influence commands or configuration interpreted by git.

Why this happens

The root cause is a code injection condition where user-controllable workflow steps can write to files that are later interpreted in an executable context by git.

This aligns with CWE-94: Improper Control of Generation of Code ('Code Injection'), as workflow authors can generate or modify configuration that ultimately leads to execution of attacker-influenced shell commands on the n8n host.

Conceptually, the platform grants workflows a level of file system and tooling control that is equivalent to scripting on the host, without adequate safeguards around where files may be written or how subsequent operations consume that data.

Potential impact

  • Execution of arbitrary shell commands on the n8n host.
  • Compromise of the n8n instance, including access to workflow definitions, credentials, and environment secrets.
  • Lateral movement to other systems reachable from the compromised host.
  • Data exfiltration or tampering within automated workflows.
  • Use of the host as a pivot point for further attacks in the environment.

General mitigation guidance

Effective mitigation usually combines permission hardening with tighter control of powerful workflow nodes and host interactions:

  • Restrict workflow creation and editing capabilities to highly trusted users and service accounts.
  • Minimize or disable nodes that provide direct file system access or shell-adjacent behavior when not strictly required.
  • Isolate automation infrastructure (like n8n) from sensitive hosts by using containers, sandboxes, or separate worker processes with reduced privileges.
  • Apply least-privilege principles to the n8n runtime user, limiting file system paths and system tools it can affect.
  • Introduce policy or governance over which nodes and integrations are allowed in production workflows, favoring higher-level, parameterized operations over raw command execution.

How teams detect issues like this

Organizations can look for this pattern both in configuration and in workflow content:

  • Review workflows for combinations of nodes that provide file write capabilities and subsequent git or shell-like operations, especially those that touch configuration directories.
  • Use static analysis or linting rules for workflow definitions to flag use of high-risk nodes (file system, git, command execution) in the same workflow or execution path.
  • Implement code review practices for workflows, treating them as infrastructure-as-code artifacts subject to security review before deployment.
  • Monitor host logs and application telemetry for unusual git operations or command patterns initiated by workflows.

Sources

SourceLink
github.comgithub.com/n8n-io/n8n/commit/97365caf253978ba8e46d7bc53fa7ac3b6f67b32
github.comgithub.com/n8n-io/n8n/commit/e22acaab3dcb2004e5fe0bf9ef2db975bde61866
github.comgithub.com/n8n-io/n8n/releases/tag/n8n@1.123.8
github.comgithub.com/n8n-io/n8n/releases/tag/n8n@2.2.0
github.comgithub.com/n8n-io/n8n/security/advisories/GHSA-x2mw-7j39-93xq

Frequently asked

questions

Yes, but only by authenticated users who can create or modify workflows and then trigger them. There is no unauthenticated remote exploit described; the attack originates through the n8n interface or API.

The attacker must have a user account on the n8n instance with permissions to design or edit workflows and to run those workflows. Without workflow authoring capabilities, the described attack chain is not possible.

The safest pattern is to ensure that workflow-exposed features cannot generate or modify files that are later interpreted in an executable context, especially by tools like git. This includes constraining file write locations, sanitizing and validating any data that may influence commands, and decoupling user-controlled workflow steps from host-level tooling.

Treat workflow engines and low-code platforms as code execution environments: enforce strict role-based access control, restrict dangerous nodes and integrations, apply defense-in-depth around host interactions, and establish security reviews and policy enforcement for workflows that interact with the file system or external tools.

Find out what's already
exploitable in your codebase.