Back to skill

Security audit

OpenClaw Backup Safe

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent backup tool, but it creates portable plaintext backups of credentials, sessions, memory, and user files without enforcing strong local protections.

Review before installing. Only run this skill if you are comfortable backing up all OpenClaw credentials, sessions, memory, scheduled tasks, and workspace files. Store backups in a private, encrypted location, restrict file permissions, avoid shared folders, and treat any exposed backup as a credential/session compromise requiring rotation or revocation.

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 (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/backup.sh:6
Finding

Sensitive backup archives are created without enforced access controls or encryption

Content
View full analysis

Vulnerability Details

File Location: scripts/backup.sh, lines 6–22
Vulnerability Type: Insecure storage of sensitive information
Risk Level: Medium

bash
BACKUP_DIR="${1:-$HOME/openclaw-backups}"
DATE="$(date +%Y-%m-%d_%H%M)"
BACKUP_FILE="$BACKUP_DIR/openclaw-$DATE.tar.gz"

mkdir -p "$BACKUP_DIR"

if [ ! -d "$HOME/.openclaw" ]; then
  echo "Backup failed: $HOME/.openclaw not found"
  exit 1
fi

# Create backup (exclude completions cache and logs)
tar -czf "$BACKUP_FILE" \
  --exclude="completions" \
  --exclude="*.log" \
  -C "$HOME" .openclaw/

Technical Analysis

The script archives the entire ~/.openclaw directory, excluding only completion caches and log files. According to SKILL.md, the resulting archive includes API keys, tokens, authentication profiles, Telegram session data, agent state, scheduled tasks, memory, configuration, and user files.

Neither the backup directory nor the archive is assigned an explicit restrictive permission mode. Their permissions therefore depend on the invoking process's umask. With a common umask of 022, a newly created directory can be mode 0755, while the archive can be mode 0644. This may permit other local users to traverse the directory and read the archive.

Gzip compression does not provide encryption. Consequently, backups copied to shared directories, network storage, removable media, or other insufficiently protected locations expose their contents in plaintext. The optional backup_dir argument increases this risk because callers can select a location with weaker access controls.

Attack Path

  1. A user runs scripts/backup.sh under a permissive umask, or selects a shared or weakly protected backup directory.
  2. The script creates a gzip-compressed archive without enforcing owner-only permissions or encryption.
  3. A local user or another party with access to the backup storage locates the openclaw-*.tar.gz file. ...[truncated 1029 chars]
Remediation
View remediation

Remediation Suggestions

  1. Set a restrictive umask before creating any backup artifacts:

    bash
    umask 077
    
  2. Create the backup directory with owner-only access and correct permissions on an existing directory:

    bash
    install -d -m 700 -- "$BACKUP_DIR"
    chmod 700 -- "$BACKUP_DIR"
    
  3. Explicitly enforce owner-only permissions on the completed archive:

    bash
    chmod 600 -- "$BACKUP_FILE"
    
  4. Prefer writing to a temporary archive created with secure permissions and atomically renaming it after successful completion. This prevents incomplete backup files from being treated as valid archives.

  5. Encrypt archives with an authenticated encryption mechanism before storing them on shared, remote, removable, or otherwise untrusted storage. Keep encryption keys separate from the backups and apply an appropriate key-rotation and recovery policy.

  6. Validate or clearly document the security requirements for a caller-supplied backup directory. Reject locations that are not directories, are owned by another user, or are writable by group or other users when such sharing is not explicitly intended.

A minimally hardened implementation should begin with:

bash
umask 077

BACKUP_DIR="${1:-$HOME/openclaw-backups}"
DATE="$(date +%Y-%m-%d_%H%M)"
BACKUP_FILE="$BACKUP_DIR/openclaw-$DATE.tar.gz"

install -d -m 700 -- "$BACKUP_DIR"
chmod 700 -- "$BACKUP_DIR"

tar -czf "$BACKUP_FILE" \
  --exclude="completions" \
  --exclude="*.log" \
  -C "$HOME" .openclaw/

chmod 600 -- "$BACKUP_FILE"
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The code matches part of the description: it archives ~/.openclaw, applies exclusions, and manages backup rotation. However, the declared purpose claims broader functionality—specifically restore from backup and setting up automatic backup schedules—which is not present in this code chunk. Because the description materially overstates the implemented capabilities, this is a description-behavior mismatch.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
78% confidence
Finding

The skill is designed to preserve and later restore persistent session material, including credentials and Telegram session data, which increases the lifetime and portability of authentication artifacts. In the context of backups, this is expected behavior, but it still raises security risk because compromised backup archives can resurrect valid sessions and embedded secrets.

Content

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

md
---
name: openclaw-backup
description: Backup and restore OpenClaw data. Use when user asks to create backups, set up automatic backup schedules, restore from backup, or manage backup rotation. Handles ~/.openclaw directory archiving with proper exclusions.
---

# OpenClaw Backup

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The backup instructions explicitly include credentials, tokens, agent auth profiles, workspace files, and Telegram session data, but provide no warning that the resulting archive is highly sensitive. Users may store or transfer backups insecurely, turning a routine backup into a portable secret bundle that enables account takeover, data theft, or session hijacking if exposed.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The restore steps instruct users to stop the service, rename the existing ~/.openclaw directory, and extract a backup over the home directory without any explicit warning about state replacement, compatibility, or rollback risks. This can cause accidental data loss, restore stale or compromised credentials, and disrupt active configurations if performed on the wrong system or with an untrusted archive.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The restore guide explicitly lists that backups contain highly sensitive material such as API keys, tokens, agent auth data, workspace memory, and Telegram session data, but it provides no warning about secure storage, access control, or cautious handling during restore. This can lead users to copy, store, or extract backups in insecure locations, increasing the risk of credential theft and account/session compromise.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.