Back to skill

Security audit

OpenClaw Backup & Restore

Security checks for vulnerabilities and agentic risk

Overview

This backup/restore skill has a coherent purpose, but its scripts can upload broad OpenClaw state and restore remote content into the live environment while running unreviewed commands.

Review before installing. Use only a private repository you fully control, assume the backup may contain secrets and private conversations, and do not run restore from any repository that could be compromised. Safer use would require a packaged fail-closed exclusion file, explicit confirmation and diff preview, client-side encryption or secret filtering, restore into a staging directory first, and removing or gating automatic npm install and openclaw doctor --yes.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/backup.sh:162
Finding

Overbroad export of sensitive OpenClaw state to an unrestricted Git remote

Content
View full analysis
/dev/null | tr -d '"') if [ -z "$REPO_URL" ] || [ "$REPO_URL" = "null" ]; then echo "Error: OPENCLAW_BACKUP_REPO is not set in openclaw.json." echo 'Please set it via: openclaw config set skills.entries.openclaw-backup-restore.env.OPENCLAW_BACKUP_REPO "your-git-repo-url"' exit 1 fi SOURCE="${HOME}/.openclaw/" BACKUP_DIR="${HOME}/openclaw-backup/" LOG_FILE="/tmp/openclaw-backup.log" echo "[$(date)] Starting OpenClaw backup to ${REPO_URL}..." | tee -a "$LOG_FILE" if [ ! -d "$BACKUP_DIR" ]; then echo "Initializing backup directory at $BACKUP_DIR..." mkdir -p "$BACKUP_DIR" cd "$BACKUP_DIR" git init git remote add origin "$REPO_URL" else cd "$BACKUP_DIR" git remote set-url origin "$REPO_URL" || true fi SKILL_DIR_SHARED="${HOME}/.openclaw/skills/openclaw-backup-restore" SKILL_DIR_WORKSPACE="${HOME}/.openclaw/workspace/skills/openclaw-backup-restore" SKILL_DIR="" if [ -f "${SKILL_DIR_SHARED}/.gitignore" ]; then SKILL_DIR="$SKILL_DIR_SHARED" elif [ -f "${SKILL_DIR_WORKSPACE}/.gitignore" ]; then SKILL_DIR="$SKILL_DIR_WORKSPACE" fi if [ ! -f "${BACKUP_DIR}/.gitignore" ] && [ -n "$SKILL_DIR" ] && [ -f "${SKILL_DIR}/.gitignore" ]; then echo "Copying .gitignore from skill directory..." cp "${SKILL_DIR}/.gitignore" "${BACKUP_DIR}/.gitignore" fi rsync -av --delete \ --exclude-from="${BACKUP_DIR}/.gitignore" \ --exclude=".git/" \ --exclude=".gitignore" \ "$SOURCE" "$BACKUP_DIR" cd "$BACKUP_DIR" STATUS=$(git status --short) if [ -n "$STATUS" ]; then COMMIT_MSG=$(summarize_status "$STATUS") COMMIT_ ...[truncated 2676 chars]
Remediation
View remediation
` operations instead of `git add .`. 9. Verify that the destination repository is private, while documenting that repository privacy alone does not replace encryption. 10. Create the log with restrictive permissions and avoid recording repository URLs that may contain embedded credentials. ]]>

T03 · Remote Payload Retrieval and Execution

Error
Location
scripts/restore.sh:20
Finding

Remote repository content can execute arbitrary npm lifecycle scripts during restoration

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (5)

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The code clearly implements a backup/export workflow: it reads a configured repo URL, initializes or updates a local backup Git repository, rsyncs ~/.openclaw into it, commits changes, and pushes to origin main. This aligns with the backup portion of the description and with the listed data scope (configuration, workspace, runtime/session-like state under ~/.openclaw). However, there is no code to fetch, pull, clone, or restore files back into ~/.openclaw, nor any selective restore logic. Because restore is a core part of the declared purpose, the description materially overstates the capability of this code chunk.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
1. The agent should execute the `backup.sh` script located within this skill's `scripts/` directory.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The restore process runs npm install for every package.json found in the restored repository contents. npm install executes package lifecycle scripts such as preinstall, install, and postinstall, so a compromised or malicious backup repository can achieve arbitrary code execution during restore with the user's privileges. In this skill context, that is especially dangerous because the repository is treated as trusted backup input even though it can contain attacker-controlled project files.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script clones or pulls remote content, syncs it into the live ~/.openclaw directory, runs package installation, and then runs openclaw doctor --yes without any user confirmation or preview. This creates a hazardous one-step destructive workflow where accidental invocation, repository compromise, or misconfiguration can overwrite active state and trigger code execution before the operator can review the changes. The backup/restore context makes confirmation more important, not less, because the operation directly affects sensitive agent configs, sessions, and workspace state.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

openclaw doctor --yes performs broad automated repair actions after restore, which goes beyond simply copying backup data back into place. Because it runs non-interactively and may modify the local environment, install packages, or rewrite configuration, it expands the blast radius of a restore from data restoration into uncontrolled system changes. In a backup/restore skill, this increases danger because users may expect deterministic file restoration, not additional privileged remediation behavior.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.