/** * Chain Execution Tester * Dynamic testing for multi-tool chain exploitation vulnerabilities * * Issue #93, Challenge #6: Multi-tool chained exploitation attacks * Tests for: * 1. Arbitrary tool invocation without allowlist * 2. Output injection via {{output}} template substitution * 3. Recursive chain execution (DoS potential) * 4. State poisoning between chain steps * 5. Missing depth/size limits * * A/B Validation: * - vulnerable-mcp (10900): Should detect all vulnerability categories * - hardened-mcp (10901): 0 false positives (validation-only behavior) */ import { Tool } from "@modelcontextprotocol/sdk/types.js"; import { ChainExploitationAnalysis, ChainVulnerabilityCategory } from "./SecurityResponseAnalyzer.js"; import { CallToolFunction } from "./CrossToolStateTester.js"; export type { CallToolFunction } from "./CrossToolStateTester.js"; /** * Reason for chain exploitation test result */ export type ChainTestReason = "chain_execution_confirmed" | "output_injection_detected" | "recursive_execution_detected" | "arbitrary_tool_accepted" | "state_poisoning_detected" | "validation_only" | "chain_rejected" | "tool_not_chain_executor" | "test_error"; /** * Result of a single chain exploitation test */ export interface ChainExecutionTestResult { vulnerable: boolean; reason: ChainTestReason; vulnerabilityCategories?: ChainVulnerabilityCategory[]; evidence?: { chainPayload: string; response: string; analysisResult: ChainExploitationAnalysis; }; error?: string; } /** * Summary of chain exploitation tests for a tool */ export interface ChainExploitationSummary { total: number; vulnerable: number; safe: number; errors: number; vulnerableTests: string[]; vulnerabilityCategories: ChainVulnerabilityCategory[]; } /** * Configuration for chain execution testing */ export interface ChainExecutionTesterConfig { /** Enable verbose logging */ verbose?: boolean; /** Maximum chain depth to test (default: 10) */ maxChainDepth?: number; } /** * Tests for multi-tool chain exploitation vulnerabilities */ export declare class ChainExecutionTester { private readonly verbose; private analyzer; constructor(config?: ChainExecutionTesterConfig); /** * Log message if verbose logging is enabled */ private log; /** * Identify tools that might be chain executors * Looks for tools with names/descriptions/parameters suggesting chain execution */ identifyChainExecutorTools(tools: Tool[]): Tool[]; /** * Get the parameter name for chain input from tool schema */ private getChainParamName; /** * Extract text content from tool response */ private extractResponseText; /** * Determine the vulnerability reason from analysis result */ private determineVulnerabilityReason; /** * Test single chain payload against a tool */ testChainPayload(callTool: CallToolFunction, tool: Tool, chainPayload: string, paramName?: string): Promise; /** * Get test payloads for chain exploitation testing */ private getTestPayloads; /** * Run comprehensive chain exploitation tests on a tool */ runChainExploitationTests(callTool: CallToolFunction, tool: Tool): Promise>; /** * Summarize chain exploitation test results */ summarizeResults(results: Map): ChainExploitationSummary; } //# sourceMappingURL=ChainExecutionTester.d.ts.map