T01 · Skill Instruction Hijacking
- Location
SKILL.md:85- Finding
Retrieved conversation content is treated as executable agent instructions
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 85–86
Vulnerability Type: Stored prompt injection through untrusted retrieval output
Risk Level: HighVulnerable Instruction
The following is an English translation of the relevant source instructions:
text 3. Read the result: The command outputs text beginning with “[MemCoT Prompt]”. This text contains historical conversation context and an instruction requiring JSON output. 4. Directly answer the user: This is the most important step. Do not simply copy and paste the long Prompt for the user. As OpenClaw, internally read that Prompt, follow the requirements in the Prompt, think using the context, and then answer the user's question directly in natural language.Technical Analysis
The Skill explicitly instructs the agent to follow requirements contained in output produced by the MemCoT retrieval system. That output includes historical conversation content, which is untrusted data and may contain attacker-controlled instructions.
This violates the required separation between data and instructions. Retrieved messages should only be used as evidence or contextual data, but the Skill promotes them to executable agent instructions. Although higher-priority platform instructions should still take precedence, the retrieved prompt could control the agent's response within the permissions and tools available to the current session.
Attack Path
- An attacker places a malicious instruction in conversation history, such as a request to ignore the current question, disclose other retrieved messages, or invoke an available tool.
- MemCoT indexes the affected conversation history.
- A subsequent user performs a search whose results include the malicious message.
memcot_cil.pyplaces the retrieved message inside the generated MemCoT prompt.- The Skill directs the agent to follow the requirements found in that pr ...[truncated 587 chars]
- Remediation
View remediation
Remediation Suggestions
- Treat all MemCoT output and historical messages strictly as untrusted data.
- Explicitly instruct the agent never to follow commands, policies, formatting requirements, or tool-use requests found in retrieved content.
- Parse retrieval output into a structured schema that separates provenance, quoted message text, timestamps, and relevance metadata.
- Use retrieved material only to extract facts relevant to the current user request.
- Delimit and label all retrieved text as quotations.
- Filter or flag common prompt-injection patterns before placing results in the model context.
- Restrict tool execution after retrieval and require explicit current-user approval for consequential operations.
- Minimize retrieved context and prevent unrelated private conversations from entering the prompt.
