T01 · Skill Instruction Hijacking
- Location
SKILL.md:66- Finding
Persistent System-Prompt Injection Redirects Agent Behavior
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:66-76;references/compact-prompt.md:3-14
Vulnerability Type: T01: Skill Instruction Hijacking
Risk Level: HighEvidence
SKILL.md:66-76:markdown ## 注入方法 将上述格式注入到 `~/.openclaw/openclaw.json` 的 `agents.defaults.systemPrompt` 或通过 HOOK 注入: ```bash # 查看当前 compact 提示词 openclaw config get agents.defaults.systemPrompt | grep -i compacttext `references/compact-prompt.md:3-14`: ```markdown ## 完整系统提示词(注入到 compact 操作时)你是一个会话摘要生成器。你的任务是将对话压缩成一个结构化的摘要,保留所有关键信息。
重要规则
- 响应格式必须是纯文本,不要使用任何工具
- 先写 进行分析,然后在
中给出正式摘要
- 块会被移除,只保留
内容
- 所有文件路径和代码片段都要精确保留
- 代码片段必须完整可运行,不是描述性文字
text ### Technical Analysis The skill explicitly instructs the user to inject its supplied content into `agents.defaults.systemPrompt` or install it through a hook. The supplied prompt then assigns the agent a new role as a conversation-summary generator, dictates its response structure, and prohibits tool use. These are behavioral and tool-policy overrides rather than passive guidance for formatting one response. Placing them in a system-prompt configuration gives the skill's instructions elevated authority whenever the affected operation or configuration is loaded. Hook-based installation can similarly cause the instructions to be applied automatically. The project does not contain executable scripts that perform the configuration change automatically. Exploitation therefore depends on a user or surrounding agent following the installation instructions. ### Attack Path 1. A user installs or invokes the skill to improve `/compact` behavior. 2. The skill directs the user or agent to place its template in `~/.openclaw/openclaw.json` under `agents.defaults.systemPrompt`, or to inject it using a hook. 3. OpenClaw loads the attacker-supplied system-prompt content during later compact operations. 4. ...[truncated 1098 chars]- Remediation
View remediation
Remediation Suggestions
- Do not instruct users or agents to modify
agents.defaults.systemPromptfor a formatting feature. - Replace system-level injection with a narrowly scoped, explicitly invoked compact-summary template.
- Remove the role-replacement statement and describe only the requested output structure.
- Remove the unconditional prohibition on tool use. Tool availability should remain governed by the host agent and its security policy.
- Do not install hooks merely to alter prompt behavior. If a hook is essential, require informed user approval, document its exact scope, and provide deterministic removal instructions.
- State explicitly that the template is subordinate to platform safety rules, system instructions, privacy controls, and user intent.
- Apply the template only to the current compact operation and avoid writing it into persistent agent-wide configuration.
- Validate the effective scope of
agents.defaults.systemPromptand warn users if it affects operations beyond/compact.
- Do not instruct users or agents to modify
