MySQL MCP Server: Missing Origin/Host Validation in SSE Transport Enables Unauthenticated SQL Execution (DNS Rebinding / Direct Exposure)
## 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`
PYSEC-2026-4109
Primary source · Revision 2
Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.
Security context
Source reference: osv:PYSEC-2026-4109
mysql-mcp-server
Source reference: /affected/0/package/name
- Affected versions
- 0.1.0
Source reference:
/affected/0/versions0.1.2Source reference:
/affected/0/versions0.2.0Source reference:
/affected/0/versions0.2.1Source reference:
/affected/0/versions0.2.2Source reference:
/affected/0/versions0.3.0Source reference:
/affected/0/versions0.3.1Source reference:
/affected/0/versions0.4.0Source reference:
/affected/0/versions0.4.1Source reference:
/affected/0/versions - Fixed versions
- 0.4.2
Source reference:
/affected/0/ranges - Prerequisites
- Not stated in this record
Structured affected-version data
Original package identities and version rules from this source.
[
{
"ranges": [
{
"type": "ECOSYSTEM",
"events": [
{
"introduced": "0"
},
{
"fixed": "0.4.2"
}
]
}
],
"package": {
"name": "mysql-mcp-server",
"purl": "pkg:pypi/mysql-mcp-server",
"ecosystem": "PyPI"
},
"versions": [
"0.1.0",
"0.1.2",
"0.2.0",
"0.2.1",
"0.2.2",
"0.3.0",
"0.3.1",
"0.4.0",
"0.4.1"
],
"database_specific": {
"source": "https://github.com/pypa/advisory-database/blob/main/vulns/mysql-mcp-server/PYSEC-2026-4109.yaml"
}
}
]- Related CVEs
- CVE-2026-59971
Source reference:
/aliases
Publisher severity
No explicit severity was provided.
- Event
- #62523 · Revision 2
- Added to Heist Feed
- Publisher date