T09 · Insecure Skill Coding Practices
- Location
restore.sh:43- Finding
Unsafe Extraction of User-Supplied Backup Archives
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a local backup skill, but it can persistently schedule jobs, collect sensitive OpenClaw data, delete backups, and restore archives in ways that need careful review.
Install only if you want this skill to manage local OpenClaw backups and cron jobs. Review the cron setup scripts before running them, avoid setup-cron-auto.sh unless you accept unattended recurring backups and cleanup, and restore only from trusted archives because restore.sh can overwrite live OpenClaw files.
restore.sh:43Unsafe Extraction of User-Supplied Backup Archives
setup-cron.sh:13Predictable Temporary Cron Files Permit Symlink-Based File Overwrite
backup-full.sh:24Sensitive Backup Archives Are Not Consistently Created with Restrictive Permissions
setup-cron-auto.sh:45Non-Interactive Installer Establishes Scheduled Persistence Without Explicit Confirmation
backup-before-change.sh:50Backup Scope Collects Credentials and Agent Identity Data Beyond Configuration-Only Needs
The skill description emphasizes backup management, but the document also includes emergency restoration commands that can overwrite current state. Restore capability is materially more dangerous than backup-only behavior because it can replace active configuration/workspace contents and trigger integrity or availability loss if invoked on the wrong archive.
The skill description emphasizes backup management, but the document also includes emergency restoration commands that can overwrite current state. Restore capability is materially more dangerous than backup-only behavior because it can replace active configuration/workspace contents and trigger integrity or availability loss if invoked on the wrong archive.
The skill description emphasizes backup management, but the document also includes emergency restoration commands that can overwrite current state. Restore capability is materially more dangerous than backup-only behavior because it can replace active configuration/workspace contents and trigger integrity or availability loss if invoked on the wrong archive.
The skill description emphasizes backup management, but the document also includes emergency restoration commands that can overwrite current state. Restore capability is materially more dangerous than backup-only behavior because it can replace active configuration/workspace contents and trigger integrity or availability loss if invoked on the wrong archive.
The skill description emphasizes backup management, but the document also includes emergency restoration commands that can overwrite current state. Restore capability is materially more dangerous than backup-only behavior because it can replace active configuration/workspace contents and trigger integrity or availability loss if invoked on the wrong archive.
The skill description emphasizes backup management, but the document also includes emergency restoration commands that can overwrite current state. Restore capability is materially more dangerous than backup-only behavior because it can replace active configuration/workspace contents and trigger integrity or availability loss if invoked on the wrong archive.
The skill description emphasizes backup management, but the document also includes emergency restoration commands that can overwrite current state. Restore capability is materially more dangerous than backup-only behavior because it can replace active configuration/workspace contents and trigger integrity or availability loss if invoked on the wrong archive.
The skill description emphasizes backup management, but the document also includes emergency restoration commands that can overwrite current state. Restore capability is materially more dangerous than backup-only behavior because it can replace active configuration/workspace contents and trigger integrity or availability loss if invoked on the wrong archive.
The surrounding comments and echo statements indicate the code is creating a backup from the collected temporary directory contents. However, tar -czf "$BACKUP_FILE" -C "$(basename "$TEMP_DIR")" . is inconsistent with tar's expected -C <dir> usage and does not match the stated intent to archive the temp directory contents, suggesting the implementation contradicts the documented behavior.
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).
# 创建软链接到最新完整备份
echo "🔗 更新最新完整备份链接..."
rm -f "$BACKUP_ROOT/weekly/latest"
ln -sf "$BACKUP_PATH" "$BACKUP_ROOT/weekly/latest"
echo " ✅ 最新完整备份链接: $BACKUP_ROOT/weekly/latest -> $BACKUP_PATH"
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).
# 创建软链接到最新月度备份
echo "🔗 更新最新月度备份链接..."
rm -f "$BACKUP_ROOT/monthly/latest"
ln -sf "$BACKUP_PATH" "$BACKUP_ROOT/monthly/latest"
echo " ✅ 最新月度备份链接: $BACKUP_ROOT/monthly/latest -> $BACKUP_PATH"
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).
echo -e "${BLUE}🔗 更新最新备份链接...${NC}"
# 删除旧的daily/latest软链接
rm -f "$BACKUP_ROOT/daily/latest"
# 创建新的软链接
ln -sf "$BACKUP_PATH" "$BACKUP_ROOT/daily/latest"
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).
echo -e "${BLUE}🔗 更新最新备份链接...${NC}"
# 删除旧的daily/latest软链接
rm -f "$BACKUP_ROOT/daily/latest"
# 创建新的软链接
ln -sf "$BACKUP_PATH" "$BACKUP_ROOT/daily/latest"
The restore script overwrites active configuration and workspace files, but the usage examples do not foreground that this is a destructive operation. Users may invoke restore expecting a safe preview and unintentionally replace current state, especially because the skill handles operational config files.
The cleanup script permanently deletes expired backups automatically, contradicting the stated confirmation requirement for high-risk actions. Although retention cleanup is expected behavior, silent deletion reduces recovery options and may remove backups the user still needs.
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).
# 创建软链接到最新Skills备份
echo "🔗 更新最新Skills备份链接..."
rm -f "$BACKUP_DIR/latest"
ln -sf "$BACKUP_FILE" "$BACKUP_DIR/latest"
echo " ✅ 最新Skills备份链接: $BACKUP_DIR/latest -> $BACKUP_FILE"
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).
# 创建软链接到最新Skills备份
echo "🔗 更新最新Skills备份链接..."
rm -f "$BACKUP_DIR/latest"
ln -sf "$BACKUP_FILE" "$BACKUP_DIR/latest"
echo " ✅ 最新Skills备份链接: $BACKUP_DIR/latest -> $BACKUP_FILE"
The skill metadata says it manages backups, but this script performs a full restore that overwrites the active ~/.openclaw state. That mismatch is dangerous because a user or calling agent may invoke the skill expecting low-risk backup maintenance, while it can replace configuration, memory, workspace contents, and agent state with attacker-controlled backup data.
The skill advertises shell-based operational behavior through required binaries and command examples, but it does not declare an explicit tool/permission scope. That creates ambiguity about what the agent is allowed to execute and weakens enforcement boundaries for a skill that can copy, delete, and restore files.
The skill states backups must never be created automatically without user confirmation, yet elsewhere markets automated daily/weekly/monthly backups. This contradiction can cause agents or users to misapply the skill, leading to unintended collection and retention of potentially sensitive files without clear consent.
The rule says backups outside retention windows must not be deleted without confirmation, while the skill description claims expired backups are cleaned automatically. Ambiguous deletion semantics around retention can lead to unexpected data loss, especially because backup cleanup is inherently destructive.
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
### 2. Follow Retention Policies / 遵循保留策略
**English**:
Respect configured retention periods: daily (7 days), weekly (4 weeks), monthly (12 months). Never delete backups outside retention windows without confirmation.
**中文**:
尊重配置的保留周期:每日(7天)、每周(4周)、每月(12个月)。未经确认,不得删除保留期之外的备份。
The user-facing comments and status/output strings throughout the script are in Chinese, which effectively forces a specific language for anyone invoking the skill. The file does not provide any opt-in, alternative locale, or justification that this is a region-specific tool, so it conflicts with the language/locale policy criteria.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
echo -e " ${GREEN}✅ 关键备份创建成功: $(basename "$BACKUP_FILE") ($BACKUP_SIZE)${NC}"
# 设置文件权限
chmod 600 "$BACKUP_FILE"
# 记录原因
{
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
echo -e " ${GREEN}✅ 关键备份创建成功: $(basename "$BACKUP_FILE") ($BACKUP_SIZE)${NC}"
# 设置文件权限
chmod 600 "$BACKUP_FILE"
# 记录原因
{
No suspicious patterns detected.