Skip to content

    Type a page, a command such as keryn scan, or a rule id.

    mcp-tool-server-v3

    View as Markdown

    15 rules · Keryn Software Licence · rules 0.8.0 · all packs

    How to read a rule
    Severity
    How bad the finding is if it is real: error fails a default gate, warning and info do not.
    Confidence
    P0 exploitable as written; P1 dangerous in context; P2 a heuristic or a posture check: confirm by reading the code.
    False-positive risk
    low: an exact API or flag, so hits are almost always real; medium: the pattern is legitimate in many programs, so check each hit; high: it finds a lead to confirm, so expect benign hits.
    Edge
    The relationship the finding sits on. reaches: content or traffic gets to a thing; calls: one thing invokes another; reads: one thing reads from another; writes: one thing writes to another; sends: data leaves for another party; grants: authority is given or left unchecked; depends_on: something relies on a component it does not verify; trusts: one party believes another without evidence. The boundary it crosses, when there is one: user->prompt (untrusted input reaching a prompt); model->code (model output reaching code, a shell, a query or a page); secret->outside (a secret leaving the trusted side); supply-chain (code, models or prompts pulled in from outside).
    Taxonomy chips
    References for readers who work in OWASP LLM 2025, OWASP Agentic, CWE or NIST AI RMF. They say where a rule belongs, not that a framework is satisfied.

    seceng.mcp.v3.tool-shell-command-from-args

    Section titled “seceng.mcp.v3.tool-shell-command-from-args”

    warning typescript, javascript mcp

    MCP tool handler executes shell command from tool arguments without visible allowlist or approval.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).

    CWE-78 LLM06 ASI05 ASI01 ASI02

    Try it: a snippet that triggers this rule

    Written for this page, not taken from any project. Save it as src/server.mjs and scan it with keryn scan src --verbose; the finding below appears.

    src/server.mjs
    import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
    import { exec as execCb } from "node:child_process";
    import { promisify } from "node:util";
    import { z } from "zod";
    const exec = promisify(execCb);
    const server = new McpServer({ name: "build-helper", version: "0.3.0" });
    server.tool(
    "run_task",
    { command: z.string().describe("Task to run in the workspace") },
    async (args) => {
    const { stdout, stderr } = await exec(args.command, { cwd: "/workspace" });
    return { content: [{ type: "text", text: stdout || stderr }] };
    }
    );

    Checked with Keryn’s browser engine when this page was built: it reports seceng.mcp.v3.tool-shell-command-from-args at line 13 (warning, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.

    warning typescript, javascript mcp

    MCP tool handler reads file path from tool arguments without visible sandbox or path validation.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: reads one thing reads from another.

    CWE-22 CWE-200 LLM02 LLM06 ASI02 ASI10

    Try it: a snippet that triggers this rule

    Written for this page, not taken from any project. Save it as src/server.mjs and scan it with keryn scan src --verbose; the finding below appears.

    src/server.mjs
    import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
    import { readFile } from "node:fs/promises";
    import { z } from "zod";
    const server = new McpServer({ name: "notes", version: "1.0.0" });
    server.tool(
    "read_note",
    { path: z.string() },
    async (args) => {
    const text = await readFile(args.path, "utf8");
    return { content: [{ type: "text", text }] };
    }
    );

    Checked with Keryn’s browser engine when this page was built: it reports seceng.mcp.v3.tool-file-read-from-args at line 11 (warning, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.

    warning typescript, javascript mcp

    MCP tool handler writes file path from tool arguments without visible sandbox, approval, or path validation.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: writes one thing writes to another.

    CWE-22 CWE-73 LLM06 ASI02 ASI10

    Try it: a snippet that triggers this rule

    Written for this page, not taken from any project. Save it as src/server.mjs and scan it with keryn scan src --verbose; the finding below appears.

    src/server.mjs
    import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
    import { writeFile } from "node:fs/promises";
    import { z } from "zod";
    const server = new McpServer({ name: "notes", version: "1.0.0" });
    server.tool(
    "save_note",
    { path: z.string(), body: z.string() },
    async (args) => {
    await writeFile(args.path, args.body);
    return { content: [{ type: "text", text: "saved" }] };
    }
    );

    Checked with Keryn’s browser engine when this page was built: it reports seceng.mcp.v3.tool-file-write-from-args at line 11 (warning, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.

    warning typescript, javascript mcp

    MCP tool handler fetches URL from tool arguments without visible allowlist validation. This can enable SSRF or data exfiltration.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).

    CWE-918 LLM06 ASI02

    Try it: a snippet that triggers this rule

    Written for this page, not taken from any project. Save it as src/server.mjs and scan it with keryn scan src --verbose; the finding below appears.

    src/server.mjs
    import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
    import { z } from "zod";
    const server = new McpServer({ name: "web-reader", version: "0.2.1" });
    server.tool(
    "get_page",
    { url: z.string().url() },
    async (args) => {
    const res = await fetch(args.url, { headers: { accept: "text/html" } });
    const html = await res.text();
    return { content: [{ type: "text", text: html.slice(0, 20000) }] };
    }
    );

    Checked with Keryn’s browser engine when this page was built: it reports seceng.mcp.v3.tool-url-fetch-from-args at line 10 (warning, proof 1). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.

    warning typescript, javascript, python mcp

    MCP tool returns environment variables or secret-looking values to caller.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk low: an exact API or flag, so hits are almost always real.

    Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).

    CWE-200 CWE-798 LLM02 LLM06 ASI03 ASI02

    warning python mcp

    MCP tool returns environment variables or secret-looking values to caller.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk low: an exact API or flag, so hits are almost always real.

    Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).

    CWE-200 CWE-798 LLM02 LLM06 ASI03 ASI02

    warning python mcp

    MCP server binds to public interface without visible auth or token verification.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: grants authority is given or left unchecked.

    CWE-306 LLM06 LLM07 ASI03 ASI02 ASI10

    Try it: a snippet that triggers this rule

    Written for this page, not taken from any project. Save it as server.py and scan it with keryn scan server.py --verbose; the finding below appears.

    server.py
    from mcp.server.fastmcp import FastMCP
    mcp = FastMCP("inventory")
    @mcp.tool()
    def stock_level(sku: str) -> int:
    """Return the units on hand for a SKU."""
    return {"A-100": 14, "B-200": 3}.get(sku, 0)
    if __name__ == "__main__":
    mcp.run(transport="sse", host="0.0.0.0", port=8000)

    Checked with Keryn’s browser engine when this page was built: it reports seceng.mcp.v3.public-server-bind-no-auth at line 13 (warning, proof 0). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.

    seceng.mcp.v3.public-server-bind-no-auth-js

    Section titled “seceng.mcp.v3.public-server-bind-no-auth-js”

    warning javascript, typescript mcp

    MCP server binds to public interface without visible auth or token verification.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: grants authority is given or left unchecked.

    CWE-306 LLM06 LLM07 ASI03 ASI02 ASI10

    Try it: a snippet that triggers this rule

    Written for this page, not taken from any project. Save it as src/index.mjs and scan it with keryn scan src --verbose; the finding below appears.

    src/index.mjs
    import express from "express";
    const app = express();
    app.use(express.json());
    app.post("/mcp", async (req, res) => {
    res.json({ jsonrpc: "2.0", id: req.body.id, result: {} });
    });
    app.listen(3000, "0.0.0.0", () => {
    console.log("mcp server listening on 3000");
    });

    Checked with Keryn’s browser engine when this page was built: it reports seceng.mcp.v3.public-server-bind-no-auth-js at line 10 (warning, proof 0). The rule’s own logic is not published, so it cannot run in this tab; the pack list in the playground shows what does.

    seceng.mcp.v3.tool-schema-additional-properties

    Section titled “seceng.mcp.v3.tool-schema-additional-properties”

    info python, json mcp

    MCP tool schema allows arbitrary additional properties or lacks strict argument validation.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: calls one thing invokes another.

    CWE-20 LLM06 ASI01 ASI02

    seceng.mcp.v3.tool-schema-additional-properties-js

    Section titled “seceng.mcp.v3.tool-schema-additional-properties-js”

    info javascript, typescript mcp

    MCP tool schema allows arbitrary additional properties or lacks strict argument validation.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: reads one thing reads from another.

    CWE-20 LLM06 ASI01 ASI02

    seceng.mcp.v3-browser-tool-no-domain-allowlist

    Section titled “seceng.mcp.v3-browser-tool-no-domain-allowlist”

    warning typescript, javascript, python mcp

    MCP/browser tool navigates to URL from tool arguments without visible domain allowlist.

    Confidence P2: a heuristic or a posture check: confirm by reading the code. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: grants authority is given or left unchecked.

    CWE-918 LLM06 ASI02

    warning python data-flow rule mcp, fastmcp, python

    A Python MCP server tool (FastMCP @<server>.tool) opens a path taken from its arguments without confining it to a base directory or the client roots. The model chooses tool arguments, so a prompt-injected call can read any file the server can (CWE-22).

    Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: reads one thing reads from another.

    CWE-22 CWE-200 LLM02 LLM06 ASI02 ASI10

    Fix: Resolve the path against a fixed base directory (or a root from ctx.session.list_roots()) and refuse it unless resolved.is_relative_to(base); never pass the raw argument to open() or Path().

    References: https://github.com/modelcontextprotocol/python-sdk · https://gofastmcp.com/servers/tools

    seceng.mcp.v3.tool-file-write-from-args-py

    Section titled “seceng.mcp.v3.tool-file-write-from-args-py”

    warning python data-flow rule mcp, fastmcp, python

    A Python MCP server tool (FastMCP @<server>.tool) writes or deletes a path taken from its arguments without confining it to a base directory or the client roots. A prompt-injected call can overwrite or remove any file the server can (CWE-22, CWE-73).

    Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: writes one thing writes to another.

    CWE-22 CWE-73 LLM06 ASI02 ASI10

    Fix: Resolve the path against a fixed base directory (or a root from ctx.session.list_roots()), refuse it unless resolved.is_relative_to(base), and ask for approval before destructive writes.

    References: https://github.com/modelcontextprotocol/python-sdk · https://gofastmcp.com/servers/tools

    seceng.mcp.v3.tool-shell-command-from-args-py

    Section titled “seceng.mcp.v3.tool-shell-command-from-args-py”

    error python data-flow rule mcp, fastmcp, python

    A Python MCP server tool (FastMCP @<server>.tool) runs a shell command or code built from its arguments. The model chooses tool arguments, so a prompt-injected call runs commands on the server host (CWE-78).

    Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: calls one thing invokes another; it crosses the model->code boundary (model output reaching code, a shell, a query or a page).

    CWE-78 CWE-94 LLM06 LLM05 ASI05 ASI02

    Fix: Map the argument to a fixed command from an allow-list (Literal or Enum parameter), pass an argv list with shell=False, and require approval for anything with side effects.

    References: https://github.com/modelcontextprotocol/python-sdk · https://gofastmcp.com/servers/tools

    warning python data-flow rule mcp, fastmcp, python

    A Python MCP server tool (FastMCP @<server>.tool) fetches a URL taken from its arguments without a host allow-list. A prompt-injected call can reach internal services or cloud metadata and exfiltrate data (CWE-918).

    Confidence P1: dangerous in context. False-positive risk medium: the pattern is legitimate in many programs, so check each hit.

    Edge inspected: reaches content or traffic gets to a thing; it crosses the user->prompt boundary (untrusted input reaching a prompt).

    CWE-918 LLM06 ASI02

    Fix: Parse the URL, require https and a host from a fixed allow-list, and refuse private, loopback and link-local addresses after DNS resolution.

    References: https://github.com/modelcontextprotocol/python-sdk · https://gofastmcp.com/servers/tools