-
Notifications
You must be signed in to change notification settings - Fork 7
MCP server ignores CLI execution limits, creates unconstrained interpreters #981
Copy link
Copy link
Closed
Labels
securitySecurity vulnerability or hardeningSecurity vulnerability or hardening
Description
Summary
Each tools/call to the MCP "bash" tool creates a new bashkit::Bash::new() with default configuration, ignoring all CLI flags like --max-commands. This allows MCP clients to execute arbitrarily complex scripts without limits.
Severity: Medium
Category: Resource Exhaustion / Missing Security Controls (TM-DOS)
Affected Files
crates/bashkit-cli/src/mcp.rsline ~274-275
Code
let mut bash = bashkit::Bash::new(); // default, no limitsThe CLI's build_bash() function (which applies args.max_commands) is only used in oneshot mode. The MCP code path ignores Args entirely.
Steps to Reproduce
- Start bashkit in MCP mode:
bashkit --mcp --max-commands 100 - Send a
tools/callrequest with a script containing 100,000+ commands - The script executes without hitting any limit
Impact
- MCP clients bypass all configured execution limits
- Repeated calls exhaust memory (each creates a new interpreter)
- No rate limiting on interpreter creation
Acceptance Criteria
- MCP handler receives and applies CLI configuration (limits, feature flags)
-
max_commands,max_loop_iterations,timeoutare enforced per MCP call - Test: MCP tool call respects
--max-commandsflag - Consider: per-request resource limits configurable via MCP tool input
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
securitySecurity vulnerability or hardeningSecurity vulnerability or hardening