/** * MCP Tool Result Injection Scanner * * Current scanners (prompt-injection-tester, mcp-tool-manifest-scanner) only audit * *static* content: config files, tool descriptions, source code files. * * This scanner targets the dynamic attack surface: * * User query → Agent → MCP Tool call → External content → Agent context ← INJECTED HERE * * Three analysis modes: * * 1. Tool Risk Classification * Parse MCP config files; classify each tool/server by its external data source. * High-risk tools (web_fetch, email, search, etc.) can return attacker-controlled * content that feeds directly into the LLM context window. * * 2. Fixture / Mock Response Scanning * Scan JSON/YAML test fixtures and mock data files for MCP-shaped responses * (fields: content, text, result, output, response). Apply injection pattern * matching to string values — these represent real tool return payloads that * an attacker could craft. * * 3. Defense Gap Detection * Check whether the codebase validates or sanitizes tool return values before * feeding them into the LLM context. Missing output validation is a structural * vulnerability regardless of individual tool risk. * * Finding ID prefix: TRI (Tool Result Injection) * TRI-001..TRI-099 Tool risk classification * TRI-100..TRI-199 Injection patterns in fixture/mock data * TRI-200..TRI-299 Defense gap findings */ import { ScannerModule, Finding } from '../types'; /** @internal — exported for testing */ export declare function categorizeTool(toolName: string, serverCommand?: string, serverArgs?: string[]): string | null; /** @internal — exported for testing */ export declare function categorizeServer(serverName: string, command?: string, args?: string[]): string | null; /** Recursively extract all string values from a JSON structure, with their key paths. @internal — exported for testing */ export declare function extractStringValues(obj: unknown, keyPath?: string): Array<{ path: string; value: string; }>; /** Check if a JSON structure looks like a MCP tool response or mock fixture. @internal — exported for testing */ export declare function looksLikeToolResponse(obj: unknown): boolean; /** * Scan a parsed JSON/YAML object for injection patterns. * Only scan string values in content-carrying fields. */ /** @internal — exported for testing */ export declare function scanFixtureObject(obj: unknown, filePath: string, scannerName: string): Finding[]; /** @internal — exported for testing */ export declare function hasOutputValidationDefense(targetPath: string): boolean; interface ParsedTool { name: string; description?: string; serverName: string; serverCommand?: string; serverArgs?: string[]; } /** @internal — exported for testing */ export declare function parseToolsFromConfig(raw: Record): ParsedTool[]; export declare const mcpToolResultInjectionScanner: ScannerModule; export {}; //# sourceMappingURL=mcp-tool-result-injection-scanner.d.ts.map