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

SQL injection

CRITICALAIVSS 9.4CWE: CWE-89OWASP: LLM05Agentic: T02Rule: MCP-062

A tool handler interpolates model-supplied input into an SQL string, so the LLM can rewrite the query, read tables it should not see, or drop data.

What it is

SQL injection is the query-language cousin of command injection: user- or model-supplied text is concatenated or f-stringed into SQL text, and the driver dutifully parses whatever the attacker wrote. The canonical fix — parameterised queries — has been known since the 1990s, and yet SQL-injection bugs keep shipping because f-strings and template strings make the vulnerable path the easy one.

Why it matters for MCP

MCP servers that wrap a database as a tool ("query my analytics warehouse", "fetch my CRM contact") are one of the most common server shapes. The model's argument goes straight into a query the author planned. A document the model retrieved elsewhere can ask it to run `'; DROP TABLE users; --` — the model will forward that string exactly because that is what the tool told it to do.

Vulnerable example

example.py
1
@server.tool()
2
def get_user(email: str) -> dict:
3
    # f-string interpolation — the model controls `email`
4
    cur.execute(f"SELECT * FROM users WHERE email = '{email}'")
5
    return cur.fetchone()

Secure example

example.py
1
@server.tool()
2
def get_user(email: str) -> dict:
3
    # Parameterised — driver escapes the value, never the query shape
4
    cur.execute("SELECT * FROM users WHERE email = %s", (email,))
5
    return cur.fetchone()

How MCPSafe detects this

We flag `cursor.execute`, `db.query`, `session.execute`, Knex raw, and Sequelize raw calls whose SQL argument is an f-string, template literal, or `+` concatenation. Parameterised calls with a tuple/list of bind values are the safe pattern and are not flagged.

See the full threat catalog for every documented detection.

Framework alignment

OWASP LLM Top-10 (2025)
LLM05 — Improper Output Handling
OWASP Agentic AI Top-10
T02 — Tool Misuse
AIVSS v0.5
9.4 (CRITICAL)AIVSS:1.0/S:CRITICAL/AV:N/AU:M/BR:H/CD:I

Illustrative CVEs

CVEs of the same CWE class. Not MCP-specific, but exemplify the failure mode MCPSafe detects.

  • CVE-2024-10924 — Really Simple SSL SQLi — auth-bypass via unsanitized param

Further reading

  • CWE-89: SQL Injection
  • OWASP SQL Injection

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