/

CVE-2026-48774

Severity:

HIGH RISK

(7.5)

Input Validation Flaw (CWE-20) in ProxySQL MCP Tool

CVE-2026-48774

Analyzed

Vulnerability type

Category:

Improper Input Validation

CWE:

CWE-20

Impact:

Privilege-Scoped Write and Administrative SQL via Read-Only Interface

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

ProxySQL's GenAI/MCP run_sql_readonly tool fails to enforce its documented read-only behavior for MySQL targets in versions 3.0.0 through 3.0.8.

Because it validates only the first keyword and uses weak blacklist checks while executing the full SQL with multi-statements enabled, an MCP caller can smuggle side-effecting SQL after a benign-looking read-only query.

Affected context

This vulnerability occurs in deployments that:

  • Enable the GenAI/MCP integration and expose the /mcp/query endpoint
  • Configure MySQL targets for the run_sql_readonly tool
  • Rely on the tool's documented read-only contract for safety

The risk is highest when MCP backend database credentials have write or administrative privileges, or when the MCP endpoint is reachable by less-trusted callers or automated agents.

Exploit preconditions

  • Attack surface: The ProxySQL MCP /mcp/query HTTP endpoint using the run_sql_readonly tool.
  • Required access: Ability to call the MCP query endpoint (network reachability) and satisfy any configured mcp-query_endpoint_auth token or upstream authentication.
  • Trigger point: Submission of a SQL payload where the first statement is read-only (for example, SELECT) followed by a second, side-effecting statement.
  • Why exploitation is possible: The validator only inspects the overall SQL text with naive substring blacklisting and "first keyword" allowlisting, but then passes the entire string to a backend connection configured with CLIENT_MULTI_STATEMENTS. This allows additional statements such as RENAME TABLE, SET, RESET, LOCK TABLES, or KILL to execute despite the read-only contract.

Why this happens

The root cause is an improper input validation pattern where security decisions are based on shallow string checks instead of the actual semantics of the entire SQL payload.

The run_sql_readonly tool assumes that:

  • Checking the first keyword against a read-only allowlist, and
  • Applying a simple blacklist to the raw SQL string

are sufficient to prevent state-changing operations. This is incorrect when the execution layer enables multi-statement support and does not enforce a strict single-statement or read-only mode on the backend connection.

Conceptually, this maps to CWE-20: Improper Input Validation, where validation logic fails to fully constrain untrusted input before it is used, leading to a violation of the intended read-only security contract.

Potential impact

  • Attackers could perform write operations (e.g., RENAME TABLE, INSERT, UPDATE, or DELETE if reachable via multi-statements).
  • Callers may execute administrative or session-affecting SQL, such as SET, RESET, LOCK TABLES, or KILL.
  • Data integrity could be impacted through schema changes or table renames.
  • Application behavior may be disrupted if critical tables are renamed, locked, or otherwise modified.
  • Security assumptions around "read-only" database access from GenAI/MCP workflows can be undermined, enabling lateral movement or privilege misuse depending on the database account's rights.

General mitigation guidance

Effective mitigation focuses on tightening validation, constraining execution, and minimizing trust in the MCP surface:

  • Replace heuristic string checks with strict SQL parsing or use database-native features (such as read-only users and transaction modes) to guarantee no state changes.
  • Enforce single-statement execution for read-only tools and disable multi-statement options like CLIENT_MULTI_STATEMENTS when the contract claims read-only behavior.
  • Configure MCP backend credentials as least-privilege, read-only database accounts, so even if validation fails, the database enforces read-only semantics.
  • Limit MCP endpoint exposure via network controls, and require strong authentication (for example, non-empty mcp-query_endpoint_auth tokens).
  • Introduce defensive query rules or proxy policies that block obvious multi-statement patterns and side-effecting keywords, while recognizing this as a supplement to—not a replacement for—backend permissions.

How teams detect issues like this

Organizations can detect this class of issue and its misuse by:

  • Reviewing MCP and database logs for multi-statement sequences where a benign SELECT is immediately followed by schema or administrative commands.
  • Adding application-level or WAF rules that flag or block MCP requests containing semicolons followed by side-effecting SQL keywords.
  • Using static analysis or configuration review to identify:
  • Use of CLIENT_MULTI_STATEMENTS in code paths documented as read-only
  • Reliance on naive keyword-based or blacklist-driven SQL validation for security guarantees
  • Incorporating security-focused code reviews for MCP- and GenAI-related features, ensuring that read-only contracts are enforced by both input validation and backend privilege configuration.

Sources

SourceLink
github.comgithub.com/sysown/proxysql/commit/e32b7fd50c7c234ea628e392e621e09a2a919e08
github.comgithub.com/sysown/proxysql/security/advisories/GHSA-7wh6-2vcc-gcm4

Frequently asked

questions

Exploitability is scoped to environments that expose the MCP /mcp/query endpoint using run_sql_readonly with MySQL targets. If the endpoint is reachable and the caller can satisfy any authentication requirements, they may exploit the issue, but their impact is constrained by the privileges of the MCP backend database account.

Yes. The attacker needs the ability to invoke the MCP query endpoint, which may require network access and a valid mcp-query_endpoint_auth token or upstream authentication. There is no separate bypass of database authentication; the attacker leverages the configured MCP credentials.

The safest pattern is to enforce read-only behavior in multiple layers: use least-privilege, read-only database credentials; disable multi-statement execution in any path labeled as read-only; and back this with robust SQL parsing or database-enforced read-only modes rather than heuristic string filters.

Future designs should avoid relying on simple blacklists or first-keyword checks to enforce security contracts. Instead, they should combine precise validation or parsing, strict execution modes (no multi-statements for read-only tools), strong authentication and network isolation for auxiliary endpoints, and least-privilege credentials so that even if validation fails, backend systems enforce the intended limits.

Find out what's already
exploitable in your codebase.