/

CVE-2026-25053

Severity:

CRITICAL RISK

(9.9)

OS Command Injection in n8n Git Node Workflow Actions

CVE-2026-25053

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution and File Disclosure on n8n Host

Severity:

CRITICAL RISK

(9.9)

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

A command injection flaw in the n8n Git node allows authenticated users who can create or modify workflows to execute arbitrary system commands or read arbitrary files on the n8n host.

The vulnerability is triggered when attacker-controlled input is passed into Git-related operations without proper sanitization, making any n8n instance with untrusted workflow authors at risk.

Affected context

This issue affects n8n deployments that expose the Git node to users who can design or edit workflows.

The vulnerable behavior appears when user-supplied values in workflow configuration (e.g., repository paths, options, or command parameters) are concatenated or interpolated into Git-related shell commands without adequate validation or escaping.

Any environment where workflow authors are not fully trusted, or where a compromised account can modify workflows, is particularly exposed.

Exploit preconditions

  • Attack surface: n8n Git node used within workflows on the n8n instance.
  • Required access: Authenticated account with permission to create or modify workflows that leverage the Git node.
  • Trigger point: Execution of a workflow containing a maliciously configured Git node, either manually triggered, scheduled, or invoked via webhooks or integrations.
  • Why exploitation is possible: User-controlled workflow fields are incorporated into underlying system commands without strict validation, escaping, or use of a safe API, enabling injection of additional commands or redirection to sensitive files.

Why this happens

The underlying bug aligns with CWE-78: Improper Neutralization of Special Elements used in an OS Command (OS command injection).

The Git node appears to construct or invoke operating system commands using parameters that can be influenced by workflow authors.

When application code directly interpolates user-supplied values into command strings or passes them to shells without rigorous sanitization and context-aware escaping, the shell interprets special metacharacters (such as separators, redirections, or subshell operators) as additional commands.

This pattern turns otherwise benign workflow configuration parameters into a vehicle for executing arbitrary commands or reading arbitrary files on the host system.

Potential impact

  • Execution of arbitrary system commands with the privileges of the n8n process.
  • Unauthorized reading of arbitrary files on the n8n host, including configuration files and potentially secrets.
  • Lateral movement within the hosting environment, depending on network connectivity and service trust relationships.
  • Data exfiltration from local storage or connected services reachable from the n8n instance.
  • Service disruption via destructive commands (e.g., deleting files, exhausting resources).
  • Escalation of impact if the n8n process runs with elevated or overly broad privileges.

General mitigation guidance

Mitigation centers on removing direct command construction paths and reducing trust in workflow-supplied parameters:

  • Use high-level, parameterized APIs or libraries for Git operations instead of shelling out to system commands whenever possible.
  • If OS commands are unavoidable, pass parameters as discrete, non-shell-escaped arguments (e.g., using exec functions that bypass the shell) and apply strict allowlists for expected values.
  • Enforce strong validation on Git node inputs: constrain acceptable formats, disallow metacharacters, and reject unexpected options or paths.
  • Treat workflow authors as potentially untrusted in multi-tenant or shared deployments; segment tenants and restrict high-risk nodes to trusted users only.
  • Run the n8n process under a dedicated, minimally privileged account with restricted filesystem and network access to limit damage if injection occurs.
  • Isolate the n8n runtime using containers, sandboxes, or separate hosts, particularly when enabling nodes that interact with the underlying system.

How teams detect issues like this

Possible detection strategies include:

  • Static analysis and code scanning:
  • Flag code patterns where user-controlled data flows into command construction, especially around the Git node implementation.
  • Detect usage of shell-invoking APIs (e.g., generic exec with string commands) paired with workflow configuration inputs.
  • Code review practices:
  • Require security-focused review for any feature that spawns OS processes or interacts with the host filesystem.
  • Look for absence of strict validation, allowlists, or argument-based APIs in Git-related code paths.
  • Runtime monitoring and logging:
  • Log command invocations from the n8n service, including arguments; alert on suspicious patterns (e.g., use of shell metacharacters, redirection, or unexpected binaries).
  • Monitor filesystem access from the n8n process for anomalous reads of sensitive files.
  • Policy and CI enforcement:
  • Integrate security linters and SAST tools into CI pipelines to detect command injection patterns before deployment.
  • Enforce development policies that prohibit direct shelling out from nodes when safer library APIs are available.

Sources

SourceLink
github.comgithub.com/n8n-io/n8n/security/advisories/GHSA-9g95-qf3f-ggrw

Frequently asked

questions

Yes, but indirectly. An attacker must first obtain an authenticated account with permissions to create or modify workflows using the Git node. From there, they can craft a workflow that, when executed, triggers arbitrary command execution or file reads on the host.

The attacker needs valid credentials to the n8n instance and sufficient permissions to design or modify workflows that include the Git node. No direct shell or host access is required; the workflow engine acts as the execution vehicle.

Replace shell-based Git invocations with library-level APIs or parameterized process execution functions that do not invoke a shell, and enforce strict validation and allowlisting of all workflow-controlled inputs that reach OS-level operations.

Establish a development guideline that any functionality spawning OS commands is treated as high risk, requires dedicated security review, and must use safe command-building patterns. Combine this with strong input validation for workflow parameters, principle-of-least-privilege for service accounts, and automated scanning for command injection anti-patterns in the codebase.

Find out what's already
exploitable in your codebase.