Severity:

HIGH RISK

(7.3)

SQL Injection in dubydu sqlite-mcp extract_to_json

CVE-2026-7206

Deferred

Vulnerability type

Category:

SQL Injection

CWE:

CWE-74, CWE-89

Impact:

Arbitrary SQL Execution on Application Database

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

dubydu sqlite-mcp up to version 0.1.0 contains a SQL injection vulnerability in the extract_to_json function, where the output_filename argument is used unsafely in SQL queries.

An attacker who can control this argument over a remote interface may inject arbitrary SQL, potentially leading to data exfiltration, modification, or disruption of the underlying SQLite database.

Affected context

The vulnerability resides in the extract_to_json function in src/entry.py within the sqlite-mcp project.

It manifests when user-controlled data, particularly the output_filename parameter, is incorporated into dynamically constructed SQL statements without adequate neutralization or parameterization.

This risk is most pronounced in deployments where extract_to_json is exposed through a network-accessible API, CLI service, or plugin interface that accepts untrusted input and executes queries against a SQLite database.

Exploit preconditions

  • Attack surface: Any remote endpoint, API, or integration that forwards a caller-controlled output_filename into extract_to_json.
  • Required access: Ability to invoke functionality that calls extract_to_json with a chosen output_filename value (e.g., HTTP request, RPC call, or plugin hook).
  • Trigger point: The vulnerable code path that builds and executes a SQL query using the output_filename value in its structure or parameters.
  • Why exploitation is possible: The application interpolates untrusted output_filename data into SQL commands without using parameterized queries or proper escaping, allowing crafted input to alter the intended query logic.

Why this happens

The core issue is unsafe construction of SQL queries using concatenation or string formatting with untrusted input from output_filename.

This behavior maps to CWE-89: Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection') and is closely related to CWE-74: Improper Neutralization of Special Elements in Output.

Instead of treating output_filename as data bound via parameters, the code incorporates it directly into SQL syntax, which allows attackers to inject additional SQL clauses or statements that the database interprets as legitimate commands.

Potential impact

  • Unauthorized reading of data from SQLite tables beyond what the application normally exposes
  • Modification or deletion of records, leading to data integrity issues or loss
  • Creation or alteration of database schema elements such as tables or indexes
  • Application-level denial of service via expensive or destructive queries
  • Potential pivot to other vulnerabilities if application logic assumes database integrity

General mitigation guidance

Effective mitigation centers on treating all user-controlled strings as data, never as SQL syntax.

Recommended defensive patterns include:

  • Using parameterized queries or prepared statements for all database interactions, including any parts influenced by output_filename.
  • Avoiding dynamic SQL construction where possible; if dynamic behavior is required, constrain it to a fixed set of allowed values (e.g., whitelisting filenames or identifiers).
  • Normalizing and validating output-related parameters against strict patterns (e.g., limiting to alphanumeric characters and known-safe separators, rejecting embedded SQL metacharacters).
  • Encapsulating database access behind a minimal, well-reviewed API to reduce the number of places where SQL is constructed.
  • Applying least-privilege principles to the database schema, such that the application account has only the minimum necessary permissions.

How teams detect issues like this

Detection typically involves a combination of code-centric and behavior-centric approaches:

  • Static analysis rules that flag string concatenation or formatting used to build SQL queries, especially where variables like output_filename are involved.
  • Manual code reviews focused on database access layers, looking for any non-parameterized queries or direct inclusion of user-controlled data in SQL.
  • Runtime monitoring and logging of SQL statements to identify anomalous patterns (e.g., injected UNION, SELECT, or multi-statement constructs).
  • Integration of security testing tools (SAST/DAST) into CI pipelines to automatically probe interfaces that accept output_filename-like parameters for SQL injection behavior.

Sources

SourceLink
github.comgithub.com/dubydu/sqlite-mcp/
github.comgithub.com/dubydu/sqlite-mcp/commit/a5580cb992f4f6c308c9ffe6442b2e76709db548
github.comgithub.com/dubydu/sqlite-mcp/issues/1
github.comgithub.com/dubydu/sqlite-mcp/pull/2
vuldb.comvuldb.com/submit/802081
vuldb.comvuldb.com/vuln/359806
vuldb.comvuldb.com/vuln/359806/cti

Frequently asked

questions

Exploitability depends on how extract_to_json is exposed. If remote callers can directly or indirectly control output_filename through an API or service interface, the issue is remotely exploitable; if usage is limited to trusted, internal inputs, practical risk is reduced but not eliminated.

An attacker needs the ability to invoke functionality that passes a chosen output_filename into extract_to_json. This could be as simple as sending a crafted HTTP request or triggering a plugin call, depending on how the application integrates sqlite-mcp.

The safest approach is to refactor all database interactions to use parameterized queries or prepared statements and to eliminate any direct concatenation or formatting of SQL with user-controlled values, including output_filename.

Establish a development standard that prohibits dynamic SQL construction with untrusted input, enforce it via code review and static analysis, centralize database access in a small, vetted layer, and provide developers with safe abstractions that make parameterized access the default.

Find out what's already
exploitable in your codebase.