Skip to content
IsoKron

No URLs with shell syntax in metadata

A URL in tool metadata must not contain shell syntax (command substitution, a backtick, "&&" or a newline followed by a command), because a client that passes the value to a shell or an "open" helper runs it; a ";" or "|" in the address is marked for attention.

Check sec-shell-url · Poisoning and hidden text · default severity: blocking (or attention, depending on the case) · rubric 2.3.0

What fails

A URL-like string (scheme://…) in a description, default, enum or example contains shell syntax: command substitution $( ) or a backtick, "&&", or a newline followed by a command. That is the shape of CVE-2025-6514, where mcp-remote passed a crafted authorization endpoint to a shell. A client that hands the value to a shell or an "open" helper runs it. A ";" or "|" in the address or path (before any ? or #) is attention. "&" between query parameters, "|" and ";" inside a query, and ";key=value" path parameters are not read.

The rule

Treat the entire tool schema as a potential injection surface — not just the description field.

Source: OWASP MCP Security Cheat Sheet

How to fix it

Remove the shell syntax. Percent-encode any such character that belongs in the address ($ as %24, ( as %28, a backtick as %60, ; as %3B, | as %7C), and never ask a client to run or open a URL it did not validate.

  1. Find URL-like strings in descriptions, defaults, enums and examples that hold $( ), a backtick, "&&" or a line break.
  2. Remove the shell syntax, or percent-encode the character where it belongs in the address ($ as %24, a backtick as %60).
  3. Add a CI test for URLs with shell syntax.

A CI test that fails when the pattern comes back, run against the saved tools/list answer:

TypeScript (node:test)

TypeScript test
// tools-list.test.mjs: run `node --test` after saving the answer with
// npx @modelcontextprotocol/inspector --cli <server> --method tools/list > tools.json
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { test } from 'node:test';

const answer = JSON.parse(readFileSync('tools.json', 'utf8'));
const tools = answer.tools ?? answer.result?.tools ?? answer;

// Every string and every key in a tool, with its path.
function* strings(value, path) {
  if (typeof value === 'string') yield [path, value];
  else if (value && typeof value === 'object')
    for (const [k, v] of Object.entries(value)) {
      yield [`${path}.${k} (key)`, k];
      yield* strings(v, `${path}.${k}`);
    }
}

// A URL-like string that holds command substitution, a backtick or "&&" (a newline followed by a command is left to the checker).
const PATTERN = /[a-z][a-z0-9+.-]*:\/\/\S*(\$\(|`|&&)/i;

test('no URLs with shell syntax', () => {
  const hits = [];
  for (const tool of tools) for (const [path, text] of strings(tool, tool.name)) if (PATTERN.test(text)) hits.push(path);
  assert.deepEqual(hits, [], 'a client that passes a URL to a shell can run what follows the address');
});

Python (pytest)

Python test
# test_tools_list.py: run `pytest` after saving the answer with
# npx @modelcontextprotocol/inspector --cli <server> --method tools/list > tools.json
import json
import re

with open("tools.json", encoding="utf-8") as f:
    answer = json.load(f)
tools = answer.get("tools") or answer.get("result", {}).get("tools") if isinstance(answer, dict) else answer


def strings(value, path):
    """Every string and every key in a tool, with its path."""
    if isinstance(value, str):
        yield path, value
    elif isinstance(value, dict):
        for k, v in value.items():
            yield f"{path}.{k} (key)", k
            yield from strings(v, f"{path}.{k}")
    elif isinstance(value, list):
        for i, v in enumerate(value):
            yield from strings(v, f"{path}.{i}")


# A URL-like string that holds command substitution, a backtick or "&&" (a newline followed by a command is left to the checker).
PATTERN = re.compile(r"(?i)[a-z][a-z0-9+.-]*://\S*(\$\(|`|&&)")


def test_no_urls_with_shell_syntax():
    hits = [path for tool in tools for path, text in strings(tool, tool["name"]) if PATTERN.search(text)]
    assert hits == [], "a client that passes a URL to a shell can run what follows the address"

Questions

Is a URL with "&" between query parameters flagged?

No. "&" between query parameters, "|" and ";" inside a query, and ";key=value" path parameters are not read. A ";" or "|" in the address or path, before any ? or #, is attention.

What was CVE-2025-6514?

A command injection in mcp-remote, which passed a crafted authorization endpoint to a shell. The check reads the same shape in tool metadata: a URL that carries shell syntax to whatever opens it.

How this check is graded

It counts toward: Poisoning and hidden text, Anthropic connector directory, OpenAI plugin directory. See the rubric.

Last verified against OWASP MCP Security Cheat Sheet on 2026-11-18. The rule above is quoted in the source’s own words. This page as Markdown.

Check your tool list: paste your tools/list, nothing is sent anywhere

Run this check on every push

mcp-check reads the tool definitions from your repository’s source in GitHub Actions and grades them with the same rubric, without starting the server. See the workflow, or list the server in the MCP check registry.

Opens GitHub with .github/workflows/mcp-check.yml filled in. You review it and commit it, or open a pull request. It reads your tool definitions from the source; nothing is run.