Skip to content

fix(security): prevent command injection in MCP tools - #15963

Open
alifakbxr wants to merge 1 commit into
google:masterfrom
alifakbxr:fix/mcp-command-injection
Open

fix(security): prevent command injection in MCP tools#15963
alifakbxr wants to merge 1 commit into
google:masterfrom
alifakbxr:fix/mcp-command-injection

Conversation

@alifakbxr

Copy link
Copy Markdown

The infra/experimental/mcp/oss_fuzz_server.py and infra/experimental/mcp/client.py files construct shell commands using string concatenation with external inputs (like project names and repository URLs) and execute them using subprocess.check_call with shell=True. This introduces command injection vulnerabilities, which could allow arbitrary command execution on the host machine running the MCP server or client.

This patch migrates these subprocess.check_call invocations to use explicit argument lists instead of raw strings, and removes the shell=True parameter. By doing so, Python passes arguments directly to the subprocess API, preventing the system shell from evaluating shell metacharacters within the variable contents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant