Summary
AgentDeskAI browser-tools-mcp up to version 1.2.0 contains an OS command injection vulnerability in the browser connector component.
When certain inputs are passed into command execution logic without proper sanitization, a remote attacker can manipulate these values to execute arbitrary operating system commands under the connector's runtime privileges.
Affected context
This vulnerability arises in deployments using the browser-tools-server/browser-connector.ts component of AgentDeskAI browser-tools-mcp (versions up to 1.2.0).
It is relevant where the connector:
- Accepts parameters or URLs originating from remote requests or upstream services
- Constructs or passes shell or OS-level commands based on these values
- Executes these commands in the host environment without strict validation or escaping
The issue is particularly risky in environments where the connector has access to sensitive files, credentials, or internal network resources.
Exploit preconditions
- Attack surface: Remote, via interfaces exposed by the browser-tools-mcp connector (e.g., HTTP APIs, MCP protocol messages, or other RPC-style invocations that influence command arguments).
- Required access: Ability to send crafted requests or messages to the service that reach the vulnerable command-building logic; no local shell access is required.
- Trigger point: User-controlled or indirectly controlled data is incorporated into command strings or arguments executed by the OS (e.g., via shell, process spawn, or similar APIs).
- Why exploitation is possible: The connector trusts incoming values and concatenates or passes them into OS commands without robust input validation, escaping, or use of safe, non-shell execution APIs. This aligns with OS command injection weaknesses described by CWE-78 and related patterns in CWE-77.
Why this happens
The core bug class is OS command injection: untrusted data is allowed to influence the structure of an operating system command.
Within browser-tools-server/browser-connector.ts, some processing path likely builds command strings or parameters from user-controlled input and executes them using shell-capable APIs (for example, spawning a process through a shell interpreter).
This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, and is closely related to CWE-77: Improper Neutralization of Special Elements used in a Command ('Command Injection').
At an abstract level, the insecure pattern is:
- Accept input from an external or remote source.
- Combine this input with command templates or paths without strict whitelisting or structured validation.
- Execute the resulting command in a context with meaningful privileges, thereby treating data as executable instructions.
Potential impact
- Remote execution of arbitrary OS commands with the privileges of the browser-tools-mcp connector.
- Unauthorized access to local files, configuration, and credentials available to the service account.
- Lateral movement within the hosting environment (e.g., pivoting to internal services reachable from the affected host).
- Data exfiltration or destruction, including modification or deletion of application data.
- Service disruption or denial of service by terminating processes, consuming resources, or altering runtime configuration.
General mitigation guidance
Effective mitigation focuses on eliminating the ability for untrusted input to shape OS-level commands, and reducing the impact if a command is compromised.
Recommended defensive patterns include:
- Avoid shell interpretation where possible: Prefer high-level language APIs that execute specific binaries with fixed, structured arguments (e.g., using exec/spawn with argument arrays instead of command strings).
- Strict input validation: Apply positive validation (allow-lists) for all external parameters that influence command behavior—restrict to known-safe values, patterns, or enumerations rather than attempting to filter dangerous characters.
- Argument separation: When invoking OS tools, pass user input only as data arguments, never as part of a concatenated command string that is interpreted by a shell.
- Escaping and normalization: Where shell invocation is unavoidable, apply robust escaping routines appropriate to the target shell and platform, and normalize inputs to remove control characters or unexpected metacharacters.
- Least privilege execution: Run the browser-tools-mcp connector under a restricted account with minimal filesystem and network permissions, and use containerization or sandboxing to limit blast radius.
- Configuration hardening: Disable or constrain rarely needed features that spawn external tools, and avoid dynamic configuration options that let remote callers influence executable paths or flags.
How teams detect issues like this
Detection efforts can target both the underlying code pattern and anomalous runtime behavior.
Static and code-review strategies:
- Search for use of shell-capable APIs (e.g., generic process execution helpers or spawn wrappers) in
browser-connector.tsand related modules, especially where arguments are built from request fields or other untrusted sources. - Flag string concatenation or template interpolation that mixes user-derived data with command fragments, flags, or file paths.
- Enforce secure coding guidelines that require:
- Argument-array style process execution
- Strict validation on all external inputs before command use
- Integrate static analysis rules for CWE-77/CWE-78 that detect unsanitized inputs flowing into command-execution APIs.
Runtime and operational strategies:
- Monitor process creation patterns from the browser-tools-mcp service; alert on unexpected binaries, unusual command-line arguments, or frequent shell invocations.
- Enable audit logging for command execution where feasible, and correlate with inbound request metadata to identify suspicious activity.
- Use host-based intrusion detection or EDR tools to flag anomalous child processes, file access, or network connections originating from the connector process.

