MCP06
- Location
plugin/dist/services/context-lifecycle-service.js:277- Finding
Remote Memory Content Is Promoted into System Context ## Remediation Suggestions 1. Keep profiles and retrieved memories in explicitly untrusted data or tool-result messages rather than system instructions. 2. Establish a higher-priority policy stating that retrieved content cannot change permissions, authorize actions, request secret disclosure, or override current user instructions. 3. Preserve writer identity and provenance, and isolate shared contributions from private profiles and privileged operational rules. 4. Encode structural delimiters as defense in depth. Do not treat escaping as sufficient protection against semantic prompt injection. 5. Require independent, host-enforced authorization for sensitive tool actions. 6. Add regression tests containing instruction-bearing profiles, forged closing tags, and poisoned shared memories. Verify that they cannot authorize tool calls or change the instruction hierarchy.
- Content
View full analysis
Vulnerability Details
File Location:
plugin/dist/services/context-lifecycle-service.js:217–237— remote profile retrieval and wrapping.plugin/dist/services/context-lifecycle-service.js:277–303— profile and recall insertion into system context.plugin/dist/auto-recall.js:123–132— recall-content wrapper.
Vulnerability Type: Indirect prompt injection through persistent memory
Risk Level: HighVulnerable Code
Remote profile content is inserted without escaping or an instruction-versus-data boundary:
js const text = read.status === "fulfilled" && typeof read.value === "string" ? read.value.trim() : ""; if (!text) return ""; const capped = text.length > PROFILE_MAX_CHARS ? `${text.slice(0, PROFILE_MAX_CHARS).trimEnd()}\n... [profile truncated]` : text; return `<user-profile uri="${uris[i]}">\n${capped}\n</user-profile>`;The assembly path promotes profile and recall blocks into system context:
js const baseTokens = estimateTextTokens(assembled.systemPromptAddition ?? ""); for (const blocks of [[profileBlock, recallBlock], [profileBlock], [recallBlock]]) { if (!blocks.some(Boolean)) continue; const systemPromptAddition = [assembled.systemPromptAddition, ...blocks].filter(Boolean).join("\n\n"); const estimatedTokens = assembled.estimatedTokens + estimateTextTokens(systemPromptAddition) - baseTokens; if (estimatedTokens <= params.tokenBudget) return { ...assembled, systemPromptAddition, estimatedTokens }; }The recall wrapper likewise includes supplied content directly:
js export function buildRecallContextBlock(memoryLines) { return [ "<relevant-memories>", AUTO_RECALL_SOURCE_MARKER, "The following OpenViking memories may be relevant:", ...memoryLines, "</relevant-memories>", ].join("\n"); }Technical Analysis
Profiles and recalled memories originate from the configured OpenViking service. Their contents may refl ...[truncated 2097 chars]
