MCP06
- Location
dist/services/context-lifecycle-service.js:290- Finding
Untrusted recalled memory is inserted into system-prompt additions ## Remediation Suggestions 1. **Separate retrieved data from authoritative instructions.** Use a host-supported untrusted-content mechanism or a clearly identified data/tool-result channel instead of concatenating retrieved text into system-prompt additions. 2. **Enforce instruction precedence explicitly.** Trusted instructions should state that recalled memories, profiles, and resources are reference data: they cannot override system or developer instructions, authorize external actions, or establish user consent. 3. **Use structured serialization.** Preserve provenance separately from content and escape structural delimiters. Delimiter escaping is defense in depth, not a complete prompt-injection defense. 4. **Protect persistent sources.** Enforce authenticated write permissions, source ownership, and appropriate sharing boundaries for memories and profiles. Track provenance so suspicious content can be investigated and removed. 5. **Authorize sensitive actions independently.** Require host-enforced policy checks or explicit approval for credential access, filesystem uploads, destructive operations, and external communications. Retrieved instructions must never constitute authorization. 6. **Add adversarial regression tests.** Test instruction-bearing memories, forged closing tags, impersonated high-priority messages, and persistent poisoned profiles. Verify that sensitive actions remain blocked even when the model follows injected text.
- Content
View full analysis
Vulnerability Details
File Location:
plugin/dist/services/context-lifecycle-service.js:290–293— promotes retrieved content into a system-prompt addition.plugin/dist/auto-recall.js:123–131— wraps retrieved content without establishing an untrusted-data boundary.
Vulnerability Type: Indirect prompt injection / retrieved-content trust-boundary violation
Risk Level: MediumVulnerable Code
plugin/dist/auto-recall.js:123–131:js export function buildRecallContextBlock(memoryLines) { return [ "<relevant-memories>", AUTO_RECALL_SOURCE_MARKER, "The following OpenViking memories may be relevant:", ...memoryLines, "</relevant-memories>", ].join("\n"); }plugin/dist/services/context-lifecycle-service.js:290–293:js 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 };Technical Analysis
The automatic recall flow obtains content from the configured OpenViking service through
client.searchContext. It selects the returned content and passes it tobuildRecallContextBlock, which interpolates that content verbatim.The wrapper describes the material as relevant memories but does not explicitly prohibit treating embedded instructions as authoritative. It also preserves embedded delimiters and instruction-like text. During context assembly, the resulting recall block is concatenated into
systemPromptAdditionrather than kept in an explicitly untrusted data channel.This creates an instruction/data trust-boundary violation: attacker-influenced retrieval content can reach a system-prompt addition. An attacker does not need to escape the wrapper to attempt instruction injection; preserving embedded closing tag ...[truncated 2187 chars]
