T02 · Agent Memory Poisoning
- Location
server.py:105- Finding
Persistent Agent memory poisoning through unsanitized source text
- Content
View full analysis
Dict: """提取关键信息""" info = { "identity": [], "goals": [], "relationships": [], "decisions": [], "skills": [] } lines = content.split('\n') current_section = None for line in lines: line = line.strip() # 识别身份相关信息 if any(kw in line.lower() for kw in ['合伙人', '助理', '身份', '角色', '我是']): if len(line) < 200: info["identity"].append(line) # 识别目标 if any(kw in line.lower() for kw in ['目标', '计划', 'todo', '待办', '方向']): if len(line) < 150 and not line.startswith('#'): info["goals"].append(line.lstrip('- ').lstrip('* ')) # 识别人物关系 if any(kw in line.lower() for kw in ['用户', '合伙人', '客户', 'name', '称呼']): if len(line) < 200: info["relationships"].append(line) # 识别重要决策 if any(kw in line.lower() for kw in ['决策', '决定', '确立', '选择', '方向']): if len(line) > 20 and len(line) < 300: info["decisions"].append(line) # 识别技能 if any(kw in line.lower() for kw in ['skill', '技能', '工具', '发布']): if 'binance' in line.lower() or '监控' in line or 'openclaw' in line.lower(): info["skills"].append(line.lstrip('- ').lstrip('* ')) return info ``` ```python @app.call_tool() def generate_l0_soul(arguments: dict) -> List[TextContent]: """生成 L0 灵魂摘要层 (100 token)""" try: memories = read_memory_files() # 提取关键信息 all_info = { "identity": [], "goals": [], "relationships": [], "skills": [] } for mem in memories: info = ext ...[truncated 3439 chars]- Remediation
View remediation
