Back to skill

Security audit

Openclaw Complete Backup Delete Fresh Install Restore Cycle

Security checks for vulnerabilities and agentic risk

Overview

This skill is meant for OpenClaw backup and recovery, but it includes high-impact delete, install, credential-copying, and global command replacement steps that need careful review before use.

Review before installing. Use this only on an isolated or well-backed-up OpenClaw host, avoid the curl-to-shell fallback, pin and verify packages, encrypt or tightly restrict credential backups, replace destructive deletes with reversible moves, and confirm every global binary or symlink target before changing /usr/local/bin.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (5)

T03 · Remote Payload Retrieval and Execution

Error
Location
SKILL.md:314
Finding

Unverified Remote Installer Is Piped Directly Into a Shell

Content
View full analysis
Remediation
View remediation
/install.sh" printf '%s %s\n' '' /tmp/openclaw-install.sh | sha256sum -c - chmod 700 /tmp/openclaw-install.sh /bin/sh /tmp/openclaw-install.sh ``` ]]>

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:94
Finding

Credentials and API Keys Are Duplicated Into Unencrypted Backups

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:300
Finding

Broad Destructive Deletion Can Remove Unrelated Tools or Application State

Content
View full analysis
/dev/null || true ``` The restoration workflow also deletes the active application state: ```bash # Create fresh .openclaw directory rm -rf ~/.openclaw mkdir -p ~/.openclaw ``` ### Technical Analysis The `/usr/local/bin` cleanup uses a wildcard name match rather than an exact list of package-owned paths. It can delete unrelated executables whose names merely contain `openclaw`. Error suppression and `|| true` conceal failures and reduce auditability. The recursive deletion of `~/.openclaw` is consistent with a clean restoration in principle, but it is executed without an immediately coupled check proving that the selected backup is complete, readable, authentic, and restorable. If backup creation omitted files, was interrupted, or selected the wrong source, the command can irreversibly destroy the active copy. These operations are especially consequential because the Skill expects root/sudo access and handles credentials, databases, workspaces, and agent configuration. ### Attack Path **Wildcard executable deletion:** 1. An unrelated legitimate executable exists in `/usr/local/bin` with `openclaw` anywhere in its filename. 2. The user follows the purge instructions. 3. `find ... -delete` removes that executable without package-ownership validation or confirmation. 4. The associated application or administrative workflow stops functioning. **State-loss path:** 1. A backup is incomplete, corrupt, stale, or missing required hidden files. 2. The restoration branch still executes `rm -rf ~/.openclaw`. 3. The only current copy of credentials, configuration, database content, or workspace data is destroyed. 4. Restoration fails or silently returns an incomple ...[truncated 609 chars]
Remediation
View remediation

T07 · Tool Hijacking and Spoofing

Error
Location
SKILL.md:337
Finding

Ambiguous Executable Discovery Can Replace a Trusted Global Command

Content
View full analysis
/dev/null | head -1) if [ -n "$OPENCLAW_MJS" ]; then echo "Found openclaw.mjs at: $OPENCLAW_MJS" # Create symlink sudo ln -sf "$OPENCLAW_MJS" /usr/local/bin/openclaw sudo chmod +x /usr/local/bin/openclaw echo "✅ Created symlink: /usr/local/bin/openclaw → $OPENCLAW_MJS" ``` A second fallback similarly searches for a package file and replaces the global command: ```bash BIN_PATH=$(find /usr/lib/node_modules -name "$BIN_ENTRY" -path "*openclaw*" 2>/dev/null | head -1) if [ -n "$BIN_PATH" ]; then sudo ln -sf "$BIN_PATH" /usr/local/bin/openclaw sudo chmod +x /usr/local/bin/openclaw echo "✅ Created symlink to: $BIN_PATH" fi ``` ### Technical Analysis The workflow trusts the first file returned by a broad filesystem search based primarily on filename. It does not confirm that the result belongs to the intended npm package, matches a reviewed version, has trusted ownership, is not a symlink to another location, or passes an integrity check. The selected file is then exposed as `/usr/local/bin/openclaw` using `sudo ln -sf`. This forcefully replaces a globally trusted command. Users, automation, and services may subsequently execute the selected JavaScript while believing they are invoking the legitimate OpenClaw CLI. The fallback wrapper at `SKILL.md:716-723` repeats the same weak first-match discovery principle, although it does not itself create the privileged symlink. ### Attack Path 1. An attacker or compromised package places a file named `openclaw.mjs` under a searched `/usr/lib/node_modules` path. 2. Filesystem traversal returns the attacker-controlled file before the legitimate executable. 3. The Skill assigns that f ...[truncated 880 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:308
Finding

Unpinned Global npm Installations Expose the Host to Supply-Chain Compromise

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
Findings (41)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill launches into backup, deletion, reinstall, and credential-copying workflows without a clear upfront warning that it may destroy local state and expose secrets. In context, this is dangerous because operators may follow copy-paste instructions before understanding that they are deleting application data and handling sensitive credential material.

Content

No source excerpt is available for this finding.

Chaining Abuse

High
Category
Tool Misuse
Confidence
92% confidence
Finding

which openclaw && rm -f "$(which openclaw)" chains discovery and deletion into a single expression, increasing the risk of removing an unexpected binary if PATH resolution is manipulated or misunderstood. The compact one-liner discourages inspection of the resolved path before deletion.

Content

Scanner excerpt · SKILL.md (reported line 299)May include surrounding context.

md
npm uninstall -g @martian-engineering/lossless-claw 2>/dev/null || echo "Not installed via npm, moving on..."

# Remove any remaining binaries
which openclaw && rm -f "$(which openclaw)" || echo "Binary already gone"

# Clean up any stray files (they're like glitter)
find /usr/local/bin -name "*openclaw*" -delete 2>/dev/null || true

External Script Fetching

High
Category
Supply Chain
Confidence
99% confidence
Finding

curl -fsSL https://cli.openclaw.ai/install.sh | sh executes a remote script directly in the shell without prior review, pinning, or integrity verification. This is a classic supply-chain and remote code execution hazard: compromise of the host, DNS, TLS trust chain, or upstream script immediately turns the skill into an arbitrary code execution path with the user's privileges.

Content

Scanner excerpt · SKILL.md (reported line 316)May include surrounding context.

openclaw --version

If that fails, try the direct method (because npm)

curl -fsSL https://cli.openclaw.ai/install.sh | sh

text

### Step 9: Initial Configuration & Binary Fix

Chaining Abuse

High
Category
Tool Misuse
Confidence
99% confidence
Finding

Piping a fetched network resource directly into sh combines retrieval and execution into one unreviewable action. This removes opportunities for inspection, signature validation, and version control, making upstream compromise immediately exploitable.

Content

Scanner excerpt · SKILL.md (reported line 316)May include surrounding context.

openclaw --version

If that fails, try the direct method (because npm)

curl -fsSL https://cli.openclaw.ai/install.sh | sh

text

### Step 9: Initial Configuration & Binary Fix

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

rm -rf ~/.openclaw is a destructive deletion primitive that permanently removes application state prior to confirming successful restoration. In this skill's context it is especially dangerous because the same document also promotes selective and evolving workflows, increasing the chance of copy-paste execution against the wrong environment or with incomplete backups.

Content

Scanner excerpt · SKILL.md (reported line 417)May include surrounding context.

md
echo "Restoring from categorized backup: $INTELLIGENT_BACKUP"
    
    # Create fresh .openclaw directory
    rm -rf ~/.openclaw
    mkdir -p ~/.openclaw
    
    # Restore by category (selective tick-box restoration!)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

rm -rf ~/.openclaw is a destructive deletion primitive that permanently removes application state prior to confirming successful restoration. In this skill's context it is especially dangerous because the same document also promotes selective and evolving workflows, increasing the chance of copy-paste execution against the wrong environment or with incomplete backups.

Content

Scanner excerpt · SKILL.md (reported line 417)May include surrounding context.

md
echo "Restoring from categorized backup: $INTELLIGENT_BACKUP"
    
    # Create fresh .openclaw directory
    rm -rf ~/.openclaw
    mkdir -p ~/.openclaw
    
    # Restore by category (selective tick-box restoration!)

Chaining Abuse

High
Category
Tool Misuse
Confidence
86% confidence
Finding

ls -t ... | tail -n +4 | xargs rm -f chains file selection and deletion in a way that can remove unintended files if globbing, whitespace, or directory assumptions do not hold. In backup management, accidental deletion of recovery artifacts can materially worsen outage impact.

Content

Scanner excerpt · SKILL.md (reported line 633)May include surrounding context.

bash
# Keep only last 3 backups (hoarding is a disease)
cd /root/backups/openclaw
ls -t openclaw-backup-*.tar.gz | tail -n +4 | xargs rm -f

# Update retention in script (if you're feeling thorough)
sed -i 's/RETENTION_DAYS=7/RETENTION_DAYS=3/' /usr/local/bin/openclaw-backup

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The metadata markets the skill as 'safety-first' and 'tested in production' while the body contains destructive deletion, root-level changes, and curl | sh remote execution. That mismatch can lower operator caution and increase the chance that high-risk actions are run without appropriate validation or rollback planning.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest trigger uses loose natural-language conditions such as 'when OpenClaw has become a bit... temperamental' and 'it's looking tired', which do not clearly define when the skill should or should not activate. The listed prompts are also broad maintenance phrases that could match many ordinary troubleshooting situations without clear scope boundaries or exclusion cases.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 15)May include surrounding context.

md
- Clean up corrupted installation (again?)
prerequisites:
  - OpenClaw installed and running (for now)
  - Root/sudo access (because we're not messing about)
  - Disk space for backups (2x .openclaw size, plus a bit for luck)
  - Improved backup scripts installed (openclaw-backup, openclaw-restore)
pitfalls:

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 342)May include surrounding context.

md
- Clean up corrupted installation (again?)
prerequisites:
  - OpenClaw installed and running (for now)
  - Root/sudo access (because we're not messing about)
  - Disk space for backups (2x .openclaw size, plus a bit for luck)
  - Improved backup scripts installed (openclaw-backup, openclaw-restore)
pitfalls:

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 343)May include surrounding context.

md
- Clean up corrupted installation (again?)
prerequisites:
  - OpenClaw installed and running (for now)
  - Root/sudo access (because we're not messing about)
  - Disk space for backups (2x .openclaw size, plus a bit for luck)
  - Improved backup scripts installed (openclaw-backup, openclaw-restore)
pitfalls:

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 357)May include surrounding context.

md
- Clean up corrupted installation (again?)
prerequisites:
  - OpenClaw installed and running (for now)
  - Root/sudo access (because we're not messing about)
  - Disk space for backups (2x .openclaw size, plus a bit for luck)
  - Improved backup scripts installed (openclaw-backup, openclaw-restore)
pitfalls:

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 358)May include surrounding context.

md
- Clean up corrupted installation (again?)
prerequisites:
  - OpenClaw installed and running (for now)
  - Root/sudo access (because we're not messing about)
  - Disk space for backups (2x .openclaw size, plus a bit for luck)
  - Improved backup scripts installed (openclaw-backup, openclaw-restore)
pitfalls:

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 373)May include surrounding context.

md
- Clean up corrupted installation (again?)
prerequisites:
  - OpenClaw installed and running (for now)
  - Root/sudo access (because we're not messing about)
  - Disk space for backups (2x .openclaw size, plus a bit for luck)
  - Improved backup scripts installed (openclaw-backup, openclaw-restore)
pitfalls:

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 374)May include surrounding context.

md
- Clean up corrupted installation (again?)
prerequisites:
  - OpenClaw installed and running (for now)
  - Root/sudo access (because we're not messing about)
  - Disk space for backups (2x .openclaw size, plus a bit for luck)
  - Improved backup scripts installed (openclaw-backup, openclaw-restore)
pitfalls:

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

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.

Content

Scanner excerpt · SKILL.md (reported line 85)May include surrounding context.

🎯 WORKFLOW B: CLEAN INSTALL WITH DELAYED SELECTIVE RESTORE

(For when you want: Backup → Delete → Fresh Install → Work → Restore selectively later)

B1: Create Intelligent Categorized Backup

bash
echo "=== CREATING CATEGORIZED BACKUP FOR SELECTIVE RESTORE ==="
echo "Backing up in categories so you can restore only what you need later..."

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

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.

Content

Scanner excerpt · SKILL.md (reported line 121)May include surrounding context.

md
# Backup agent configs but NOT their workspaces (too big)
    find ~/.openclaw/agents -name "*.json" -type f | while read file; do
        rel_path="${file#~/.openclaw/agents/}"
        mkdir -p "$BACKUP_ROOT/03_AGENT_IDENTITIES/$(dirname "$rel_path")"
        cp "$file" "$BACKUP_ROOT/03_AGENT_IDENTITIES/$rel_path"
    done
    echo "   ✅ Agent configs backed up (excluding workspaces)"

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% confidence
Finding

Persisting Telegram and channel configuration into a backup location can store bot tokens, chat identifiers, and other sensitive integration state in plaintext under /root/BACKUPS. In context this is part of the intended workflow, but it increases secret exposure if the backup directory is later copied, browsed, or retained insecurely.

Content

Scanner excerpt · SKILL.md (reported line 137)May include surrounding context.

md
# Category 5: TELEGRAM & CHANNEL CONFIGS
echo "5. Backing up Telegram & channel configs..."
mkdir -p "$BACKUP_ROOT/05_CHANNEL_CONFIGS"
if [ -d ~/.openclaw/telegram ]; then
    cp -r ~/.openclaw/telegram/* "$BACKUP_ROOT/05_CHANNEL_CONFIGS/" 2>/dev/null || true
    echo "   ✅ Telegram configs backed up"

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% confidence
Finding

The generated manifest embeds restoration instructions and backup locations alongside references to categories containing credentials and channel configs. While useful operationally, it creates durable metadata that can help an attacker locate and restore sensitive material if the backup store is exposed.

Content

Scanner excerpt · SKILL.md (reported line 143)May include surrounding context.

md
echo "   ✅ Telegram configs backed up"
fi

# Create backup manifest
cat > "$BACKUP_ROOT/00_BACKUP_MANIFEST.md" << EOF
# OPENCLAW SELECTIVE BACKUP MANIFEST
Backup created: $(date)

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

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.

Content

Scanner excerpt · SKILL.md (reported line 322)May include surrounding context.

Step 9: Initial Configuration & Binary Fix

bash
# Initialize with minimal config
mkdir -p ~/.openclaw
echo '{"gateway": {"port": 3000}}' > ~/.openclaw/openclaw.json

# Set proper permissions (OpenClaw is fussy)

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 326)May include surrounding context.

md
echo '{"gateway": {"port": 3000}}' > ~/.openclaw/openclaw.json

# Set proper permissions (OpenClaw is fussy)
chmod 700 ~/.openclaw
chmod 600 ~/.openclaw/openclaw.json

# FIX OPENCLAW COMMAND ISSUE (Common after npm install)

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 327)May include surrounding context.

md
# Set proper permissions (OpenClaw is fussy)
chmod 700 ~/.openclaw
chmod 600 ~/.openclaw/openclaw.json

# FIX OPENCLAW COMMAND ISSUE (Common after npm install)
echo "=== OPENCLAW COMMAND TROUBLESHOOTING ==="

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 388)May include surrounding context.

openclaw --version 2>&1 | head -2 || echo "⚠️ Command exists but doesn't run" else echo "❌ OpenClaw command still not found. Try reinstalling:" echo " sudo npm install -g openclaw --verbose" echo " Or use: node /usr/lib/node_modules/openclaw/openclaw.mjs" fi

text

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 727)May include surrounding context.

openclaw --version 2>&1 | head -2 || echo "⚠️ Command exists but doesn't run" else echo "❌ OpenClaw command still not found. Try reinstalling:" echo " sudo npm install -g openclaw --verbose" echo " Or use: node /usr/lib/node_modules/openclaw/openclaw.mjs" fi

text