/

CVE-2026-21893

Severity:

HIGH RISK

(7.2)

Command Injection in n8n Community Package Installation

CVE-2026-21893

Analyzed

Vulnerability type

Category:

Command Injection

CWE:

CWE-20, CWE-78

Impact:

Remote Code Execution by Authenticated Admin Users

Severity:

HIGH RISK

(7.2)

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 vulnerability in n8n's community package installation feature allows authenticated administrators to execute arbitrary system commands on the n8n host.

Under specific configuration and usage conditions, crafted package inputs can be interpreted as shell commands, leading to high-impact compromise of the underlying server.

Affected context

This vulnerability affects n8n instances running versions 0.187.0 up to (but not including) 1.120.3 that enable and use the community package installation functionality.

It is relevant in deployments where:

  • Administrative accounts are available (including shared or service accounts)
  • Admins can supply or approve package names or installation parameters
  • The n8n host has access to sensitive data, credentials, or internal services

The risk increases in environments where the n8n process runs with elevated OS privileges or is deployed on shared infrastructure.

Exploit preconditions

  • Attack surface: n8n web interface or API that exposes community package installation to authenticated administrators.
  • Required access: Valid n8n account with administrative permissions; the vulnerability is not directly exploitable by anonymous users.
  • Trigger point: Initiating or approving installation of community packages with attacker-controlled input (e.g., package name or related parameters) that flows into shell command construction.
  • Why exploitation is possible: User-supplied data is insufficiently validated and then interpolated into a command execution context, allowing shell metacharacters or command fragments to be interpreted by the underlying OS.

Why this happens

The core issue is improper handling of untrusted input in a command execution context, mapping to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

The community package installation workflow appears to build or pass shell commands using values derived from administrator-controlled inputs without strict validation, sanitization, or use of parameterized execution APIs.

Additionally, the absence of robust input validation and normalization (CWE-20: Improper Input Validation) allows dangerous characters and sequences to reach the OS layer, enabling command injection rather than treating the input as inert data.

Potential impact

  • Execution of arbitrary system commands under the n8n process user on the host machine
  • Reading, modification, or deletion of workflow data and configuration files
  • Extraction of credentials, API keys, and other secrets accessible to the n8n environment
  • Lateral movement to other internal systems reachable from the n8n host
  • Disruption of service availability, including denial of service or full takeover of the n8n instance

General mitigation guidance

Effective mitigation focuses on removing direct command construction with user-controlled data and tightening trust boundaries around administrative features:

  • Replace shell-based execution with high-level, parameterized APIs (e.g., library calls or process execution functions that avoid invoking a shell).
  • Apply strict allowlists for package identifiers and other installation parameters, ensuring they match well-defined formats and do not contain shell metacharacters.
  • Normalize and validate all inputs associated with package installation before use; reject anything outside expected patterns instead of attempting to escape everything.
  • Run the n8n service under a dedicated, least-privileged OS account with minimal filesystem and network access to limit blast radius if exploitation occurs.
  • Restrict administrative access to trusted personnel and avoid sharing admin credentials or tokens across teams or automation tools.
  • Where practical, separate n8n from highly sensitive infrastructure, using network segmentation and isolation to reduce the impact of a compromise.

How teams detect issues like this

Detection hinges on identifying risky command construction patterns in code and monitoring for anomalous behavior at runtime:

  • Use static analysis or manual code review to locate any use of shell execution APIs (e.g., child process spawns, shell invocations) that concatenate or interpolate user- or admin-controlled strings.
  • Check for insufficient input validation around parameters used in community package installation, such as unbounded strings or acceptance of special characters without justification.
  • Implement logging for package installation actions, including which user initiated them and the associated parameters; monitor logs for unexpected or malformed values.
  • Employ host-based intrusion detection or EDR solutions to flag unusual child processes spawned by the n8n service, especially those executing network tools, interpreters, or administrative utilities.
  • Integrate secure coding checks and security-focused linters into CI pipelines to enforce policies that prohibit direct shell invocation with untrusted input.

Sources

SourceLink
github.comgithub.com/n8n-io/n8n/commit/ae0669a736cc496beeb296e115267862727ae838
github.comgithub.com/n8n-io/n8n/security/advisories/GHSA-7c4h-vh2m-743m

Frequently asked

questions

Yes, but only through authenticated channels. An attacker must be able to log into n8n with administrative privileges and access the community package installation functionality. There is no indication of direct unauthenticated exploitation.

Exploitation requires an authenticated account with administrative permissions in n8n. Compromise of an admin account, misuse by a malicious insider, or insecure automation using admin tokens could provide the necessary access.

The safest pattern is to avoid building shell commands from user-controlled data altogether. Use parameterized process execution APIs or internal library calls, enforce strict allowlists on all package-related inputs, and centralize validation logic for sensitive administrative operations like plugin or package installation.

Establish secure coding guidelines that prohibit concatenating untrusted input into command strings, enforce thorough input validation for all administrative features, and add automated checks in CI to detect dangerous use of shell execution functions. Combine this with least-privilege deployment, strong admin account controls, and regular security review of extension and plugin mechanisms.

Find out what's already
exploitable in your codebase.