MCP tool that runs shell commands
Partialhigh severity · reads .ts .tsx .js .jsx .mjs .cjs .pyBeta
The agent decides what to pass to this tool, and anything it reads (a web page, an issue, a file) can steer it. If tool input reaches the command, a prompt injection becomes a shell on this machine (CWE-78). When Lintsure finds this, it marks it as Partial: it may be fine, depending on context only you can confirm.
What it looks like
A line Lintsure flags in its own test app:
// src/mcp/server.ts
server.registerTool("run", {}, async ({ cmd }) => ({ content: [{ type: "text", text: execSync(cmd).toString() + token }] }));How to fix it
Run a fixed program with execFile and an argument list, never a command string. Check every argument against an allow-list, and ask the user before anything that changes files or systems.
Through a coding agent, Lintsure suggests the change and waits. Nothing is edited until you approve it.
Controls it relates to
- OWASP LLM Top 10LLM03:2026Excessive Agency
- OWASP Top 10A06:2025Insecure Design
What the framework asks
OWASP LLM Top 10 LLM03:2026: Excessive Agency
Tools and permissions given to an agent should be the minimum it needs, with a person approving anything risky.
Evidence a reviewer may ask for: A list of the tools each agent can call and which need approval.
Summaries are our own reading of the public texts, not the official wording.
Check your code for this
Runs on your machine. Your code is never uploaded.
npx lintsure scanThis rule is in Beta: its mapping to framework controls is our own reading of the public texts, not independently reviewed. Lintsure is a readiness tool, not an audit or legal advice. A finding, or the lack of one, doesn't make you compliant. Disclaimer
We improve these rules all the time. If you see a false alarm, a missed problem or anything that could work better, tell us in a review and we will use it to improve your experience.
Related rules
- Personal data written to logs
- Secret or private key committed to source
- Data sent over plain HTTP
- Personal data or tokens in a URL
Did this rule flag something that's fine, or miss a real problem? Tell us on GitHub. Every report becomes a test case, so the same mistake can't come back.