T09 · Insecure Skill Coding Practices
- Location
scripts/backup.mjs:45- Finding
Unvalidated backup names allow writes outside the backup directory
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a coherent local backup skill, but it needs Review because its restore and backup scripts can escape intended paths and may overwrite or expose local files.
Install only if you are comfortable with a local tool that reads and rewrites sensitive OpenClaw workspace files. Do not restore from untrusted or manually edited backups, avoid path separators in --name, --timestamp, or --file values, run validation and a dry run before restore, keep backups private, and avoid enabling the cron retention example until its deletion command is fixed.
scripts/backup.mjs:45Unvalidated backup names allow writes outside the backup directory
scripts/restore.mjs:34Restore arguments permit path traversal and restoration occurs without mandatory integrity verification
examples/automated-backup.sh:14Retention command can recursively delete the entire backup repository
scripts/backup.mjs:14Sanitization can preserve secrets stored beneath sensitive object or array fields
The manual emergency recovery example uses a recursive copy into the workspace root without warning that existing files may be overwritten. Because this bypasses any safeguards the scripts may provide, a user can unintentionally replace multiple files at once and lose the current workspace state.
The report endorses a one-click installation model using curl | bash, which executes remotely fetched code immediately without requiring inspection, integrity verification, or trusted packaging. If the hosting source, transport, DNS, repository, or update path is compromised, users could run attacker-controlled code with their local privileges.
**为什么不"直接复用现有方案":**
1. **架构不匹配:** 大多数工具假设打包 .app bundle,ClawLite 是 Node.js CLI 工具
2. **依赖地狱:** 采用 electron-builder 会增加 200+ 依赖
3. **用户体验差距:** ClawLite 的 "one-click install" (`curl | bash`) 与 DMG 下载流程不同
4. **维护负担:** 继承复杂安装框架意味着调试他人代码、跟踪上游破坏性更改
**为什么"维护自定义安装流程"更优:**
This passage explicitly promotes curl | bash as the preferred installation method because it is simpler and faster, normalizing execution of unaudited remote code. That pattern materially increases supply-chain risk and reduces the chance that users verify provenance or script contents before execution.
**为什么"维护自定义安装流程"更优:**
1. **控制:** ClawLite 安装脚本可随产品需求演进
2. **简单:** 当前 `curl | bash` 方法 50 行 shell 脚本,DMG 方法需 500+ 行
3. **速度:** Shell 脚本 5 分钟安装,DMG 下载 + 挂载 + 拖拽 + 首次运行需 10-15 分钟
4. **成本:** Shell 脚本无需公证费用 ($99/年 Apple Developer Program)
Here the document recommends keeping curl | bash as the primary distribution channel, making the insecure pattern central to the delivery model rather than an incidental mention. In skill context, installation guidance directly influences operator behavior, so this increases the likelihood of unsafe execution and supply-chain compromise.
4. **成本:** Shell 脚本无需公证费用 ($99/年 Apple Developer Program)
**推荐混合方法:**
- **主要分发:** 保持 `curl | bash` (开发者和 CLI 用户)
- **次要分发 (未来):** 添加 Homebrew formula (可发现性和信任)
- **第三分发 (如果添加 GUI):** 使用 `create-dmg` 打包未来 Electron 仪表板
This line reinforces the plan to launch first with curl | bash, which perpetuates unsafe installation guidance even if framed as iterative product strategy. Repetition in release and risk sections makes the insecure practice more likely to be adopted operationally.
### P1 风险
- **过早采用复杂安装框架:** 推荐混合方法避免过度工程化
- **忽略用户反馈:** 先发布 `curl | bash`,根据反馈迭代
---
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).
tup
# Add to crontab: crontab -e
0 2 * * * cd /Users/m1/.openclaw/workspace-hunter/soul-backup-skill && node scripts/backup.mjs --name "daily-$(date +\%Y-\%m-\%d)"
# Before deploying changes
cd soul-backup-skill
node scripts/backup.mjs --name "pre-deploy-$(git rev-parse --short HEAD)"
# Add to crontab
0 3 * * 0 cd /Users/m1/.openclaw/workspace-hunter/soul-backup-skill && node scripts/validate.mjs
Mitigation:
Likelihood: Negligible (2^256 space) Mitigation: None required (cryptographically secure)
Mitigation:
--dry-run firstSkill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.
- Backup may be corrupted — use previous backup
**"Restore failed: file conflicts"**
- Use `--force` flag to overwrite existing files
- Or manually move conflicting files before restore
## Future Enhancements
The README quick-start presents node scripts/restore.mjs as a simple default action without an adjacent warning that restore overwrites existing workspace files. In the context of a backup/restore skill for agent workspace state, this can lead users to unintentionally replace current configuration or identity files, causing data loss or rollback to stale state.
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.
Create a daily backup at 2 AM with automatic naming:
# Add to crontab: crontab -e
The restore examples instruct users to run restore commands without explicitly warning that they will overwrite current workspace files. In a backup/restore skill, destructive overwrite behavior is expected, but omitting a clear warning increases the chance of accidental data loss or rollback of newer work.
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.
CLI commands:
clawlite backup # Create timestamped backup
clawlite backup --name "pre-migration" # Named backup
clawlite restore # Restore latest
clawlite restore --name "pre-migration" # Restore named
The manual recovery instructions use a recursive copy into the workspace root, which can overwrite current files without an explicit warning, confirmation step, or safer example. In a backup/restore skill, destructive restore guidance is security-relevant because it can cause integrity loss or accidental rollback of trusted workspace content.
The restore examples show commands that will overwrite workspace SOUL files, but the examples do not clearly warn the user at the point of use that restoration is destructive. In a backup/restore skill, users are likely to copy-paste commands from the quick start, so missing overwrite warnings can lead to accidental data loss or rollback of newer configuration and identity files.
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.
chmod +x scripts/*.mjs
### Create Your First Backup
```bash
node scripts/backup.mjs
The README documents restore procedures that overwrite workspace SOUL files and even instruct copying a sanitized config back into ~/.openclaw/openclaw.json, but it does not prominently warn that these actions can replace current state and cause irreversible loss of newer edits if used incorrectly. In a backup/restore skill, destructive overwrite is expected functionality, yet the lack of explicit confirmation, backup-before-restore warning, and recovery caveats increases the chance of accidental data loss or unsafe operator behavior.
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.
# Create new repository on GitHub
# Repository name: soul-backup
# Description: One-click backup and restore for OpenClaw workspace SOUL files
# License: MIT
This markdown runbook instructs users to run restore commands that can overwrite workspace files, but the section does not explicitly warn that restoring may replace current data or should only be done after confirming the target state. Although dry-run is shown as an option elsewhere, the primary restore reference presents destructive commands without a direct warning in that section.
The standard recovery workflow instructs users to run the restore command after a dry run, but it does not clearly warn that applying the restore will modify or replace current workspace files. Because these files define agent behavior and configuration, an uninformed restore can unintentionally revert legitimate changes or destroy current state, especially in a shared or actively modified workspace.
The emergency recovery instructions tell the user to copy all files from a backup directly into the workspace with cp -r .../* ., which can overwrite existing files indiscriminately. In a backup/restore skill this behavior is expected, but the lack of an explicit overwrite warning, file-by-file preview, or safer restore guidance increases the chance of destructive operator error and accidental loss of newer workspace state.
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.
#!/bin/bash
# Automated daily backup via cron
# Add to crontab: crontab -e
# 0 2 * * * /path/to/automated-backup.sh >> /tmp/soul-backup.log 2>&1
SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
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.
#!/bin/bash
# Automated daily backup via cron
# Add to crontab: crontab -e
# 0 2 * * * /path/to/automated-backup.sh >> /tmp/soul-backup.log 2>&1
SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
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.
#!/bin/bash
# Automated daily backup via cron
# Add to crontab: crontab -e
# 0 2 * * * /path/to/automated-backup.sh >> /tmp/soul-backup.log 2>&1
SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
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.
#!/bin/bash
# Automated daily backup via cron
# Add to crontab: crontab -e
# 0 2 * * * /path/to/automated-backup.sh >> /tmp/soul-backup.log 2>&1
SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
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.
#!/bin/bash
# Automated daily backup via cron
# Add to crontab: crontab -e
# 0 2 * * * /path/to/automated-backup.sh >> /tmp/soul-backup.log 2>&1
SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
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.
#!/bin/bash
# Automated daily backup via cron
# Add to crontab: crontab -e
# 0 2 * * * /path/to/automated-backup.sh >> /tmp/soul-backup.log 2>&1
SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"