MySQL MCP Server: Missing Origin/Host Validation in SSE Transport Enables Unauthenticated SQL Execution (DNS Rebinding / Direct Exposure) (CVE-2026-59971)
## 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`: 1. `SseServerTransport` is constructed without `security_settings` — the SDK defaults `enable_dns_rebinding_protection` to `False`. 2. The Starlette app has no CORS or TrustedHost middleware. 3. All three routes (`/`, `/sse`, `/messages/`) are unauthenticated. 4. The service binds to `0.0.0.0` by default. 5. 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 `FILE` privilege: 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).
AI Analysis
Technical Summary
In mysql-mcp-server when using SSE/HTTP transport mode (triggered by MCP_TRANSPORT=sse), the SseServerTransport is instantiated without security settings, disabling DNS-rebinding protection. The Starlette application lacks CORS and TrustedHost middleware, all routes are unauthenticated, and the service binds to 0.0.0.0 by default. This allows unauthenticated attackers to invoke the execute_sql function with fully attacker-controlled queries, leading to arbitrary SQL execution. If the MySQL user has FILE privileges, attackers can read/write files and potentially achieve remote code execution. The vulnerability is addressed in version 0.4.2 by enabling DNS-rebinding protection and recommending binding to 127.0.0.1.
Potential Impact
Unauthenticated attackers can execute arbitrary SQL commands on the database, resulting in full data exfiltration and modification. With FILE privileges, attackers can read and write arbitrary files on the server, enabling potential remote code execution via webshells. The vulnerability exposes the service to internet-wide scanning and exploitation due to default binding to all interfaces and lack of authentication.
Mitigation Recommendations
A fix is available in mysql-mcp-server version 0.4.2, which enables DNS-rebinding protection by passing TransportSecuritySettings(enable_dns_rebinding_protection=True) to SseServerTransport and recommends binding the service to 127.0.0.1. Users should upgrade to version 0.4.2 or later to remediate this vulnerability.
MySQL MCP Server: Missing Origin/Host Validation in SSE Transport Enables Unauthenticated SQL Execution (DNS Rebinding / Direct Exposure) (CVE-2026-59971)
Description
## 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`: 1. `SseServerTransport` is constructed without `security_settings` — the SDK defaults `enable_dns_rebinding_protection` to `False`. 2. The Starlette app has no CORS or TrustedHost middleware. 3. All three routes (`/`, `/sse`, `/messages/`) are unauthenticated. 4. The service binds to `0.0.0.0` by default. 5. 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 `FILE` privilege: 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).
CVSS v3.1
Score 10.0critical
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
In mysql-mcp-server when using SSE/HTTP transport mode (triggered by MCP_TRANSPORT=sse), the SseServerTransport is instantiated without security settings, disabling DNS-rebinding protection. The Starlette application lacks CORS and TrustedHost middleware, all routes are unauthenticated, and the service binds to 0.0.0.0 by default. This allows unauthenticated attackers to invoke the execute_sql function with fully attacker-controlled queries, leading to arbitrary SQL execution. If the MySQL user has FILE privileges, attackers can read/write files and potentially achieve remote code execution. The vulnerability is addressed in version 0.4.2 by enabling DNS-rebinding protection and recommending binding to 127.0.0.1.
Potential Impact
Unauthenticated attackers can execute arbitrary SQL commands on the database, resulting in full data exfiltration and modification. With FILE privileges, attackers can read and write arbitrary files on the server, enabling potential remote code execution via webshells. The vulnerability exposes the service to internet-wide scanning and exploitation due to default binding to all interfaces and lack of authentication.
Mitigation Recommendations
A fix is available in mysql-mcp-server version 0.4.2, which enables DNS-rebinding protection by passing TransportSecuritySettings(enable_dns_rebinding_protection=True) to SseServerTransport and recommends binding the service to 127.0.0.1. Users should upgrade to version 0.4.2 or later to remediate this vulnerability.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-rqfv-2mw9-78g2
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2026-59971"]
- Ecosystems
- ["PyPI"]
- Database Specific Severity
- CRITICAL
- Cvss Version
- 3.1
Threat ID: 6aa47ea655bf5e2cf5855e7e
Added to database: 09/11/2026, 22:20:22 UTC
Last enriched: 09/11/2026, 23:01:47 UTC
Last updated: 09/12/2026, 00:47:07 UTC
Views: 7
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.