T09 · Insecure Skill Coding Practices
- Location
scripts/apply-dynamic-agent-patch.sh:217- Finding
Concurrent non-atomic updates can corrupt or overwrite the OpenClaw configuration
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill is a coherent DingTalk agent-isolation tool, but its dynamic mode can automatically and unsafely make persistent local configuration and filesystem changes.
Review before installing or using dynamic mode. Prefer manual bindings for known users. If dynamic mode is needed, add strict ID validation, constrain all workspace and agent paths under approved OpenClaw directories, use a locked and atomic config mutation API, set maxAgents, keep backups, and avoid running the patch or generated shell commands with elevated privileges or untrusted input.
scripts/apply-dynamic-agent-patch.sh:217Concurrent non-atomic updates can corrupt or overwrite the OpenClaw configuration
scripts/apply-dynamic-agent-patch.sh:102Unvalidated dynamic identifiers and templates can escape intended workspace directories
scripts/generate-agent-config.js:69Unquoted generated setup commands allow shell command injection
scripts/apply-dynamic-agent-patch.sh:314Connector paths are unsafely embedded into Python source code
The description claims an operational isolation feature: creating independent Agent workspaces, memory, and chat history for each DingTalk user, supporting manual binding and dynamic creation. However, this code chunk only verifies whether such a setup may already exist. It does not create agents, bind users, provision workspaces, alter memory/session handling, or dynamically generate anything. Its primary purpose is auditing/validation of configuration and runtime state. The local file and directory checks are consistent with a verifier, but that is materially different from the declared feature implementation. Therefore this is a clear description-behavior mismatch.
The command rm -rf ~/.openclaw/workspace-dingtalk-userA is destructive and lacks surrounding safety guidance. In context, this is not an exploit primitive for an attacker by itself, but it is a true hazardous instruction that could lead to accidental denial of service or data loss for a user's isolated workspace.
1. 从 `openclaw.json` 的 `agents.list` 中移除对应条目
2. 从 `bindings` 中移除对应的 binding
3. 删除工作空间目录: `rm -rf ~/.openclaw/workspace-dingtalk-userA`
4. 删除 Agent 目录: `rm -rf ~/.openclaw/agents/dingtalk-userA`
5. 重启 OpenClaw
The command rm -rf ~/.openclaw/workspace-dingtalk-userA is destructive and lacks surrounding safety guidance. In context, this is not an exploit primitive for an attacker by itself, but it is a true hazardous instruction that could lead to accidental denial of service or data loss for a user's isolated workspace.
1. 从 `openclaw.json` 的 `agents.list` 中移除对应条目
2. 从 `bindings` 中移除对应的 binding
3. 删除工作空间目录: `rm -rf ~/.openclaw/workspace-dingtalk-userA`
4. 删除 Agent 目录: `rm -rf ~/.openclaw/agents/dingtalk-userA`
5. 重启 OpenClaw
The command rm -rf ~/.openclaw/workspace-dingtalk-userA is destructive and lacks surrounding safety guidance. In context, this is not an exploit primitive for an attacker by itself, but it is a true hazardous instruction that could lead to accidental denial of service or data loss for a user's isolated workspace.
1. 从 `openclaw.json` 的 `agents.list` 中移除对应条目
2. 从 `bindings` 中移除对应的 binding
3. 删除工作空间目录: `rm -rf ~/.openclaw/workspace-dingtalk-userA`
4. 删除 Agent 目录: `rm -rf ~/.openclaw/agents/dingtalk-userA`
5. 重启 OpenClaw
The command rm -rf ~/.openclaw/agents/dingtalk-userA can erase an agent's configuration and memory permanently. Because the skill is an administrative guide, such instructions are more dangerous than ordinary prose: readers may execute them directly during troubleshooting without appreciating the irreversibility.
1. 从 `openclaw.json` 的 `agents.list` 中移除对应条目
2. 从 `bindings` 中移除对应的 binding
3. 删除工作空间目录: `rm -rf ~/.openclaw/workspace-dingtalk-userA`
4. 删除 Agent 目录: `rm -rf ~/.openclaw/agents/dingtalk-userA`
5. 重启 OpenClaw
### Q5: 动态创建的 Agent 会共享公共技能吗?
The command rm -rf ~/.openclaw/agents/dingtalk-userA can erase an agent's configuration and memory permanently. Because the skill is an administrative guide, such instructions are more dangerous than ordinary prose: readers may execute them directly during troubleshooting without appreciating the irreversibility.
1. 从 `openclaw.json` 的 `agents.list` 中移除对应条目
2. 从 `bindings` 中移除对应的 binding
3. 删除工作空间目录: `rm -rf ~/.openclaw/workspace-dingtalk-userA`
4. 删除 Agent 目录: `rm -rf ~/.openclaw/agents/dingtalk-userA`
5. 重启 OpenClaw
### Q5: 动态创建的 Agent 会共享公共技能吗?
The command rm -rf ~/.openclaw/agents/dingtalk-userA can erase an agent's configuration and memory permanently. Because the skill is an administrative guide, such instructions are more dangerous than ordinary prose: readers may execute them directly during troubleshooting without appreciating the irreversibility.
1. 从 `openclaw.json` 的 `agents.list` 中移除对应条目
2. 从 `bindings` 中移除对应的 binding
3. 删除工作空间目录: `rm -rf ~/.openclaw/workspace-dingtalk-userA`
4. 删除 Agent 目录: `rm -rf ~/.openclaw/agents/dingtalk-userA`
5. 重启 OpenClaw
### Q5: 动态创建的 Agent 会共享公共技能吗?
Without declared permissions the skill's intent is opaque and cannot be validated.
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.
# 为每个用户创建工作空间和 Agent 目录
mkdir -p ~/.openclaw/workspace-dingtalk-userA
mkdir -p ~/.openclaw/agents/dingtalk-userA/agent
mkdir -p ~/.openclaw/workspace-dingtalk-userB
mkdir -p ~/.openclaw/agents/dingtalk-userB/agent
Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.
# 应输出: N(原有 + 新增的用户 Agent 数量)
# 2. 检查工作空间目录是否创建
ls -la ~/.openclaw/workspace-dingtalk-*/
# 应看到每个用户的独立目录
# 3. 检查 Agent 目录
Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.
# 应输出: N(原有 + 新增的用户 Agent 数量)
# 2. 检查工作空间目录是否创建
ls -la ~/.openclaw/workspace-dingtalk-*/
# 应看到每个用户的独立目录
# 3. 检查 Agent 目录
The skill recommends destructive rm -rf deletion of workspace and agent directories without any caution about validating the path, taking backups, or avoiding variable expansion mistakes. In an operational skill that encourages filesystem manipulation under a user's home directory, insufficient safeguards increase the chance of accidental data loss.
The patch automatically creates directories and rewrites the main OpenClaw configuration file on first direct message, without any explicit user confirmation, dry-run, or admin approval step. In this skill context, the behavior is intentional for per-user agent isolation, but it still creates operational and security risk because untrusted or unexpected inbound messages can trigger persistent filesystem and config changes, and the implementation explicitly notes it lacks the locking/safe mutation mechanism used by the Feishu version.
The file is written as a skill/reference document entirely in Chinese and does not provide any language choice, opt-in, or justification for restricting content to this locale. Under the policy for natural-language violations, forcing a specific language without user opt-in is in scope.
This shell script writes a new source file and later rewrites multiple existing files in the target connector directory, which can change installed code behavior. Although it logs what it is doing, there is no user confirmation or explicit warning before these potentially disruptive file modifications begin.
The generated TypeScript patch writes directly to the main OpenClaw configuration file at runtime based on incoming DingTalk user identifiers, creating agents and bindings automatically. This is dangerous because remote interaction can trigger persistent local configuration changes, and the write path lacks explicit locking, user approval, or strong validation of concurrent modifications, which can lead to config corruption or unauthorized persistence growth.
The file's user-facing natural-language content, including comments, usage text, errors, and operational instructions, is entirely in Chinese. Under the stated policy, forcing a specific language without user opt-in is a locale/language policy violation.
The help text shown for --help is hardcoded in Chinese, and later runtime messages are also Chinese-only. This imposes a fixed language on users rather than offering a choice or documenting a justified locale restriction.
The validation error, status message, and step-by-step operation guidance are all emitted only in Chinese. Because the file does not offer a language selection mechanism or justify a Chinese-only scope, this violates the language/locale policy criteria.
This shell script presents its description, status messages, and results in Chinese throughout, which constitutes a natural-language locale constraint. Because the file does not offer user opt-in or indicate that the skill is intentionally limited to Chinese-speaking users or a China-specific compliance context, it violates the language/locale policy criterion.
The script's user-facing descriptive text and usage guidance are presented in Chinese only, which can impose a language choice on users without opt-in. The policy asks to flag language constraints unless the skill offers a choice or clearly justifies the locale restriction.
This code performs a file write when --output is provided via fs.writeFileSync(opts.output, ...). Although it logs after the write completes, there is no pre-write confirmation, warning comment, or user-facing disclosure that an existing file may be overwritten.