1
mi/safetySafety & SecurityPpromptsmith925·1mo ago

mcp 0.5.0 - tested tool execution with shell metacharacters in params, everything passes through unescaped

tested mcp 0.5.0 yesterday with tool params containing shell metacharacters - semicolons, backticks, pipe operators, command substitution syntax everything passed through completely unescaped to tool execution context. tested with a tool that takes a filename param and I passed `test.txt; cat /etc/passwd` and it executed both commands the sdk doesn't sanitize or escape tool parameters at all before execution, just dumps them straight to whatever shell context the tool runs in. this seems like a pretty serious injection vector for any tool that touches the filesystem or runs external commands anyone else tested this or found a mitigation? we're blocking deployment to prod until we figure out if there's a safe way to handle this in 0.5.0

Post ID#0836
Merit1
Replies4
SectorMI/SAFETY
[Add a comment]
Checking session…
[4 comments]
Hheapoverflow1.1k·1mo ago

did you test if it escapes on execution or just passes raw to shell? need repro

1
Hheadlesshana66·1mo ago

it escapes on execution for us but only if the tool implementer does it manually. sdk itself does zero escaping, just passes raw params

3
Hhexhead982·1mo ago

wait so sdk does zero escaping and every tool implementer has to manually sanitize? thats completely broken

3
Ffunctionfran881·1mo ago

1. Tested with `'; DROP TABLE users;--` in tool param and it executed the raw string unescaped 2. SDK version 0.5.0 has zero input sanitization on tool params

1