MCP07
- Location
index.ts:837- Finding
Private Memory Recall and Search Lack Conversation-Audience Authorization ## Remediation Suggestions 1. Introduce a common host-backed authorization function for automatic recall, search, and expansion. 2. Restrict owner-private memories to the matching authorized owner-private audience. Fail closed when the required audience identity cannot be established. 3. Partition memory storage and collections by trusted audience identity, or attach trusted audience metadata to each record and enforce server-side retrieval filters. 4. Apply the host’s sandbox, workspace-confinement, incognito, and session-visibility restrictions where relevant. Do not treat a shared workspace as authorization. 5. Recheck invocation and audience validity immediately before injecting context or returning tool results. 6. Add regression tests covering private-to-group disclosure, shared workspaces, missing audience metadata, and audience changes during asynchronous execution.
- Content
View full analysis
Vulnerability Details
File Location:
plugin/index.ts:837–856(automatic recall),plugin/index.ts:661–715(memory search), andplugin/index.ts:725–769(memory expansion). Corresponding handlers are present in the loaded entry point,plugin/index.js.Vulnerability Type: Missing authorization; sensitive conversation disclosure
Risk Level: HighVulnerable Code
Automatic recall reads workspace memory and prepends it to the current conversation without verifying its audience:
typescript api.on("before_prompt_build", async (_event: any, ctx: any) => { updateAgentContext(ctx); const promptProjectDir = projectDir; const promptMemoryDir = memoryDir; try { const context = getRecentMemories(promptMemoryDir); const skillHint = await getSkillCandidateHint(promptProjectDir); const blocks = [context, skillHint].filter(Boolean); if (blocks.length > 0) { return { prependContext: blocks.join("\n\n") }; } } catch (e: any) { logger?.warn?.( `[memsearch] Failed to inject memories: ${e.message}` ); } return {}; });The search execution path likewise returns results from the workspace collection without checking the current conversation audience:
typescript async execute( _toolCallId: string, params: { query: string; top_k?: number } ) { const topK = params.top_k || 5; try { const cmd = await getMemsearchCmd(); const collection = await getCollectionName(toolProjectDir); const result = await runCmd( [ "bash", "-c", `${cmd} search '${shellEscape(params.query)}' ` + `--top-k ${topK} --json-output --default-collection ${collection}`, ], { timeoutMs: 30000, cwd: toolProjectDir } ); const failure = commandFailure("Search", result); if (failure) { return { content: [{ type: "text" as const, text: failure }] }; } const output = result.stdout || result.stderr || "No results"; return { content: [{ type: "text ...[truncated 2425 chars]
