Back to skill

Security audit

Openclaw Backup

Security checks for vulnerabilities and agentic risk

Overview

This backup skill is mostly aligned with its stated purpose, but it copies API credentials and can permanently delete archived backup folders with weak safeguards.

Review the backup destination and retention settings before installing. Treat generated backups as sensitive secret stores, keep them private or encrypted, avoid shared or synced folders unless intentional, and do not configure the old-backup directory to any broad or valuable path such as your home directory.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/setup.sh:17
Finding

Persistent Shell Command Injection Through Generated Configuration

Content
View full analysis
"$config_file" << EOF BACKUP_ROOT="$backup_root" OLD_BACKUP_ROOT="$old_backup_root" OPENCLAW_HOME="$HOME/.openclaw" KEEP_COUNT=$keep_count MAX_OLD_SIZE_GB=$max_old_size_gb TARGET_OLD_SIZE_GB=5 EOF ``` The generated file is subsequently executed as shell code: ```bash if [ -f "$CONFIG_FILE" ]; then source "$CONFIG_FILE" fi ``` ### Technical Analysis Interactive values are inserted directly into an executable shell configuration without validation or shell-safe serialization. Characters such as quotes, command substitutions, backticks, semicolons, and newlines can alter the syntax of `config.sh`. Because `backup.sh` uses `source`, the configuration is not treated as passive data. Every command injected into or independently added to `config.sh` runs in the context of the backup process. The flaw is persistent because the malicious content remains in the generated file and executes on subsequent backup runs. ### Attack Path 1. An attacker persuades a user to enter a crafted setup value or gains the ability to influence setup input. 2. For example, a path containing command substitution or a newline followed by a shell command is entered. 3. `setup.sh` writes the value directly into `scripts/config.sh`. 4. The user or an automa ...[truncated 887 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/backup.sh:29
Finding

Plaintext Backup of API Credentials to Unrestricted Destinations

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/backup.sh:109
Finding

Unvalidated Archive Path Controls Recursive Deletion

Content
View full analysis
"$config_file" << EOF BACKUP_ROOT="$backup_root" OLD_BACKUP_ROOT="$old_backup_root" OPENCLAW_HOME="$HOME/.openclaw" KEEP_COUNT=$keep_count MAX_OLD_SIZE_GB=$max_old_size_gb TARGET_OLD_SIZE_GB=5 EOF ``` ```bash if [ -d "$OLD_BACKUP_ROOT" ]; then echo "" echo "Checking old backups size..." OLD_SIZE_GB=$(du -sg "$OLD_BACKUP_ROOT" 2>/dev/null | cut -f1) OLD_SIZE_GB=${OLD_SIZE_GB:-0} echo "Old backups total size: $OLD_SIZE_GB GB" if [ "$OLD_SIZE_GB" -gt "$MAX_OLD_SIZE_GB" ]; then echo "Cleaning to $TARGET_OLD_SIZE_GB GB..." ls -tdr "$OLD_BACKUP_ROOT"/*/ | while read dir; do CURRENT_SIZE=$(du -sg "$OLD_BACKUP_ROOT" 2>/dev/null | cut -f1) CURRENT_SIZE=${CURRENT_SIZE:-0} if [ "$CURRENT_SIZE" -le "$TARGET_OLD_SIZE_GB" ]; then break fi BASENAME=$(basename "$dir") rm -rf "$dir" echo "[DELETED] $BASENAME" done fi fi ``` ### Technical Analysis `OLD_BACKUP_ROOT` is accepted without canonicalization, containment checks, ownership checks, or validation that it is a dedicated archive directory. Cleanup enumerates every child directory under the configured path and passes each result to `rm -rf` until the size target is reached. Consequently, a mistaken, overly broad, or attacker-influenced path can cause unrelated directories to be permanently removed. The script also parses `ls` out ...[truncated 1385 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (9)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file states that the skill will automatically transfer and delete old backups, which can affect user data retention. The README does not include a clear warning or caution about deletion behavior, recovery limits, or the need to review retention settings before use.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The skill explicitly backs up highly sensitive material, including credentials/ with API keys, and also advertises automatic retention and cleanup behavior without clearly documenting encryption, access control, restore safety, or deletion risks. In a backup tool, this omission can lead users to create plaintext copies of secrets, store them insecurely, or lose data through automated cleanup policies they do not fully understand.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest says the skill automatically backs up OpenClaw local storage configuration files, which implies a configuration-focused scope. The code also copies credential, identity, device, agent, and skill directories, which is a substantially broader data collection scope than 'configuration files' alone. This is a semantic mismatch because those materials can include sensitive operational state, not just config.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script copies sensitive material such as credentials and identity data into backup directories without encryption, permission hardening, or any warning to the user. If the backup location is later accessed by another local user, synced insecurely, or exfiltrated, those secrets could be reused to compromise the OpenClaw environment.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script does more than backup and restore: it automatically moves older backups and permanently deletes archived backups once size thresholds are exceeded. Because this destructive behavior is built into a backup utility and is not clearly surfaced as a separate retention policy action or confirmed by the user, it creates a real risk of unexpected data loss.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script permanently deletes old backups with rm -rf based only on size thresholds and age ordering, without a clear warning or confirmation immediately before removal. In a backup utility, silent destructive cleanup can undermine recovery guarantees and lead to irreversible loss if thresholds are misconfigured or the operator misunderstands retention behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The natural-language instructions and descriptions are presented exclusively in Chinese, with no indication that other languages are supported or that the language restriction is intentional and justified. Under the stated policy, forcing a specific language without opt-in can be a locale-policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest description and operational notes are presented in Chinese, which can impose a fixed language on users. The file does not indicate that Chinese is optional, nor does it provide an alternative language or explain a region-specific requirement.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The file includes natural-language comments in Chinese while other user-facing text is in English, which can impose a language assumption on maintainers or operators. There is no indication that this locale choice is intentional, optional, or required for a region-specific use case.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.