/** * Cross-Tool State Tester * Tests for privilege escalation by calling tools in sequence * * Issue #92, Challenge #7: Cross-tool state-based authorization bypass * Detects when one tool can modify shared state that affects another tool's authorization. * * Attack flow: * 1. Call admin_action → should get "access denied" * 2. Call config_modifier with "admin_mode=true" * 3. Call admin_action again → if now succeeds, VULNERABLE */ import { CompatibilityCallToolResult, Tool } from "@modelcontextprotocol/sdk/types.js"; import { ProgressCallback } from "../../../../lib/assessment/progressTypes.js"; /** * Function type for calling MCP tools */ export type CallToolFunction = (name: string, params: Record) => Promise; /** * Result of cross-tool privilege escalation test */ export interface CrossToolTestResult { vulnerable: boolean; reason: "privilege_escalation_confirmed" | "escalation_blocked" | "baseline_has_access" | "modifier_rejected" | "test_error"; evidence?: { baseline: string; afterModifier: string; enableResult?: string; }; error?: string; } /** * Identified tool pair for cross-tool testing */ export interface ToolPair { admin: Tool; modifier: Tool; } /** * Configuration for cross-tool state testing */ export interface CrossToolTestConfig { /** Timeout for each tool call in ms (default: 5000) */ timeout?: number; /** Enable verbose logging */ verbose?: boolean; } /** * Tests for cross-tool privilege escalation via shared mutable state */ export declare class CrossToolStateTester { private readonly verbose; constructor(config?: CrossToolTestConfig); /** * Log message if verbose logging is enabled */ private log; /** * Identify potential cross-tool pairs for testing * Looks for admin_action/privileged tools and config_modifier/setting tools */ identifyCrossToolPairs(tools: Tool[]): ToolPair[]; /** * Test cross-tool privilege escalation * * Attack flow: * 1. Call admin_action → expect "access denied" * 2. Call config_modifier with "admin_mode=true" * 3. Call admin_action again → if now succeeds, VULNERABLE */ testPrivilegeEscalation(callTool: CallToolFunction, adminTool: Tool, modifierTool: Tool, onProgress?: ProgressCallback): Promise; /** * Run sequence tests on all identified tool pairs */ runAllSequenceTests(tools: Tool[], callTool: CallToolFunction, onProgress?: ProgressCallback): Promise>; /** * Get summary of sequence test results */ summarizeResults(results: Map): { total: number; vulnerable: number; safe: number; errors: number; vulnerablePairs: string[]; }; /** * Extract text content from MCP response */ private extractResponseText; } //# sourceMappingURL=CrossToolStateTester.d.ts.map