MCPSafe.io
RegistryThreatsMethodologyDocsPricingScanSign in
MCPSafe.io

Security checks for MCP servers — public packages and private repos, fast or deep.

Legal

Privacy PolicyCookie PolicyTerms of ServiceSecurity disclosure

Resources

State of MCP SecuritySupportSystem statusMade in Germany 🇩🇪

© 2026 MCPSafe. All rights reserved.

GDPR — Privacy Policy
← Threat Catalog

Server Implementation

Verbose error disclosure

MEDIUMAIVSS 4.8CWE: CWE-209OWASP: LLM02Agentic: T08Rule: MCP-085

Tool error paths return stack traces, SQL fragments, file paths, or full exception messages to the caller — information an attacker uses to refine the next payload.

What it is

A tool that does `except Exception as e: return str(e)` hands the attacker the server's internal state on a silver platter: absolute filesystem paths, DB driver error messages that echo the offending SQL, un-stripped stack traces, environment-variable names. The information leak turns a failed probe into a successful reconnaissance.

Why it matters for MCP

MCP tool errors propagate back to the model, which may summarise or quote them in follow-up reasoning. Even if the end-user never sees the raw error, the LLM has — and indirect prompt injection can instruct the model to echo the error text to an outbound channel. "Helpful" debugging details become exfiltrated reconnaissance.

Vulnerable example

example.py
1
@server.tool()
2
def run_query(sql: str) -> str:
3
    try:
4
        return db.execute(sql).fetchall()
5
    except Exception as e:
6
        return f"query failed: {e}"  # leaks SQL driver error verbatim

Secure example

example.py
1
import logging
2
log = logging.getLogger(__name__)
3
4
@server.tool()
5
def run_query(sql: str) -> str:
6
    try:
7
        return db.execute(sql).fetchall()
8
    except Exception:
9
        log.exception("run_query_failed")   # full detail to server logs only
10
        raise RuntimeError("query failed")  # generic to caller

How MCPSafe detects this

We flag tool-handler `return` / JSON-response paths that include `str(e)`, `traceback.format_exc()`, `err.stack`, `err.message`, or template-interpolate an exception variable. Logging the exception server-side is the safe pattern and is not flagged.

See the full threat catalog for every documented detection.

Framework alignment

OWASP LLM Top-10 (2025)
LLM02 — Sensitive Information Disclosure
OWASP Agentic AI Top-10
T08 — Repudiation
AIVSS v0.5
4.8 (MEDIUM)AIVSS:1.0/S:MEDIUM/AV:N/AU:L/BR:L/CD:D

Further reading

  • CWE-209: Generation of Error Message Containing Sensitive Information
  • OWASP: Improper Error Handling

Scan an MCP server for this issue

MCPSafe runs this check — and every other rule in the catalog — on any MCP server you paste in.

Scan now