T01 · Skill Instruction Hijacking
- Location
tools/compaction_manager.py:239- Finding
Untrusted conversation content is promoted to system-level authority during compaction
- Content
View full analysis
str: """生成消息摘要""" if not messages: return "无" # 提取关键信息 topics = [] for msg in messages: content = msg.get("content", "")[:200] # 每条取前200字符 if content: # 提取前几个字作为主题 first_line = content.split('\n')[0][:50] if first_line: topics.append(first_line) summary = f"讨论了 {len(messages)} 条消息,主题包括:{';'.join(topics[:5])}" if len(summary) > max_length: summary = summary[:max_length] + "..." return summary ``` ### Technical Analysis The compaction mechanism does not distinguish between trusted system instructions and untrusted user or tool-result content when generating its summary. `_summarize_messages()` copies the first line of each old message, including user-controlled messages, into `older_summary`. `auto_compact()` then assigns that summary both `"type": "system"` and `"role": "system"`. This crosses a fundamental instruction trust boundary: text originally supplied at user authority can reappear in a system-authority message. The summary algorithm is extra ...[truncated 1760 chars]- Remediation
View remediation
