Back to skill

Security audit

Multi-Agent Memory Optimizer

Security checks for vulnerabilities and agentic risk

Overview

The skill matches its memory-management purpose, but review is needed because private memory can be published without the documented confirmation and unsafe path and shell handling could affect files outside the intended scope.

Install only after reviewing or patching the implementation. Set upload.require_upload_confirm to true, validate agent IDs and titles before any file operation, replace the os.system test-workflow call with a direct function call or shell-free subprocess, and use dry-run or confirmation for cleanup before trusting it with real private memory.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
memory_optimizer.py:274
Finding

Shell Command Injection Through the test-workflow Agent Identifier

Content
View full analysis
/tmp/injected-proof' ``` 3. The resulting shell command is equivalent to: ```bash ./memory_optimizer.py init --agent test; id > /tmp/injected-proof ``` 4. The injected command runs with the operating-system privileges of the user or service executing the Skill. ### Impact Assessment Successful exploitation provides arbitrary local command execution under the Skill process account. An attacker could read or modify files accessible to that account, alter OpenClaw data, install user-level persistence, access environment-based secrets, or execute additional local payloads. The vulnerability does not independently elevate privileges to root, but its scope equals all permissions already granted to the OpenClaw or Skill runtime account. ]]>
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
memory_optimizer.py:44
Finding

Path Traversal Through Unvalidated Agent Identifiers and Upload Titles

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
config/default.json:15
Finding

Public Upload Confirmation Is Disabled Despite Documented Privacy Guarantees

Content
View full analysis
500 else '')) response = input("确认上传?(y/N): ").strip().lower() approved = response == 'y' else: approved = True ``` Documentation states that confirmation is enabled by default and describes the public space as containing only actively shared content. A duplicate setting also exists under `memory.require_upload_confirm`, but `MemoryUploader` does not read it. ### Technical Analysis The security-sensitive effective setting is `upload.require_upload_confirm`, and its default value is `false`. Therefore, any invocation of the `upload` command immediately copies a private medium-term summary into the cross-Agent public directory without an interactive preview or approval step. This contradicts the documented default and creates a dangerous expectation mismatch. A user or orchestrating Agent may reasonably believe the command will request confirmation before disclosure. The `upload.auto_publish` value does not prevent this behavior because the uploader does not consult it when deciding whether to publish ...[truncated 1301 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (29)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The code clearly supports part of the declared description: it understands a dual-layer memory structure with private and public spaces and analyzes data across agents. However, the prominent declared capabilities '自动生成每日总结' and '跨Agent知识检索' are not present here. Instead, the implementation only scans markdown files under configured directories, estimates entry counts from headings, tracks date ranges and per-agent stats, computes a health score, and emits suggestions. That is a materially narrower and different behavior than a full memory management system with automatic summarization and retrieval. No suspicious extra permissions or unrelated triggers are present, but the declared description overstates what this code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description presents a knowledge-base and memory-management system for multiple agents, including specialized features like dual memory spaces, daily summaries, and cross-agent retrieval. The supplied code does not implement any of those behaviors. It only provides generic configuration handling for JSON files, including loading, saving, and nested key access. This is a materially different primary purpose rather than a supporting detail of the declared functionality, so it is a clear mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

声明描述的是一个面向多Agent协作的完整记忆/知识库系统,重点能力包括双层记忆空间、每日总结和跨Agent检索。而代码片段只做了 memory_search 参数优化:估算上下文 token 使用量,调整最小分数和最大结果数,并返回静态改进指标。它没有实现记忆存储、公共/私有空间隔离、总结生成、跨Agent检索或协作知识库功能。因此代码的实际主用途与声明存在明显不符,属于材料性描述不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

该代码块的主要行为是只读检索:扫描公共/私有目录中的 Markdown 文件,提取 YAML 元数据,计算相关性,返回搜索结果与片段。这与声明中的“跨Agent知识检索”以及“私有+公共双层记忆空间”部分基本一致,因为代码确实区分并搜索公共与私有空间。但声明还包含“自动生成每日总结”,而代码中没有任何总结生成、定时任务、汇总写入或摘要逻辑。此外,“记忆管理系统”通常暗示除检索外还包括创建、更新、整理或维护记忆内容,而此代码仅实现检索引擎。因此描述比实际代码覆盖范围更大,存在功能性不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
86% confidence
Finding

The declared description presents a broader multi-agent memory management system with dual private/public memory spaces and cross-agent knowledge retrieval. The supplied code chunk only covers one component: generating a dated summary for a specified agent by reading MEMORY.md and memory/YYYY-MM-DD.md under a workspace, extracting heuristic categories, and saving the result under a private agent directory. It does support automatic summary generation in a limited sense, but there is no implementation here for a public memory layer, collaborative/open knowledge-base behavior, or cross-agent retrieval. Therefore the description materially overstates what this code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared description presents a broad multi-agent memory management and collaborative knowledge-base solution. However, the supplied code only performs local memory file enumeration and heuristic tier classification using modification time and file size. It reads markdown files from a single local memory directory and returns counts plus an estimated freed-space metric. There is no evidence of agent-aware separation, public/private memory handling, summary generation, retrieval across agents, or collaboration features. This is a material purpose mismatch, not merely an implementation detail.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
89% confidence
Finding

描述宣称的是一个较完整的多Agent记忆管理/知识库方案,包含双层记忆空间、自动每日总结和跨Agent检索等能力。但提供的代码片段只覆盖上传流程:从私有 medium-term 目录读取 markdown,总结内容格式化后保存到公共目录,并可备份到私有 long-term。它确实与“私有+公共双层记忆空间”中的一部分有关,但没有实现或展示自动生成总结、知识检索等关键能力。因此该代码片段与声明描述存在明显不一致,属于能力范围被夸大/描述过宽。

Content

No source excerpt is available for this finding.

os.system() or os exec-family call

High
Category
Dangerous Code Execution
Confidence
95% confidence
Finding

The code invokes a shell via os.system() and interpolates the user-controlled agent_id directly into the command string. If an attacker supplies shell metacharacters in --agent, this can lead to arbitrary command execution in the context of the running process. In this memory-management skill, shell execution is not essential to core functionality, which makes the risk less justified and more dangerous.

Content

Scanner excerpt · memory_optimizer.py (reported line 280)May include surrounding context.

python
# 1. 初始化
    print("【1】初始化空间...")
    os.system(f'./memory_optimizer.py init --agent {agent_id}')

    # 2. 生成中期总结(使用模拟数据)
    print("\n【2】生成中期总结...")

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · README.md (reported line 107)May include surrounding context.

使用 Crontab(推荐)

编辑 crontab -e,添加:

bash
# 每天 23:00 为所有 Agent 自动生成中期总结

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill documentation advertises commands that initialize state, write summaries, upload content, and invoke shell-based operational workflows, but it does not declare any explicit tool scope such as allowed-tools or permissions. That creates an authorization ambiguity: an agent runtime may grant broader file and shell capabilities than users expect, increasing the chance of unintended file modification or command execution.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest description and the surrounding SKILL content are written entirely in Chinese, which imposes a specific language context without any opt-in or alternative locale guidance. Under the policy rule, a language constraint should be optional or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The configured summary template is entirely in Chinese, which implies generated summaries will default to a specific language/locale. This is a natural-language policy concern because the file does not offer user opt-in or any documented reason for enforcing Chinese output.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The module description is written entirely in Chinese ("记忆分析器(增强版)- 扫描公共+私有双层记忆系统"), which indicates a fixed language presentation without offering any user choice or documenting a justified locale constraint. The policy for this audit flags language-forcing behavior when a skill does not provide opt-in or alternatives.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The module docstring and method docstrings/comments are written in Chinese, which imposes a specific language in the skill's natural-language interface and developer-facing instructions. There is no indication that this skill is region-specific or that users can opt into another language, so it may violate language/locale policy requirements.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The top-level docstring explicitly states '搜索公共记忆空间(跨Agent知识检索)', which conveys public-space-only behavior. In contrast, lines L079-L124 and L126-L172 implement private-memory searching and mixed-scope retrieval, directly contradicting the documented intent.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module docstring describes this file as a public-memory retrieval engine for cross-agent search. However, the code also exposes search_private and search_all, which read per-agent private memory directories and merge those results with public results, expanding the behavior beyond the stated module purpose.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The summarizer reads MEMORY.md and dated memory files that likely contain user conversation or agent memory data, but the code provides no visible disclosure that such private content will be accessed. The behavior is described only in internal comments/docstrings, which are not user-facing warnings.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This code creates directories and writes a generated summary file under the user's workspace, which affects user data on disk. Although the method has an internal docstring, there is no confirmation prompt, logging, print statement, or other user-facing disclosure indicating that persistent files will be created or overwritten.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The module docstring and method docstring are written entirely in Chinese, with no indication that language choice is optional or that the skill is region-specific. This creates a natural-language locale policy concern because the skill effectively constrains operator-facing documentation to a specific language without opt-in.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code uploads content from a private memory area into a public space and the default confirmation flow only asks '确认上传?' after showing a content preview, without an explicit privacy warning or a clear statement that sensitive/private data may become broadly accessible. In this skill’s context, the feature is specifically designed to move agent memory across private/public boundaries, so weak consent UX materially increases the risk of accidental data disclosure.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

User-facing natural-language strings throughout the file, including the module description and CLI help/output, are presented only in Chinese with no language choice or opt-in. This can violate language/locale policy when a skill implicitly mandates a specific language for all users.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The clean action permanently deletes memory files based on age without confirmation, dry-run support, backup, or recycle behavior. This creates a real integrity/availability risk: an accidental invocation, misconfigured retention period, or unexpected workspace path could destroy user data with no recovery path.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The workflow test command includes shell-execution capability that expands the attack surface beyond the stated purpose of memory management. Even if intended only for convenience, embedding command execution into the skill encourages unsafe invocation patterns and compounds the command-injection risk already present at this line.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The primary description and documentation are presented in Chinese and the skill path suggests a Chinese-specific distribution, but the file does not explicitly state that the skill is region- or language-specific or provide an opt-in language choice. Under the policy rule, forcing a specific language without user choice can be a locale-policy issue unless clearly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module docstring is written only in Chinese ("配置管理模块"), which imposes a language choice in natural-language content without offering alternatives or user opt-in. The same pattern continues in method docstrings, indicating a skill-level locale preference rather than a region-specific requirement.

Content

No source excerpt is available for this finding.