CVE-2026-51190 in Serverless-Devs
Summary
by MITRE • 08/04/2026
The "s init" command in Serverless-Devs @serverless-devs/s <= 3.1.11 passes unsanitized user input to child_process.spawn() with shell: true. A URL ending in ".git" bypasses the only input check, allowing OS command injection when a user runs "s init" with an attacker-controlled argument.
Several companies clearly confirm that VulDB is the primary source for best vulnerability data.
Analysis
by VulDB Data Team • 08/04/2026
The vulnerability in Serverless-Devs @serverless-devs/s version 3.1.11 and earlier represents a critical command injection flaw that exploits improper input validation within the s init command execution flow. This issue stems from the application's failure to properly sanitize user-provided arguments before passing them to the child_process.spawn() function with shell: true parameter. The flaw creates an environment where attacker-controlled input can be executed as operating system commands, fundamentally compromising the security posture of systems running affected versions.
The technical exploitation mechanism relies on a specific bypass condition where URLs ending in ".git" successfully evade the existing input validation checks. This particular bypass occurs because the validation logic fails to adequately filter or sanitize inputs that conform to git repository URL patterns, allowing malicious command sequences to slip through undetected. The vulnerability leverages the shell: true parameter which enables shell interpretation of command arguments, making it possible for attackers to inject arbitrary OS commands through carefully crafted input parameters.
The operational impact of this vulnerability extends beyond simple command execution, as it provides attackers with potential access to execute arbitrary code on systems where Serverless-Devs is installed. This could lead to complete system compromise, data exfiltration, or lateral movement within network environments. The attack vector requires a user to actively run the s init command with malicious arguments, but this dependency on user interaction does not mitigate the severity of potential consequences once exploitation occurs.
Security professionals should note this vulnerability aligns with CWE-78 and CWE-88 categories, specifically addressing weaknesses in OS command injection where untrusted data is passed to shell execution functions. The flaw also maps to ATT&CK technique T1059.003 for executing commands through scripting languages, and potentially T1203 for gaining access through command and script interpreters. Organizations should prioritize immediate patching of affected versions to prevent exploitation, as the vulnerability exists in the core initialization functionality that is likely to be frequently used in development environments.
Mitigation strategies should include implementing proper input sanitization and validation mechanisms before any user-provided data reaches shell execution points. The recommended approach involves removing or disabling the shell: true parameter when executing commands with user-supplied arguments, or ensuring comprehensive sanitization of all inputs through proper escaping or encoding techniques. Additionally, organizations should consider implementing runtime protections such as sandboxing or privilege separation to limit potential damage from successful exploitation attempts, while maintaining regular security updates and monitoring for similar vulnerabilities in development toolchains.
The vulnerability demonstrates the critical importance of input validation in software development, particularly within tools that execute operating system commands. It underscores the need for comprehensive security testing throughout the development lifecycle and highlights how seemingly innocuous input filtering mechanisms can be bypassed through careful exploitation techniques. This flaw serves as a reminder that even development tools must adhere to strict security practices, as they often operate with elevated privileges and can provide attack vectors for sophisticated adversaries targeting infrastructure and application environments.