Vulnerabilities in pkg:npm/adb-mcp

PACKAGE
Advisory Identifier: GHSA-54j7-grvr-9xwg
Advisory Summary

CVE-2025-59834 is a CRITICAL (CVSS 9.8) command injection vulnerability (CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')) affecting Adb mcp libraries in the npm ecosystem. The issue involves command injection in adb-mcp mcp server. Remediation is available in the latest vendor maintenance releases.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/adb-mcp

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/adb-mcp. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-54j7-grvr-9xwg CVE-2025-59834 CRITICAL Command Injection in adb-mcp MCP Server

CVE-2025-59834 at a Glance

CVE Identifier CVE-2025-59834
GHSA Identifier GHSA-54j7-grvr-9xwg
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
Affected Product Adb mcp
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 9.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2025-59834

To remediate this vulnerability, upgrade all affected Adb mcp dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

adb-mcp fixed: Latest secure release
npm install adb-mcp@Latest secure release
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls adb-mcp

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2025-59834, inspect your project dependencies using npm:

npm ls adb-mcp

Analyze the terminal output to locate any version of Adb mcp in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than the patched release), your application is affected.

Note: The npm ls adb-mcp command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where the product 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. In Adb mcp, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

# Command Injection in adb-mcp MCP Server The MCP Server at https://github.com/srmorete/adb-mcp is written in a way that is vulnerable to command injection vulnerability attacks as part of some of its MCP Server tool definition and implementation. The MCP Server is also published publicly to npm at www.npmjs.com/package/adb-mcp and allows users to install it. ## Vulnerable tool The MCP Server defines the function `executeAdbCommand()` which executes commands via string as a parameter and wraps the promise-based `exec` function. The MCP Server then exposes the tool `inspect_ui` which relies on Node.js child process API `exec` (through the function wrapper) to execute the Android debugging command (`adb`). Relying on `exec` is an unsafe and vulnerable API if concatenated with untrusted user input. Data flows from the tool definition [here](https://github.com/srmorete/adb-mcp/blob/master/src/index.ts#L334-L343) which takes in `args.device` and calls `execPromise()` in [this definitino](https://github.com/srmorete/adb-mcp/blob/master/src/index.ts#L346-L348C13) that uses `exec` in an insecure way. Vulnerable line of code: [https://github.com/srmorete/adb-mcp/blob/master/src/index.ts#L334-L352](https://github.com/srmorete/adb-mcp/blob/master/src/index.ts#L334-L355) ```js // Add adb UI dump tool server.tool( "inspect_ui", AdbUidumpSchema.shape, async (args: z.infer<typeof AdbUidumpSchema>, _extra: RequestHandlerExtra) => { log(LogLevel.INFO, "Dumping UI hierarchy"); const deviceArg = formatDeviceArg(args.device); const tempFilePath = createTempFilePath("adb-mcp", "window_dump.xml"); const remotePath = args.outputPath || "/sdcard/window_dump.xml"; try { // Dump UI hierarchy on device const dumpCommand = `adb ${deviceArg}shell uiautomator dump ${remotePath}`; await execPromise(dumpCommand); // Pull the UI dump from the device const pullCommand = `adb ${deviceArg}pull ${remotePath} ${tempFilePath}`; await execPromise(pullCommand); // Clean up the remote file await execPromise(`adb ${deviceArg}shell rm ${remotePath}`); ``` The argument to the tool, `AdbDevicesSchema`, is a Zod inferred type defined in the `src/types.ts` file in the project: ```js export const inspectUiInputSchema = { device: z.string().optional().describe("Specific device ID (optional)"), outputPath: z.string().optional().describe("Custom output path on device (default: /sdcard/window_dump.xml)"), asBase64: z.boolean().optional().default(false).describe("Return XML content as base64 (default: false)") }; ``` and exposes `device` as a string which is an open way to trick the LLM into pushing arbitrary strings into it and hence achieve the command injection exploitation. ## Exploitation When LLMs are tricked through prompt injection (and other techniques and attack vectors) to call the tool with input that uses special shell characters such as `; rm -rf /tmp;#` (be careful actually executing this payload) and other payload variations, the full command-line text will be interepted by the shell and result in other commands except of `ps` executing on the host running the MCP Server. Reference example from prior security research on this topic, demonstrating how a similarly vulnerable MCP Server connected to Cursor is abused with prompt injection to bypass the developer's intended command: ![Cursor defined MCP Server vulnerable to command injection](https://res.cloudinary.com/snyk/image/upload/f_auto,w_2560,q_auto/v1747081395/Screenshot_2025-05-07_at_9.22.11_AM_d76kvm.png) ## Impact User initiated and remote command injection on a running MCP Server. ## Recommendation - Don't use `exec`. Use `execFile` instead, which pins the command and provides the arguments as array elements. - If the user input is not a command-line flag, use the `--` notation to terminate command and command-line flag, and indicate that the text after the `--` double dash notation is benign value. ## References and Prior work 1. Command Injection in codehooks-mcp-server MCP Server project https://www.nodejs-security.com/blog/command-injection-vulnerability-codehooks-mcp-server-security-analysis identified as CVE-2025-53100 2. Command Injection in ios-simulator-mcp-server MCP Server project https://www.nodejs-security.com/blog/ios-simulator-mcp-server-command-injection-vulnerability identified as CVE-2025-52573 3. Liran's [Node.js Secure Coding: Defending Against Command Injection Vulnerabilities](https://www.nodejs-security.com/book/command-injection) ## Credit Disclosed by [Liran Tal](https://lirantal.com)

CVE-2025-59834 Affected Adb mcp Versions

1 component(s)
Product / Package Ecosystem Affected Versions Fixed Version
adb-mcp
npm
≤ 0.1.0

References

Frequently Asked Questions

What is CVE-2025-59834?
CVE-2025-59834 is a security vulnerability in Adb mcp involving Command Injection in adb-mcp MCP Server under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Which Adb mcp versions are affected?
Affected versions include releases prior to current release patches across affected packages: adb-mcp.
What version fixes CVE-2025-59834?
Upgrading to current release patches (or the latest patched release for your respective branch) resolves the vulnerability.
Is adb-mcp affected?
Yes, adb-mcp is affected in releases prior to Latest secure release. Upgrade your dependency to Latest secure release or later.
What is the CVSS score of CVE-2025-59834?
CVE-2025-59834 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2025-59834?
CVE-2025-59834 is classified under CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection') (The product 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.).
How can I check npm dependencies for CVE-2025-59834?
Run the dependency tree command: 'npm ls adb-mcp'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-54j7-grvr-9xwg",
  "modified" : "2025-09-26T16:29:51Z",
  "published" : "2025-09-24T18:59:22Z",
  "aliases" : [ "CVE-2025-59834" ],
  "summary" : "Command Injection in adb-mcp MCP Server",
  "details" : "# Command Injection in adb-mcp MCP Server\n\nThe MCP Server at https://github.com/srmorete/adb-mcp is written in a way that is vulnerable to command injection vulnerability attacks as part of some of its MCP Server tool definition and implementation.\n\nThe MCP Server is also published publicly to npm at www.npmjs.com/package/adb-mcp and allows users to install it.\n\n## Vulnerable tool\n\nThe MCP Server defines the function `executeAdbCommand()` which executes commands via string as a parameter and wraps the promise-based `exec` function.\n\nThe MCP Server then exposes the tool `inspect_ui` which relies on Node.js child process API `exec` (through the function wrapper) to execute the Android debugging command (`adb`). Relying on `exec` is an unsafe and vulnerable API if concatenated with untrusted user input.\n\nData flows from the tool definition [here](https://github.com/srmorete/adb-mcp/blob/master/src/index.ts#L334-L343) which takes in `args.device` and calls `execPromise()` in [this definitino](https://github.com/srmorete/adb-mcp/blob/master/src/index.ts#L346-L348C13) that uses `exec` in an insecure way.\n\nVulnerable line of code: [https://github.com/srmorete/adb-mcp/blob/master/src/index.ts#L334-L352](https://github.com/srmorete/adb-mcp/blob/master/src/index.ts#L334-L355)\n\n```js\n// Add adb UI dump tool\nserver.tool(\n  \"inspect_ui\",\n  AdbUidumpSchema.shape,\n  async (args: z.infer<typeof AdbUidumpSchema>, _extra: RequestHandlerExtra) => {\n    log(LogLevel.INFO, \"Dumping UI hierarchy\");\n    \n    const deviceArg = formatDeviceArg(args.device);\n    const tempFilePath = createTempFilePath(\"adb-mcp\", \"window_dump.xml\");\n    const remotePath = args.outputPath || \"/sdcard/window_dump.xml\";\n    \n    try {\n      // Dump UI hierarchy on device\n      const dumpCommand = `adb ${deviceArg}shell uiautomator dump ${remotePath}`;\n      await execPromise(dumpCommand);\n      \n      // Pull the UI dump from the device\n      const pullCommand = `adb ${deviceArg}pull ${remotePath} ${tempFilePath}`;\n      await execPromise(pullCommand);\n      \n      // Clean up the remote file\n      await execPromise(`adb ${deviceArg}shell rm ${remotePath}`);\n```\n\nThe argument to the tool, `AdbDevicesSchema`, is a Zod inferred type defined in the `src/types.ts` file in the project:\n\n```js\nexport const inspectUiInputSchema = {\n  device: z.string().optional().describe(\"Specific device ID (optional)\"),\n  outputPath: z.string().optional().describe(\"Custom output path on device (default: /sdcard/window_dump.xml)\"),\n  asBase64: z.boolean().optional().default(false).describe(\"Return XML content as base64 (default: false)\")\n};\n```\n\nand exposes `device` as a string which is an open way to trick the LLM into pushing arbitrary strings into it and hence achieve the command injection exploitation.\n\n\n## Exploitation\n\nWhen LLMs are tricked through prompt injection (and other techniques and attack vectors) to call the tool with input that uses special shell characters such as `; rm -rf /tmp;#` (be careful actually executing this payload) and other payload variations, the full command-line text will be interepted by the shell and result in other commands except of `ps` executing on the host running the MCP Server.\n\nReference example from prior security research on this topic, demonstrating how a similarly vulnerable MCP Server connected to Cursor is abused with prompt injection to bypass the developer's intended command:\n\n![Cursor defined MCP Server vulnerable to command injection](https://res.cloudinary.com/snyk/image/upload/f_auto,w_2560,q_auto/v1747081395/Screenshot_2025-05-07_at_9.22.11_AM_d76kvm.png)\n\n## Impact\n\nUser initiated and remote command injection on a running MCP Server.\n\n## Recommendation\n\n- Don't use `exec`. Use `execFile` instead, which pins the command and provides the arguments as array elements.\n- If the user input is not a command-line flag, use the `--` notation to terminate command and command-line flag, and indicate that the text after the `--` double dash notation is benign value.\n\n## References and Prior work\n\n1. Command Injection in codehooks-mcp-server MCP Server project https://www.nodejs-security.com/blog/command-injection-vulnerability-codehooks-mcp-server-security-analysis identified as CVE-2025-53100\n2. Command Injection in ios-simulator-mcp-server MCP Server project https://www.nodejs-security.com/blog/ios-simulator-mcp-server-command-injection-vulnerability identified as CVE-2025-52573\n3. Liran's [Node.js Secure Coding: Defending Against Command Injection Vulnerabilities](https://www.nodejs-security.com/book/command-injection)\n\n## Credit\n\nDisclosed by [Liran Tal](https://lirantal.com)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "adb-mcp"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "last_affected" : "0.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/srmorete/adb-mcp/security/advisories/GHSA-54j7-grvr-9xwg"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-59834"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/srmorete/adb-mcp/commit/041729c0b25432df3199ff71b3163a307cf4c28c"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/srmorete/adb-mcp"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/srmorete/adb-mcp/blob/master/src/index.ts#L334-L355"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-77", "CWE-78" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-09-24T18:59:22Z",
    "nvd_published_at" : "2025-09-25T14:15:46Z"
  }
}