[Security] SQL Injection Vulnerability in ListTableTool.ts (MssqlMcp/Node/src/tools)
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- node.js, sql, typescript
Research direction
Start with MssqlMcp/Node/src/tools/ListTableTool.ts and inspect the run() method, especially how the parameters array is used to build the schema filter. Reproduce the supplied malicious input against the sample, then verify that schema values cannot alter the query and that normal table listing still works.
Written by the indexing model from the issue text.
Description
Summary
The ListTableTool class in the Node.js MCP sample is vulnerable to SQL injection attacks due to unsanitized user input being directly interpolated into a dynamic SQL query. This affects the run() method when filtering by schemas via the parameters array.
Affected File: MssqlMcp/Node/src/tools/ListTableTool.ts
Steps to Reproduce
- Instantiate the
ListTableTooland callrun()with malicious input:{ "parameters": ["dbo'; SELECT name FROM sys.databases --"] }
query becomes:
SELECT TABLE_SCHEMA + '.' + TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA IN ('dbo'; SELECT name FROM sys.databases --') ORDER BY TABLE_SCHEMA, TABLE_NAME
- Dominant language
- HTML
- Stars
- 331
- Forks
- 208
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from Azure-Samples/SQL-AI-samples
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
Azure-Samples/SQL-AI-samples#90 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Azure-Samples/SQL-AI-samples#79 · 6 reactions ·
-
Local db Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
All issues in Azure-Samples/SQL-AI-samples
Similar issues
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
canonical/paas-charm#368 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
tech debt
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
area:workflow bug ready-for-agent
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
fil-donadoni/tolaria#4409 ·
-
status/awaiting_triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100