Skip to content

MCP client should scan tool responses for prompt injection attackes #247967

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
pelikhan opened this issue May 1, 2025 · 4 comments
Open

MCP client should scan tool responses for prompt injection attackes #247967

pelikhan opened this issue May 1, 2025 · 4 comments
Assignees

Comments

@pelikhan
Copy link
Member

pelikhan commented May 1, 2025

A MCP tool may return a string that contains a prompt injection attack. If the prompt injection is successful, the behavior of the client LLM is undefined and/or compromised.

This can also happen from a trusted server, like microsoft/playwright-mcp, if that server gets compromised by the prompt injection. For example, a web browsing MCP server using playwright could read a page on internet instrumented with prompt injection and pass it on through the tool result.

Recommendation

Run all tool output through an AI prompt detection filter.

Example of such protection is implemented in genaiscript - https://microsoft.github.io/genaiscript/blog/mcp-tool-validation/

@connor4312
Copy link
Member

connor4312 commented May 1, 2025

This is a nice idea, I think practicality will vary. Every tool round will be slower due to filtering logic and we increase cost to users of each tool call round; people are very sensitive to LLM latency and we put a ton of effort into improving it. But I could see it as a good opt-in feature especially for enterprise.

@pelikhan
Copy link
Member Author

pelikhan commented May 1, 2025

This could/should be an optin. For example, a tool downloading data from internet is subject to prompt injection. However, a tool doing some computation on a network-isolated VM is safe.

@digitarald
Copy link
Contributor

I think the first step is having a benchmark to show GPT-as-a-judge actually works and can't be easily jailbroken.

@pelikhan
Copy link
Member Author

pelikhan commented May 5, 2025

Tool output should be sanitized through the Azure AI Content Safety filter before the llm-as-judge stage.

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

No branches or pull requests

4 participants