CVE-2026-59971: MySQL MCP Server: Missing Origin/Host Validation in SSE Transport Enables Unauthenticated SQL Execution (DNS Rebinding / Direct Exposure)
mysql-mcp-server before 0.4.2 runs unauthenticated in SSE mode and does not validate Host or Origin headers. Anyone who can reach the port can call `execute_sql` and run arbitrary SQL, and a web page can do the same through DNS rebinding if the server is bound locally. The default stdio mode is not affected. Upgrade to 0.4.2.
Published Sep 11, 2026 · Analysis Oct 30, 2026
What an attacker can do
When MCP_TRANSPORT=sse, server.py creates SseServerTransport without security_settings. The MCP Python SDK then leaves DNS-rebinding protection off. The Starlette app adds no CORS or TrustedHost middleware, the routes /, /sse and /messages/ need no credentials, and the service binds to 0.0.0.0 by default. The sink is cursor.execute(query) with a query the caller controls.
Two attack paths follow. In direct exposure, a network attacker connects and calls execute_sql with no credentials. In DNS rebinding, a victim opens a malicious page, the attacker's domain is rebound to 127.0.0.1, and the browser acts as a same-origin proxy to a locally bound server.
The attacker then has whatever the configured MySQL account has: reading and changing all data in its scope. If the account holds the FILE privilege, LOAD_FILE and INTO OUTFILE give file read and write, and the advisory says that can lead to remote code execution through a webshell. The advisory reports 25 publicly reachable SSE instances found by internet-wide scanning. The CVSS score is 10.0 for that exposed case.
Who is affected
mysql-mcp-server versions before 0.4.2, and only when run with MCP_TRANSPORT=sse. Default stdio mode is not affected. Exposure is highest if the SSE listener is bound to a non-loopback address.
pip show mysql-mcp-serverCheck the process environment or .env for MCP_TRANSPORT and the bind host, and test whether the port answers from another machine.
mysql-mcp-server
- Ecosystem
- PyPI
- Affected
- < 0.4.2
- Fixed in
- 0.4.2
- Check
pip show mysql-mcp-server
How to fix it
Upgrade to 0.4.2:
pip install --upgrade mysql-mcp-server==0.4.2The release enables the SDK's DNS-rebinding protection for SSE. By default only localhost:{port} and 127.0.0.1:{port} pass the Host and Origin check. Behind a reverse proxy, add your hostnames in the comma-separated MCP_SSE_ALLOWED_HOSTS. The release notes add that SSE has no built-in authentication, and recommend binding with MCP_SSE_HOST=127.0.0.1 and fronting it with a proxy such as nginx. Use a MySQL account with the least privileges, and without FILE, regardless of version.
How to tell if you were hit
Check MySQL's general or audit log for statements you did not issue, particularly LOAD_FILE, INTO OUTFILE, INTO DUMPFILE, and large SELECT dumps from the MCP server's database user. Look at the SSE server's access logs for connections to /sse and /messages/ from unknown IPs, or with a Host or Origin header that is not localhost. Check the MySQL secure_file_priv directory and web roots for files created by the database user. If the port was reachable from the internet, assume the data was read.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Summary
In SSE/HTTP transport mode, mysql_mcp_server constructs SseServerTransport without passing security_settings. As a result, the MCP Python SDK's DNS-rebinding protection (Origin/Host header validation) is disabled; the Starlette application has no CORS or TrustedHost middleware; and the service binds to 0.0.0.0 by default with no authentication on any route.
Trigger condition: MCP_TRANSPORT=sse. The default stdio mode is not affected.
Attack Scenarios
Scenario A — Direct exposure: Any network attacker can invoke execute_sql to run arbitrary SQL without credentials → full data dump, and via MySQL FILE privileges, arbitrary file read/write and RCE.
Scenario B — DNS rebinding (local bind): An attacker lures a victim's browser to a malicious page, rebinds their domain to 127.0.0.1, and uses the browser as a proxy to invoke execute_sql as same-origin.
Root Cause
In src/mysql_mcp_server/server.py:
SseServerTransportis constructed withoutsecurity_settings— the SDK defaultsenable_dns_rebinding_protectiontoFalse.- The Starlette app has no CORS or TrustedHost middleware.
- All three routes (
/,/sse,/messages/) are unauthenticated. - The service binds to
0.0.0.0by default. - The sink is
cursor.execute(query)with a fully attacker-controlled query.
Impact
- Unauthenticated arbitrary SQL execution against the configured database
- Full data exfiltration and modification
- If the MySQL account holds
FILEprivilege: arbitrary file read (LOAD_FILE) and write (INTO OUTFILE) — potential RCE via webshell drop - Internet-wide scanning has identified 25 publicly reachable SSE instances of this project
Fix
Released in v0.4.2: DNS-rebinding protection is now enabled by passing TransportSecuritySettings(enable_dns_rebinding_protection=True) to SseServerTransport, and the documented recommended bind address is 127.0.0.1.
Credits
Discovered by Huanchen, SongWu (JHU), and BrookeYangRui (JHU).
Credited to designcomputer.
Questions
- Is stdio mode affected?
No. The advisory states the default stdio mode is not affected. The trigger is
MCP_TRANSPORT=sse.- Does 0.4.2 add authentication to SSE?
No. It adds Host and Origin validation against DNS rebinding. The release notes say SSE has no built-in authentication and suggest a reverse proxy and a loopback bind.
- Can this lead to remote code execution?
Possibly. If the MySQL account has the
FILEprivilege, the attacker can read and write files, which the advisory says could allow dropping a webshell.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More Other MCP servers and tools vulnerabilities
All Other MCP servers and tools entriesCVE-2026-102943
Dagu MCP DAG specification read bypasses path containment and workspace isolation
medium6.5Nov 10, 2026CVE-2026-102610
fast-agent: `fast-agent serve` binds HTTP to 0.0.0.0 with no authentication by default; with --shell this is unauthenticated remote command execution
medium6.4Nov 9, 2026CVE-2026-63655
tsParticles: Unbounded HTTP Request Body Buffering in @tsparticles/mcp-server Leads to Remote DoS
high7.5Nov 9, 2026CVE-2026-76892
tsParticles: Malformed JSON requests can terminate the @tsparticles/mcp-server HTTP process
high8.7Nov 9, 2026CVE-2026-76893
tsParticles: A single anonymous MCP session can monopolize HTTP mode and deny new clients
medium6.9Nov 9, 2026CVE-2026-77604
Code Graph RAG: MCP paginated read_file path traversal / arbitrary file read
high7.5Nov 9, 2026
