T09 · Insecure Skill Coding Practices
- Location
scripts/backup_encrypted.sh:8- Finding
Predictable and Insufficiently Protected Temporary Backup Storage
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This backup skill matches its stated purpose, but its scripts and guidance handle sensitive OpenClaw data unsafely enough that users should review it before installing.
Treat this as a Review install. Only use it after hardening the scripts: create private random temp directories, keep plaintext archives inside protected temp storage with cleanup traps, avoid passing backup passwords through command-line arguments or long-lived environment variables, validate and show cron entries before installing them, and do not follow the documented chmod -R 755 or live-directory deletion examples.
scripts/backup_encrypted.sh:8Predictable and Insufficiently Protected Temporary Backup Storage
scripts/backup_encrypted.sh:70Backup Password Exposed Through OpenSSL Process Arguments
scripts/setup_cron.sh:6Persistent Cron Command Injection Through Unvalidated Schedule and Script Values
scripts/backup_encrypted.sh:63Failure Paths Leave Plaintext Backups Behind and May Keep the Gateway Stopped
ADVANCED.md:27Documented Exclusion Procedure Deletes Live OpenClaw Data
FAQ.md:337Recursive World-Readable Permission Recommendation Exposes Sensitive State
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).
du -sh "$STATE_DIR_NEW"/* | sort -hr | head -10
rm -rf "$TMP_DIR/.openclaw/logs" rm -rf "$TMP_DIR/.openclaw/.npm"
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 -rf "$TMP_DIR/.openclaw/logs" rm -rf "$TMP_DIR/.openclaw/.npm"
### 3. 分片备份(大文件)
The cleanup pipeline uses 'ls | tail | xargs rm -f', which is unsafe for filenames containing whitespace, newlines, or leading hyphens and may delete unintended files. In a backup directory containing unusual or attacker-planted filenames, this can cause accidental data loss or broaden the deletion scope.
# 清理旧备份(保留最近5个)
cd ~/Desktop/OpenClaw_Backups
ls -t openclaw_backup_*.tar.gz.enc | tail -n +6 | xargs rm -f
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).
�2:磁盘空间不足
诊断:
df -h
du -sh ~/.openclaw
解决:
# 清理旧备份(保留最近5个)
cd ~/Desktop/OpenClaw_Backups
ls -t openclaw_backup_*.tar.gz.enc | tail -n +6 | xargs rm -f
诊断:
# 查看cron日志
tail -f /tmp/openclaw_backup.log
# 手动测试cron环境
env -i HOME=$HOME /bin/bash -c 'crontab -l | grep openclaw'
解决:
| 策略 | 优点 | 缺点 | 适用场景 |
|---|---|---|---|
| 完整备份 | 简单、快速恢复 | 占用空间大 | 每周/月备份 |
| 增量备份 | 节省空间 | 恢复复杂 | 每日备份 |
| 最小备份 | 速度快、空间小 | 不完整 | 紧急备份 |
| 3-2-1备份 | 最安全 | 管理复杂 | 生产环境 |
The pipeline ls -t ... | tail -n +6 | xargs rm -f chains file selection directly into deletion, which is error-prone and offers no confirmation. Filenames with unusual characters and unexpected glob matches can lead to accidental removal of backups beyond what the user intended.
rm openclaw_backup_2026-03-01_*.tar.gz*
# 方式2:只保留最近5个
ls -t openclaw_backup_*.tar.gz.enc | tail -n +6 | xargs rm -f
ls -t openclaw_backup_*.tar.gz.enc.sha256 | tail -n +6 | xargs rm -f
# 方式3:删除30天前的备份
This second chained deletion command removes checksum files using the same unsafe pattern. In a backup context, deleting integrity metadata can silently reduce the ability to verify archive correctness and impede recovery confidence.
# 方式2:只保留最近5个
ls -t openclaw_backup_*.tar.gz.enc | tail -n +6 | xargs rm -f
ls -t openclaw_backup_*.tar.gz.enc.sha256 | tail -n +6 | xargs rm -f
# 方式3:删除30天前的备份
find . -name "openclaw_backup_*.tar.gz*" -mtime +30 -delete
This duplicate finding correctly flags the explicit destructive command rm -rf ~/.openclaw/logs/*.log. The issue is not malicious intent but unsafe documentation that encourages irreversible deletion without guardrails.
# 排除日志
rm -rf ~/.openclaw/logs/*.log
# 排除node_modules(如果有)
rm -rf ~/.openclaw/skills/*/node_modules
This duplicate finding correctly flags the explicit destructive command rm -rf ~/.openclaw/logs/*.log. The issue is not malicious intent but unsafe documentation that encourages irreversible deletion without guardrails.
# 排除日志
rm -rf ~/.openclaw/logs/*.log
# 排除node_modules(如果有)
rm -rf ~/.openclaw/skills/*/node_modules
This duplicate finding correctly flags the recursive wildcard deletion of node_modules directories. The command can break skills and, if edited incorrectly, expand the deletion scope unexpectedly.
rm -rf ~/.openclaw/logs/*.log
rm -rf ~/.openclaw/skills/*/node_modules
3. **使用SSD作为临时目录**:
This duplicate finding correctly flags the recursive wildcard deletion of node_modules directories. The command can break skills and, if edited incorrectly, expand the deletion scope unexpectedly.
rm -rf ~/.openclaw/logs/*.log
rm -rf ~/.openclaw/skills/*/node_modules
3. **使用SSD作为临时目录**:
rm -f ~/Desktop/OpenClaw_Backups/openclaw_backup_*.tar.gz.tmp forcibly removes matching incomplete backup files. The path is relatively specific, but the command is still irreversible and lacks an adjacent caution about permanent deletion.
清理:
# 删除未完成的备份
rm -f ~/Desktop/OpenClaw_Backups/openclaw_backup_*.tar.gz.tmp
rm -rf /tmp/openclaw_backup_*
This duplicate finding flags recursive deletion of temporary backup directories under /tmp. The context lowers severity because it is cleanup of temp artifacts, but it remains destructive shell guidance.
# 删除未完成的备份
rm -f ~/Desktop/OpenClaw_Backups/openclaw_backup_*.tar.gz.tmp
rm -rf /tmp/openclaw_backup_*
重新备份:
This duplicate finding flags recursive deletion of temporary backup directories under /tmp. The context lowers severity because it is cleanup of temp artifacts, but it remains destructive shell guidance.
# 删除未完成的备份
rm -f ~/Desktop/OpenClaw_Backups/openclaw_backup_*.tar.gz.tmp
rm -rf /tmp/openclaw_backup_*
重新备份:
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
# OpenClaw Backup Skill
🐈⬛ **定期备份 OpenClaw 数据,支持加密、定时、云同步**
[](https://opensource.org/licenses/MIT)
[](https://openclaw.ai)
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
# OpenClaw Backup Skill
🐈⬛ **定期备份 OpenClaw 数据,支持加密、定时、云同步**
[](https://opensource.org/licenses/MIT)
[](https://openclaw.ai)
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
# OpenClaw Backup Skill
🐈⬛ **定期备份 OpenClaw 数据,支持加密、定时、云同步**
[](https://opensource.org/licenses/MIT)
[](https://openclaw.ai)
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
# OpenClaw Backup Skill
🐈⬛ **定期备份 OpenClaw 数据,支持加密、定时、云同步**
[](https://opensource.org/licenses/MIT)
[](https://openclaw.ai)
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
# OpenClaw Backup Skill
🐈⬛ **定期备份 OpenClaw 数据,支持加密、定时、云同步**
[](https://opensource.org/licenses/MIT)
[](https://openclaw.ai)
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
# OpenClaw Backup Skill
🐈⬛ **定期备份 OpenClaw 数据,支持加密、定时、云同步**
[](https://opensource.org/licenses/MIT)
[](https://openclaw.ai)
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
# OpenClaw Backup Skill
🐈⬛ **定期备份 OpenClaw 数据,支持加密、定时、云同步**
[](https://opensource.org/licenses/MIT)
[](https://openclaw.ai)
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
# OpenClaw Backup Skill
🐈⬛ **定期备份 OpenClaw 数据,支持加密、定时、云同步**
[](https://opensource.org/licenses/MIT)
[](https://openclaw.ai)
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
# OpenClaw Backup Skill
🐈⬛ **定期备份 OpenClaw 数据,支持加密、定时、云同步**
[](https://opensource.org/licenses/MIT)
[](https://openclaw.ai)
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
# OpenClaw Backup Skill
🐈⬛ **定期备份 OpenClaw 数据,支持加密、定时、云同步**
[](https://opensource.org/licenses/MIT)
[](https://openclaw.ai)
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
# OpenClaw Backup Skill
🐈⬛ **定期备份 OpenClaw 数据,支持加密、定时、云同步**
[](https://opensource.org/licenses/MIT)
[](https://openclaw.ai)
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.
# OpenClaw Backup Skill
🐈⬛ **定期备份 OpenClaw 数据,支持加密、定时、云同步**
[](https://opensource.org/licenses/MIT)
[](https://openclaw.ai)