Security Vulnerability Report
Severity: High (CVSS 7.0)
CWE: CWE-89 (SQL Injection)
Affected: mcp-database-server read_query and write_query tools
Summary
The read_query and write_query MCP tools accept and execute arbitrary SQL statements without permission controls, enabling destructive operations when the LLM agent is manipulated via prompt injection.
The tools pass user/agent-provided SQL directly to the database engine without:
- SQL syntax allowlisting (e.g., only SELECT for read operations)
- Permission-based access control
- Statement type validation
- Query parameterization enforcement
Impact
When combined with prompt injection attacks on the LLM agent:
- Execute
DROP TABLE, TRUNCATE, or DELETE FROM to destroy data
- Use
SELECT with subqueries to exfiltrate sensitive data from other tables
- In databases supporting command execution (e.g., PostgreSQL
COPY ... PROGRAM), this can escalate to OS-level RCE
Suggested Fix
- Implement separate read-only and read-write connection pools with database-level permissions
- For
read_query, enforce SELECT-only validation
- Implement query parameterization for all user-supplied values
- Add query result size limits to prevent data exfiltration
- Consider implementing an allowlist of permitted query patterns
Credits
Reported by Guigui Wang / Correctover — Runtime Verification for Agent Systems
This report follows responsible disclosure practices. Specific code locations are not disclosed publicly. I'm happy to share details privately with maintainers.
Security Vulnerability Report
Severity: High (CVSS 7.0)
CWE: CWE-89 (SQL Injection)
Affected: mcp-database-server read_query and write_query tools
Summary
The
read_queryandwrite_queryMCP tools accept and execute arbitrary SQL statements without permission controls, enabling destructive operations when the LLM agent is manipulated via prompt injection.The tools pass user/agent-provided SQL directly to the database engine without:
Impact
When combined with prompt injection attacks on the LLM agent:
DROP TABLE,TRUNCATE, orDELETE FROMto destroy dataSELECTwith subqueries to exfiltrate sensitive data from other tablesCOPY ... PROGRAM), this can escalate to OS-level RCESuggested Fix
read_query, enforce SELECT-only validationCredits
Reported by Guigui Wang / Correctover — Runtime Verification for Agent Systems
This report follows responsible disclosure practices. Specific code locations are not disclosed publicly. I'm happy to share details privately with maintainers.