T09 · Insecure Skill Coding Practices
- Location
scripts/openclaw-restore.impl.sh:588- Finding
Command Injection Through Restore Path Evaluation
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This backup skill is mostly coherent, but it needs review because it handles sensitive backups and has script flaws that could expose credentials, run unintended commands, or delete outside the intended backup area.
Install only if you are comfortable reviewing and hardening the shell scripts first. Treat WebDAV upload, restore, delete, and portable export as sensitive operations; require --encrypt-config for any remote upload, avoid sharing exported packages until config redaction is verified, and do not run restore/delete against paths you do not fully trust.
scripts/openclaw-restore.impl.sh:588Command Injection Through Restore Path Evaluation
scripts/openclaw-restore.impl.sh:323Backup Deletion Can Traverse Outside the Managed Backup Root
scripts/openclaw-backup.impl.sh:4Plaintext Sensitive Configuration Can Be Uploaded to WebDAV
scripts/openclaw-export.impl.sh:119Portable Export Sanitization Leaves Credentials in Configuration Packages
The description understates or omits notification features that send data to Telegram, WeCom, and Feishu, which are external network destinations and involve secret tokens. This mismatch can cause users or orchestration systems to approve a skill for backup purposes while overlooking outbound communication behavior and secret handling.
The description understates or omits notification features that send data to Telegram, WeCom, and Feishu, which are external network destinations and involve secret tokens. This mismatch can cause users or orchestration systems to approve a skill for backup purposes while overlooking outbound communication behavior and secret handling.
The description understates or omits notification features that send data to Telegram, WeCom, and Feishu, which are external network destinations and involve secret tokens. This mismatch can cause users or orchestration systems to approve a skill for backup purposes while overlooking outbound communication behavior and secret handling.
The description understates or omits notification features that send data to Telegram, WeCom, and Feishu, which are external network destinations and involve secret tokens. This mismatch can cause users or orchestration systems to approve a skill for backup purposes while overlooking outbound communication behavior and secret handling.
The description understates or omits notification features that send data to Telegram, WeCom, and Feishu, which are external network destinations and involve secret tokens. This mismatch can cause users or orchestration systems to approve a skill for backup purposes while overlooking outbound communication behavior and secret handling.
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).
done
# Also clean up any leftover curl error files
rm -f /tmp/webdav_error_$$.txt 2>/dev/null || true
return $exit_code
}
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).
if [[ "$level" == "0" ]]; then
# Full backup: remove old snapshots
rm -f "${SNAPSHOT_DIR}"/level-*.snapshot
snapshot_file="${SNAPSHOT_DIR}/level-0.snapshot"
(cd "${source_dir}" && tar --exclude='node_modules' --exclude='.git' --exclude='backups/openclaw' --exclude='.env.backup' --exclude='.env.backup.secret' \
--listed-incremental="${snapshot_file}" \
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
WORKSPACE_DIR="${OPENCLAW_HOME}/workspace"
EXTENSIONS_DIR="${OPENCLAW_HOME}/extensions"
CONFIG_FILE="${OPENCLAW_HOME}/openclaw.json"
ENV_FILE="${OPENCLAW_HOME}/.env"
EXPORT_DIR="${EXPORT_DIR:-${OPENCLAW_HOME}/exports}"
TIMESTAMP=$(date +"%Y-%m-%d-%H%M%S")
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# OpenClaw Environment Variable Mapping
# Generated: ${TIMESTAMP}
#
# Copy this file to .env and fill in your values
# OpenClaw Base Configuration
OPENCLAW_HOME=\${HOME}/.openclaw
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# OpenClaw Environment Variable Mapping
# Generated: ${TIMESTAMP}
#
# Copy this file to .env and fill in your values
# OpenClaw Base Configuration
OPENCLAW_HOME=\${HOME}/.openclaw
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# OpenClaw Environment Variable Mapping
# Generated: ${TIMESTAMP}
#
# Copy this file to .env and fill in your values
# OpenClaw Base Configuration
OPENCLAW_HOME=\${HOME}/.openclaw
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# OpenClaw Environment Variable Mapping
# Generated: ${TIMESTAMP}
#
# Copy this file to .env and fill in your values
# OpenClaw Base Configuration
OPENCLAW_HOME=\${HOME}/.openclaw
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# OpenClaw Environment Variable Mapping
# Generated: ${TIMESTAMP}
#
# Copy this file to .env and fill in your values
# OpenClaw Base Configuration
OPENCLAW_HOME=\${HOME}/.openclaw
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# OpenClaw Environment Variable Mapping
# Generated: ${TIMESTAMP}
#
# Copy this file to .env and fill in your values
# OpenClaw Base Configuration
OPENCLAW_HOME=\${HOME}/.openclaw
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# OpenClaw Environment Variable Mapping
# Generated: ${TIMESTAMP}
#
# Copy this file to .env and fill in your values
# OpenClaw Base Configuration
OPENCLAW_HOME=\${HOME}/.openclaw
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# OpenClaw Environment Variable Mapping
# Generated: ${TIMESTAMP}
#
# Copy this file to .env and fill in your values
# OpenClaw Base Configuration
OPENCLAW_HOME=\${HOME}/.openclaw
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# OpenClaw Environment Variable Mapping
# Generated: ${TIMESTAMP}
#
# Copy this file to .env and fill in your values
# OpenClaw Base Configuration
OPENCLAW_HOME=\${HOME}/.openclaw
The generated guide explicitly instructs users to run bash scripts/migrate.sh --env-file .env, and that script later sources the specified file. In context, this documentation encourages a dangerous execution path where a crafted .env can execute arbitrary shell commands during migration.
\`\`\`bash
# 自动应用环境变量并恢复
bash scripts/migrate.sh --env-file .env
# 或手动分步
export $(cat .env | grep -v '^#' | xargs)
The manual migration instructions use export $(cat .env | grep -v '^#' | xargs), which is unsafe for secret handling and shell parsing. This pattern can misparse values containing spaces or special characters, leak secrets into process listings/history, and can trigger unintended shell behavior depending on contents, making migration of credential-bearing env files hazardous.
bash scripts/migrate.sh --env-file .env
# 或手动分步
export $(cat .env | grep -v '^#' | xargs)
bash scripts/migrate.sh
\`\`\`
The health-check script uses source on ${WORKSPACE_DIR}/.env.backup and .env.backup.secret, which executes arbitrary shell code from those files rather than merely validating key presence. Because this script is intended for diagnostics and may be run in trusted operational workflows, a malicious or tampered config file can achieve code execution under the user account running the check.
The restore section presents commands to restore backups, and the portable package section includes a migration script, but there is no explicit warning that these operations may modify or replace existing configuration, extensions, or workspace data. In markdown skill documentation, actions affecting user data or system integrity should disclose that impact clearly.
This markdown file includes commands to delete specific backup versions and purge older backups, including a non-dry-run example, but it does not warn that these actions permanently remove backup data. For markdown files, destructive behaviors that can affect user data should be accompanied by an explicit warning so users understand the risk before running the commands.
The skill explicitly instructs users to run shell scripts that can perform filesystem backup, restore, encryption, and remote upload, but it declares no tool scope or allowed-tools boundary. In an agent setting, missing tool restrictions increases the chance the skill is invoked with broader shell access than intended, enabling destructive local operations or outbound transfers without a clear permission contract.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
Install parallel compression tools for best performance:
# Ubuntu/Debian
sudo apt-get install pigz zstd
# macOS
brew install pigz zstd
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
Install parallel compression tools for best performance:
# Ubuntu/Debian
sudo apt-get install pigz zstd
# macOS
brew install pigz zstd
No suspicious patterns detected.