Rightshold™ Sign up

Evidence Delivery · $99 / 30 days · Offers open November 18, 2026 · online purchasing currently unavailable

Answers · MCP security

Our MCP server returns content other people wrote, such as dataset descriptions, ticket bodies, comments or web pages. Is it our job as the server author to clean that text before it reaches the agent, or is prompt injection through tool results only the client's problem, and what does cleaning it actually involve?

Last updated

TL;DR: Yes, as one layer, but it won't stop prompt injection by itself. When a tool returns text someone else wrote, that text reaches the model as tool output, and instructions hidden in it can steer the agent. The CKAN MCP server advisory GHSA-c499-9f77-93m8 (moderate, CVSS 3.1 6.9, published July 9, 2026, fixed in @aborruso/ckan-mcp-server 0.4.109) shows how: ckan_package_show copied portal-controlled titles, notes, resource names, descriptions and URLs verbatim into both its markdown and JSON output, so whoever published a dataset controlled the tool result. They could plant instructions telling the agent to call the server's SQL tool and keep quiet about it, and inject fake "verified" sections and phishing links into what the user saw. The advisory's remedy is one neutralization pass where results are assembled: defang markdown control characters and directive-looking lines, validate URL schemes before rendering links, wrap the free text in a clearly delimited, non-authoritative block, and tell integrators the content is attacker-influenced. The MCP specification puts duties on both sides: servers MUST sanitize tool outputs, and clients SHOULD validate tool results before passing them to the model. OWASP's MCP tool poisoning page calls fully detecting injected instructions in free text an open problem, so the client's permissions and confirmations still decide how much harm leftover text can do.

What should I check, step by step?

1. List every field your tools return that a third party can write: titles, descriptions, notes, comments, file names, URLs, log lines, email bodies. Treat all of them as untrusted, in markdown output and JSON output alike.

  1. Encode them in one place, where tool results are assembled, so a new tool can't skip the step: escape markdown structure (headings, links, images, HTML) and neutralize lines that address the assistant or claim to be system instructions.
  2. Validate URL schemes, for example https only, before rendering a value as a link. Render a URL you can't validate as plain text; the CKAN report showed a url value breaking out of markdown link syntax.
  3. Put third-party text inside a clearly labelled block that says it comes from an outside source, and keep your own status lines outside it, so injected text can't pass as your server's output.
  4. Prefer structured output with a fixed schema (outputSchema and structuredContent) and return only the fields the task needs. Long free-text bodies are where instructions hide.
  5. Don't pair an untrusted-content reader with powerful tools on the same server without a guard. The CKAN advisory rated hijacking the highest-impact harm because the server also exposed SQL and search tools the injected text could invoke.
  6. Say in your README which tools return third-party content, so integrators know which results must never be treated as instructions.
  7. Add a test with a hostile fixture, such as a description containing an instruction, a fake heading and a markdown link, and assert the rendered result keeps it escaped inside the data block.

How did the CKAN MCP server advisory GHSA-c499-9f77-93m8 let dataset text hijack an AI agent?

The CKAN MCP server lets an agent search and read open-data portals. Its advisory says ckan_package_show and its sibling renderers built results by inserting a dataset's title and notes, each resource's name, description and url, and group titles straight into markdown, and the JSON path copied the same fields unchanged. Those fields are free text written by whoever published the dataset, and the server_url argument can point at any portal, including one an attacker runs.

How should an MCP server encode and delimit third-party text in its tool results?

The advisory's remedy is a single neutralization pass at the one point where tool results are assembled, covering both markdown and JSON. Every portal-controlled value goes through one encoder that defangs markdown control characters and directive-looking lines and checks URL schemes before a value becomes a link. The encoded text is emitted inside a clearly delimited, non-authoritative block, and the docs tell integrators that portal content is attacker-influenced.

What does an MCP client still need to do about prompt injection in tool results?

The same specification says clients SHOULD validate tool results before passing them to the model, prompt for confirmation on sensitive operations, and show tool inputs to the user before calling the server. OWASP's prevention list adds: constrain response formats to a fixed schema where possible, isolate privileged tools in a context external servers can't reach, enforce restrictions in the tool execution layer rather than the system prompt, keep an allowlist of approved MCP servers, and require explicit user confirmation for destructive or data-exfiltrating actions.

How do I ask Rightshold about this (free, no key)?

Add the MCP server https://www.rightshold.com/mcp to Claude, Cursor, ChatGPT, Grok or VS Code, then ask: “Before my MCP server returns this dataset description to the agent, scan it for hidden text or instructions aimed at the agent.”

One-click setup

{
  "tool": "scan_text",
  "arguments": {
    "text": "<the third-party field values your tool is about to return>"
  }
}

Rightshold isn't affiliated with the CKAN MCP server, the CKAN project, OWASP or the Model Context Protocol project, and it doesn't sanitize tool output or review your server's code. Advisory details are as published in the ondata/ckan-mcp-server repository on GitHub (July 9, 2026), MCP requirements are from the specification's tools page, and attack and prevention notes are from OWASP's community page on MCP tool poisoning, all read November 13, 2026; advisories and specifications get updated, so confirm details on the linked pages.

What are the sources?

Related

Not legal advice. JSON · Markdown · All answers

Get a free API key in one call

No card and no email needed. 100 free credits; the license and policy checks stay free without a key.

curl -s -X POST https://www.rightshold.com/v1/accounts/signup -H "Content-Type: application/json" -d '{"accept_terms":true}'
export RIGHTSHOLD_API_KEY=rs_...   # the api_key from the reply (shown once)
curl -s https://www.rightshold.com/v1/licenses/check -H "Authorization: Bearer $RIGHTSHOLD_API_KEY" \
  -H "Content-Type: application/json" -d '{"license":"MIT","intended_use":{"commercial_use":true}}'