Skip to content

AAK-MCP-MYSQLMCP-CVE-2026-59971-001: mysql-mcp-server below 0.4.2 (unauthenticated SSE transport reaches execute_sql)

Severity
CRITICAL
Category
Supply Chain (supply-chain)
Scanner
agent_audit_kit/scanners/mcp_cve_pins_2026_07.py
Auto-fixable
No.
SARIF name
MysqlMcpServerUnauthSse

What it detects

MySQL MCP Server (mysql-mcp-server, PyPI) before 0.4.2 constructs SseServerTransport in src/mysql_mcp_server/server.py with neither security_settings nor enable_dns_rebinding_protection when MCP_TRANSPORT=sse is set, while the Starlette routes /, /sse and /messages/ carry no authentication and the service binds 0.0.0.0 by default. A network attacker reaches execute_sql directly; a remote web page reaches it through DNS rebinding, relaying same-origin requests from a victim's browser to the locally bound service. Either path supplies a query that lands at cursor.execute(query), giving unauthenticated read and write access to the configured database. Where the MySQL account holds FILE privileges the same access reads and writes server files and can reach code execution. The default stdio transport is not affected (CVE-2026-59971, CVSS 10.0, CWE-306 + CWE-346). Fixed in 0.4.2.

How to fix

Upgrade mysql-mcp-server to >= 0.4.2 and pin it. If you must run the SSE transport, bind it to 127.0.0.1 behind an authenticating reverse proxy, enable DNS-rebinding protection, and put an inbound credential on the /sse and /messages/ routes. Grant the MySQL account only the privileges the server needs — never FILE — so that a reachable execute_sql cannot become file read/write.

To confirm the finding is gone, report only this rule:

agent-audit-kit scan . --rules AAK-MCP-MYSQLMCP-CVE-2026-59971-001

Limitations

Reads mysql-mcp-server and mysql_mcp_server in requirements*.txt at any depth and, at the project root only, in pyproject.toml, Pipfile, .mcp.json, mcp.json, claude_desktop_config.json and the Pipfile.lock, poetry.lock and uv.lock lockfiles, taking the lowest version a range allows and reporting a reference that states no version. The dependency is not read when it is declared in a sub-directory manifest (services/api/pyproject.toml), in .cursor/mcp.json or .vscode/mcp.json, or in a lockfile format the reader does not parse (pdm.lock). A file over 2 MB, or a lockfile over 32 MiB, is not read. A declaration nested more than 64 levels deep in package.json, a TOML manifest or an MCP config (an MCP server more than 62) is still judged, and reported without a line; a lockfile entry keeps its line at any depth.

References


All rules. This page is generated from the rule registry when the documentation is built; to change it, change the rule in agent_audit_kit/rules/builtin.py. To give the rule a hand-written write-up, add docs/rules/AAK-MCP-MYSQLMCP-CVE-2026-59971-001.md: the page then shows that text, with the registry reference appended under it.