/

CVE-2026-51190

Severity:

CRITICAL RISK

(9.8)

OS Command Injection (CWE-78) in Serverless-Devs CLI

CVE-2026-51190

Received

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary OS Command Execution

Severity:

CRITICAL RISK

(9.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

A command injection vulnerability in the Serverless-Devs s init command allows unsanitized user input to reach a shell-enabled process execution function. When an attacker-controlled argument is accepted, this may allow arbitrary operating system commands to run with the privileges of the invoking process.

Affected context

The issue occurs in the Serverless-Devs CLI initialization workflow when user-supplied input is passed to child_process.spawn() with shell execution enabled. Deployments or developer environments that allow untrusted project sources or command arguments to reach s init may be exposed, particularly where the CLI has access to sensitive files, credentials, or cloud tooling.

Exploit preconditions

  • Attack surface: The Serverless-Devs s init command
  • Required access: Ability to cause a user or automation process to run s init with an attacker-controlled argument
  • Trigger point: Process creation during initialization
  • Why exploitation is possible: Input reaches a shell-enabled child process without adequate sanitization, while the available input check can be bypassed by certain accepted URL forms

Why this happens

The underlying flaw is the combination of insufficient input validation and shell-enabled process execution. Passing externally influenced data to child_process.spawn() with shell: true allows shell metacharacters or command syntax to be interpreted by the operating system rather than treated solely as data. This behavior maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command.

Potential impact

  • An attacker may execute arbitrary commands in the local development or automation environment.
  • Sensitive files, environment variables, or credentials could be accessed.
  • Project files or build artifacts could be modified.
  • Cloud resources or deployment pipelines could be affected when the CLI has corresponding permissions.
  • Compromise could spread to connected systems through available tokens or integrations.

General mitigation guidance

Mitigation generally focuses on removing shell interpretation from application-controlled process execution and reducing trust in command arguments.

Common defensive patterns include:

  • Avoiding shell: true when shell features are not required.
  • Passing arguments through an argument array to a non-shell process API.
  • Applying strict allowlisting and canonical validation to repository or project-source inputs.
  • Separating URL parsing and validation from process invocation.
  • Running CLI automation with dedicated, least-privilege identities and minimal filesystem access.
  • Preventing secrets and broad cloud credentials from being exposed to initialization workflows.
  • Treating external project sources as untrusted even when they match an expected URL format.

How teams detect issues like this

Organizations can look for:

  • Static-analysis findings where user-controlled data flows into child_process APIs with shell: true.
  • Code-review signals involving string concatenation or interpolation in process commands.
  • Validation logic that checks only superficial URL suffixes or formats before command execution.
  • CI policies that prohibit shell-enabled child processes unless explicitly justified.
  • Runtime monitoring for unexpected child-process creation, command interpreter launches, or access to sensitive environment data.

Automated code-review and data-flow analysis tools may help identify these patterns before deployment.

Sources

SourceLink
gist.github.comgist.github.com/j311yl0v3u/5600afea3bea1337805c2e335bd4ae8e

Frequently asked

questions

It is generally triggered through a local CLI or automation workflow rather than a network service. Remote exploitation may become possible indirectly if an attacker can control project-source arguments or influence an automated process that runs s init.

The attacker must be able to influence the argument supplied to s init and have that command executed in an environment where the vulnerable CLI is available.

The safest pattern is to avoid shell interpretation, pass validated values as separate process arguments, and use strict allowlists for accepted project sources.

Enforce secure process-execution policies, review data flows into child-process APIs, validate inputs according to their intended type and structure, and run developer tooling with least privilege.

Find out what's already
exploitable in your codebase.