T09 · Insecure Skill Coding Practices
- Location
index.js:53- Finding
<![CDATA[Shell Command Injection Through User-Controlled CLI and API Arguments]]>
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This memory skill is mostly purpose-related, but it needs review because it can change agent startup behavior, save conversation content persistently, and run unbundled home-directory scripts through unsafe shell commands.
Install only if you want an agent memory system that can influence session startup and persist conversation-derived notes locally. Review the hook before enabling it, avoid unattended auto-save for sensitive chats, do not install the cron/OpenClaw scheduled jobs unless you accept recurring session checks, and verify or bundle the ~/clawd/scripts helper files before running the CLI.
index.js:53<![CDATA[Shell Command Injection Through User-Controlled CLI and API Arguments]]>
index.js:18<![CDATA[Execution of Unbundled and Mutable Code From the User Home Directory]]>
hooks/openclaw/handler.js:8<![CDATA[Persistent Agent Behavior Modification Through Bootstrap Instruction Injection]]>
INTEGRATION.md:158<![CDATA[Recurring Scheduled Execution and Automatic Conversation Persistence]]>
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).
解决:
rm ~/.clawd/.memory-trigger-state.json
# 重新开始计数
The skill is presented as a token-optimization memory layer, but analysis says it instead reads configuration and environment data without disclosing that capability. Undeclared environment/config access can expose sensitive values or expand the trust boundary beyond what a user expects from a memory utility.
The skill is presented as a token-optimization memory layer, but analysis says it instead reads configuration and environment data without disclosing that capability. Undeclared environment/config access can expose sensitive values or expand the trust boundary beyond what a user expects from a memory utility.
The skill is presented as a token-optimization memory layer, but analysis says it instead reads configuration and environment data without disclosing that capability. Undeclared environment/config access can expose sensitive values or expand the trust boundary beyond what a user expects from a memory utility.
The skill is presented as a token-optimization memory layer, but analysis says it instead reads configuration and environment data without disclosing that capability. Undeclared environment/config access can expose sensitive values or expand the trust boundary beyond what a user expects from a memory utility.
The code builds shell command strings with user-controlled values and executes them via execSync in generate, read, and search. Because inputs such as target, filePath, query, layer, concurrent, and configPath are interpolated into shell commands with incomplete escaping, an attacker can inject shell metacharacters and achieve arbitrary command execution under the user's account.
The guide documents behavior that goes beyond passive layered-memory management into autonomous session monitoring, token-usage checks, and automatic save orchestration. Expanding a memory skill into continuous observation and automated actions increases the skill's authority and data exposure surface, especially if users expect only file-layering functionality.
The documentation promotes automatic saving of conversation-derived memory and maintenance of state/history files without clearly warning about privacy, retention, or persistence implications. Users may unknowingly store sensitive session content, metadata, and identifiers on disk through background automation, creating confidentiality and compliance risks.
Inspecting active sessions and injecting bootstrap reminders is not clearly necessary for a layered-memory utility and implies access to live conversational context. That creates privacy and boundary risks because the skill can observe or influence sessions outside the narrow function users would reasonably infer from its name and description.
The document states that conversation history will be recorded and automatically saved with '无需任何操作,完全自动' but does not warn that potentially sensitive prompts, secrets, or personal data may be written to disk. This creates a real privacy risk because users may reasonably assume chat content is ephemeral, while the skill persistently stores it in the background.
The documented state file includes full conversation history, timestamps, and token metadata in ~/.clawd/.memory-trigger-state.json, yet the file description omits retention, access-control, and sensitivity warnings. Storing complete histories on disk materially increases exposure of credentials, private conversations, or proprietary data if the host is shared, backed up, or later compromised.
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.
# 每天凌晨 1 点自动维护
crontab -e
# 添加:
0 1 * * * cd ~/clawd/skills/layered-memory && node index.js maintain
The document recommends a background cron job that periodically inspects session state and may automatically save memory, but it does not clearly warn that this creates persistent storage, may capture sensitive conversation content, and introduces ongoing automated access to session data. In a memory-management skill, this is contextually relevant and likely well-intentioned, but the lack of explicit safety guidance makes accidental data retention or privacy-impacting deployment more likely.
The README instructs users to run generate and maintain commands that create or overwrite layered files, but it does not prominently warn that these operations modify the filesystem. In an agent-skill context, unclear write semantics can cause unintended file creation or replacement in memory directories, especially when run recursively or with --all/--force flags.
Without declared permissions the skill's intent is opaque and cannot be validated.
The manifest description and introductory content present the skill in Chinese only, which can impose a language-specific experience on users without opt-in. The policy specifically calls for flagging language or locale constraints unless the skill offers a language choice or clearly documents a justified regional limitation.
The entire upgrade plan is written in Chinese, including headings, implementation notes, and recommendations, with no indication that users may choose another language or that the skill is intentionally limited to a Chinese-speaking context. The policy requires flagging language or locale constraints when they are imposed without user opt-in or clear justification.
This JavaScript file contains user-facing natural-language content in Chinese in the header/commentary and later console output, indicating an assumed language choice rather than a user-selected one. The policy for this category applies to all file types and flags forcing a specific language without opt-in or justification.
The benchmark results are presented with Chinese-only explanatory messages, which imposes a specific language on users. There is no visible mechanism to select language or any justification that this tool is region-specific.
The file's natural-language interface text and command descriptions are presented only in Chinese, and the CLI help and status messages throughout the file likewise assume a fixed language. This can violate language/locale policy when no user opt-in or documented locale constraint is provided.
The manifest description focuses on managing layered memory files: generating layers, on-demand loading, and deduplication to reduce token usage. In addition to that, this file implements conversation-to-memory extraction and persistence, which is a broader capability for creating new memories from chat content rather than just managing existing layered memory files.
The tool can persist conversation-derived memories to disk through the --save path without any confirmation prompt, preview, or sensitivity check. If conversations contain secrets, personal data, or tokens, this creates an unintended data-retention and privacy risk, especially because the save is followed by automatic layer generation that further propagates the content.
Archiving old memories and producing monthly summaries are lifecycle/analytics features beyond the manifest's stated scope of three-layer memory management, token reduction, and deduplication. These behaviors materially extend the skill into retention management and summarization workflows not described in the manifest.
This manifest says the skill will 'Auto-save conversation memory when reaching thresholds' and binds it to the 'agent:bootstrap' event, but it does not define what thresholds are or when autosave will or will not occur. That ambiguity can cause unintended invocation or unexpected behavior because users and integrators cannot tell the precise activation scope from the manifest.
The test suite reaches outside the skill directory and inspects a script under the user's home directory (~/clawd/scripts/generate-layers-simple.js). That creates an unnecessary trust boundary violation: running the skill's tests depends on and reveals information about external local files unrelated to the packaged skill, and can fail or behave differently based on the user's environment. In the context of a layered-memory skill, this capability is not required for core functionality validation, so it increases risk rather than being justified by the skill's purpose.
Detected: suspicious.dangerous_exec