Severity:

HIGH RISK

(7.3)

SQL Injection in MCP Handler Database Server Request

CVE-2026-5322

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-74, CWE-89

Impact:

Data Exposure and Database Compromise

Severity:

HIGH RISK

(7.3)

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

A SQL injection vulnerability in the MCP Handler component of AlejandroArciniegas mcp-data-vis allows attacker-controlled input to be embedded directly into database queries in src/servers/database/server.js.

When an attacker can send crafted requests to the vulnerable Request function, they may manipulate or exfiltrate data from the underlying database, and in some configurations escalate to full compromise of the data store.

Affected context

The issue occurs in Node.js code handling database requests within the MCP Handler (src/servers/database/server.js).

It affects deployments where:

  • Client-supplied parameters are passed into SQL statements without proper sanitization or parameterization
  • The MCP Handler is reachable over a network interface (e.g., exposed API or service)
  • The application backend uses a relational database that executes dynamically constructed SQL strings

Because the project follows a rolling release model, the precise affected revision range is not clearly bounded and administrators must assume any unpatched deployment may be impacted.

Exploit preconditions

  • Attack surface: Network-accessible MCP Handler endpoint(s) processed by the Request function
  • Required access: Ability to send HTTP or protocol-level requests to the database server handler; no local system access is required
  • Trigger point: Execution of SQL queries in Request that incorporate attacker-controlled fields into query text
  • Why exploitation is possible: The implementation appears to concatenate or interpolate unvalidated input into SQL statements rather than using bind parameters or robust query builders, enabling crafted payloads to alter query structure

Why this happens

The root cause aligns with CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') and CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component.

The Request function likely assembles SQL commands by embedding raw user input into query strings, trusting that the input will only contain data and not SQL control characters or operators.

Because the database engine interprets the combined string as executable SQL, attackers can break out of the intended query context, inject additional clauses, or chain multiple statements, turning what should be simple data parameters into executable control over the query logic.

Potential impact

  • Read access to sensitive or confidential data that the database account can query
  • Unauthorized modification, insertion, or deletion of database records
  • Circumvention of application-level authorization checks by manipulating WHERE clauses
  • Discovery of internal schema information (tables, columns, indices) via union-based or error-based injection
  • Potential execution of database-specific functions or stored procedures that may lead to privilege escalation at the database layer
  • Denial of service against the application by issuing expensive or destructive queries

General mitigation guidance

Effective mitigation focuses on removing direct string-based query construction paths and tightening input trust boundaries.

Recommended defensive patterns include:

  • Using parameterized queries or prepared statements for all database operations, ensuring user input is always treated as data, not executable SQL
  • Employing well-maintained ORM or query builder libraries that abstract away raw SQL string concatenation
  • Applying strict input validation and normalization for fields used in queries, limiting them to expected formats, types, and whitelisted value sets
  • Segregating database privileges so that the application account has only the minimal permissions required (e.g., no arbitrary DDL or superuser rights)
  • Centralizing database access logic to a small, reviewed module where safe patterns can be enforced consistently
  • Adopting secure defaults in coding standards that prohibit ad-hoc string concatenation for SQL

How teams detect issues like this

Detection can be approached through both code-focused and behavior-focused techniques:

  • Static analysis: Configure linters or SAST tools to flag dynamic SQL construction patterns (string concatenation, template literals) that include request parameters or other untrusted sources in database calls
  • Code review: During manual reviews, look for direct use of request/query/body parameters in SQL strings, missing parameter binding, and custom query-building helpers that bypass ORM safety features
  • Logging and monitoring: Instrument database access to log query patterns and alert on anomalous queries, unusual use of operators (e.g., OR 1=1), or repeated failed queries resembling probing attempts
  • Runtime security policies: Use application firewalls or API gateways with SQL injection signatures as a compensating control, recognizing that these should augment, not replace, secure coding

Sources

SourceLink
github.comgithub.com/wing3e/public_exp/issues/19
vuldb.comvuldb.com/submit/780731
vuldb.comvuldb.com/vuln/354654
vuldb.comvuldb.com/vuln/354654/cti

Frequently asked

questions

Yes. As described, the attack can be initiated remotely by sending crafted requests to the MCP Handler endpoints that invoke the vulnerable Request function, assuming the service is network-accessible.

That depends on how the MCP Handler is exposed. If the affected endpoints require authentication, an attacker would need valid credentials or another way to bypass access controls. If any vulnerable path is publicly reachable without strong authentication, then anonymous exploitation is possible.

Replace all dynamic SQL string construction that incorporates user input with parameterized queries or ORM methods that handle binding internally. At the same time, restrict the database account's privileges to the minimal set needed by the application.

Establish coding standards that forbid concatenating untrusted input into SQL, mandate the use of prepared statements or safe query builders, and enforce these rules via automated static analysis and peer review. Complement these practices with input validation, principle of least privilege on the database, and regular security testing focused on injection risks.

Find out what's already
exploitable in your codebase.