Back to skill

Security audit

OpenClaw备份回滚系统

Security checks for vulnerabilities and agentic risk

Overview

This backup tool is broadly purpose-aligned, but it automatically snapshots sensitive OpenClaw data and can overwrite the live installation without enough safeguards.

Review carefully before installing. This skill may continuously copy sensitive OpenClaw state into local archives, and rollback can replace your current configuration and interrupt services. Use it only if you trust local backup storage, understand the retention behavior, and are comfortable validating backups before restore.

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/backup_rollb_plugin.py:90
Finding

Unvalidated Archive Extraction Allows Writes Outside the Intended Directory

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/backup_openclaw.sh:5
Finding

Sensitive OpenClaw State Is Stored in Unencrypted Archives Without Explicit Permission Enforcement

Content
View full analysis
/dev/null ``` The Python implementation similarly archives the complete OpenClaw directory except for a limited exclusion list: ```python BACKUP_DIR = HOME / ".openclaw" / "backups" OPENCLAW_DIR = HOME / ".openclaw" exclude = [ "--exclude=node_modules", "--exclude=.cache", "--exclude=agents/*/node_modules", "--exclude=workspace/skills/*/node_modules", "--exclude=backups", "--exclude=*/logs", "--exclude=*.log", "--exclude=media", ] cmd = [ "tar", "-czf", str(backup_file), "-C", str(OPENCLAW_DIR.parent), OPENCLAW_DIR.name ] + exclude result = subprocess.run(cmd, capture_output=True, text=True) ``` ### Technical Analysis The backup operation archives almost the entire `~/.openclaw` directory. The exclusion rules remove dependencies, caches, logs, media, and the backup directory, but do not explic ...[truncated 1873 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/backup_rollb_plugin.py:80
Finding

Restore Operation Reports Success After Failed or Partial Restoration

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (26)

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

Scanner excerpt · scripts/backup_openclaw.sh (reported line 41)May include surrounding context.

sh
# 清理旧备份(只保留MAX_BACKUPS个)
  cd "$BACKUP_DIR" || exit
  ls -t openclaw_*.tar.gz 2>/dev/null | tail -n +$((MAX_BACKUPS+1)) | xargs rm -f 2>/dev/null
  echo "[$(date)] 🧹 旧备份已清理,保留最近${MAX_BACKUPS}个"
else
  echo "[$(date)] ❌ 备份失败"

Missing User Warnings

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The rollback flow stops services and performs an in-place restore immediately, with no confirmation, dry-run, warning, or post-extraction validation. In a skill context where commands may be triggered quickly or indirectly, this materially increases the chance of accidental destructive rollback, service outage, and recovery from an untrusted or wrong backup.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation describes a rollback flow that extracts an archive over the current installation and restarts the Gateway, but it does not clearly warn users that this is a destructive operation that can overwrite the active state and cause service interruption. In an operational backup/restore skill, lack of an explicit warning can lead to accidental invocation, unintended data loss, or outage even if the underlying feature is intentional.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This manifest file describes a backup/rollback system that can restore prior versions of OpenClaw configuration, which may overwrite current state. The description presents the feature as protective but does not warn users about data reversion or configuration replacement effects.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The command descriptions for rollback advertise restoring backups but do not disclose that invoking them may replace current configuration with an older version. For markdown/manifest content, safety-sensitive behaviors affecting user data or system integrity should be accompanied by explicit warnings.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The module description and command/help text are presented only in Chinese, and the runtime usage/error strings are also fixed to Chinese. This forces a specific language for user-facing interaction without any opt-in or locale selection mechanism.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/backup_rollb_plugin.py (reported line 34)May include surrounding context.

python
name = b.stem.replace("openclaw_", "")
        date_part, time_part = name.split("_")
        ts = f"{date_part[:4]}-{date_part[4:6]}-{date_part[6:]} {time_part[:2]}:{time_part[2:4]}:{time_part[4:]}"
        size = subprocess.run(["du", "-h", str(b)], capture_output=True, text=True).stdout.split()[0]
        result.append({"timestamp": name, "time": ts, "size": size, "file": str(b)})
    return result

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/backup_rollb_plugin.py (reported line 56)May include surrounding context.

python
]
    
    cmd = ["tar", "-czf", str(backup_file), "-C", str(OPENCLAW_DIR.parent), OPENCLAW_DIR.name] + exclude
    result = subprocess.run(cmd, capture_output=True, text=True)
    
    if result.returncode == 0 and backup_file.exists():
        size = subprocess.run(["du", "-h", str(backup_file)], capture_output=True, text=True).stdout.split()[0]

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/backup_rollb_plugin.py (reported line 59)May include surrounding context.

python
result = subprocess.run(cmd, capture_output=True, text=True)
    
    if result.returncode == 0 and backup_file.exists():
        size = subprocess.run(["du", "-h", str(backup_file)], capture_output=True, text=True).stdout.split()[0]
        log(f"Backup OK: {backup_file} ({size})")
        
        # 清理旧备份

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

After a successful backup, the code silently deletes older archives beyond MAX_BACKUPS using unlink(). This is a destructive file operation, and the current implementation provides no user-facing warning or notice that retention cleanup will remove prior backups.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/backup_rollb_plugin.py (reported line 80)May include surrounding context.

python
# 备份当前状态
    pre_backup = BACKUP_DIR / f"pre_rollback_{timestamp}.tar.gz"
    exclude = ["--exclude=backups", "--exclude=media"]
    subprocess.run(
        ["tar", "-czf", str(pre_backup), "-C", str(OPENCLAW_DIR.parent), OPENCLAW_DIR.name] + exclude,
        capture_output=True
    )

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/backup_rollb_plugin.py (reported line 87)May include surrounding context.

python
# 停止服务
    for svc in ["openclaw-gateway", "vector-search", "openclaw-gateway-guardian"]:
        subprocess.run(["systemctl", "--user", "stop", svc], capture_output=True)
    
    # 解压还原
    result = subprocess.run(

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
88% confidence
Finding

Restoring by extracting a tar archive directly into the target parent directory is dangerous because archive contents are not validated before extraction. If a malicious or tampered backup is placed in the backup directory, tar may overwrite arbitrary files under the restore path or abuse symlinks/path traversal semantics, leading to destructive file replacement and possible code execution on next service start.

Content

Scanner excerpt · scripts/backup_rollb_plugin.py (reported line 90)May include surrounding context.

python
subprocess.run(["systemctl", "--user", "stop", svc], capture_output=True)
    
    # 解压还原
    result = subprocess.run(
        ["tar", "-xzf", str(backup_file), "-C", str(OPENCLAW_DIR.parent)],
        capture_output=True, text=True
    )

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/backup_rollb_plugin.py (reported line 96)May include surrounding context.

python
)
    
    # 重启服务
    subprocess.run(["systemctl", "--user", "start", "openclaw-gateway"], capture_output=True)
    
    return {"ok": True, "pre_backup": str(pre_backup), "restored": timestamp}

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/rollback.py (reported line 122)May include surrounding context.

python
)
    
    # 重启服务
    subprocess.run(["systemctl", "--user", "start", "openclaw-gateway"], capture_output=True)
    
    return {"ok": True, "pre_backup": str(pre_backup), "restored": timestamp}

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code file contains natural-language strings that force a specific language for usage instructions, which can violate language/locale policy when no user opt-in or justified regional constraint is provided. The same pattern continues in runtime messages, indicating the skill is not language-neutral or configurable.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/rollback.py (reported line 35)May include surrounding context.

python
else:
            formatted = name
        
        size = subprocess.run(
            ["du", "-h", str(b)],
            capture_output=True, text=True
        ).stdout.split()[0]

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
92% confidence
Finding

The diff feature extracts the selected backup archive into a temporary directory without validating archive members. Although the target is temporary, a malicious tarball can still use path traversal or crafted links to write outside tmpdir, which can clobber files accessible to the current user.

Content

Scanner excerpt · scripts/rollback.py (reported line 62)May include surrounding context.

python
with tempfile.TemporaryDirectory() as tmpdir:
        # 解压备份到临时目录
        subprocess.run(["tar", "-xzf", str(backup_file), "-C", tmpdir], capture_output=True)
        backup_extract = Path(tmpdir) / ".openclaw"
        
        # 对比关键配置文件

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/rollback.py (reported line 96)May include surrounding context.

python
# 先停止gateway
    print("🛑 停止 Gateway...")
    subprocess.run(["systemctl", "--user", "stop", "openclaw-gateway"], capture_output=True)
    subprocess.run(["systemctl", "--user", "stop", "vector-search"], capture_output=True)
    subprocess.run(["systemctl", "--user", "stop", "openclaw-gateway-guardian"], capture_output=True)

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/rollback.py (reported line 97)May include surrounding context.

python
# 先停止gateway
    print("🛑 停止 Gateway...")
    subprocess.run(["systemctl", "--user", "stop", "openclaw-gateway"], capture_output=True)
    subprocess.run(["systemctl", "--user", "stop", "vector-search"], capture_output=True)
    subprocess.run(["systemctl", "--user", "stop", "openclaw-gateway-guardian"], capture_output=True)
    
    openclaw_dir = Path.home() / ".openclaw"

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/rollback.py (reported line 98)May include surrounding context.

python
print("🛑 停止 Gateway...")
    subprocess.run(["systemctl", "--user", "stop", "openclaw-gateway"], capture_output=True)
    subprocess.run(["systemctl", "--user", "stop", "vector-search"], capture_output=True)
    subprocess.run(["systemctl", "--user", "stop", "openclaw-gateway-guardian"], capture_output=True)
    
    openclaw_dir = Path.home() / ".openclaw"

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/rollback.py (reported line 105)May include surrounding context.

python
# 备份当前状态
    current_backup = openclaw_dir / f"pre_rollback_{timestamp}.tar.gz"
    print("📦 备份当前状态...")
    subprocess.run(
        ["tar", "-czf", str(current_backup), "-C", str(openclaw_dir.parent), openclaw_dir.name, "--exclude=backups"],
        capture_output=True
    )

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
94% confidence
Finding

Extracting a tar.gz archive directly into the user's home-parent directory without validating archive members is dangerous because malicious backups can exploit path traversal or symlink/hardlink entries to overwrite files outside the intended .openclaw directory. Since backup files are restored from disk and treated as trusted, a poisoned archive could replace configs or other user files and compromise service behavior on restart.

Content

Scanner excerpt · scripts/rollback.py (reported line 112)May include surrounding context.

python
# 解压还原
    print("🔄 还原到备份...")
    result = subprocess.run(
        ["tar", "-xzf", str(backup_file), "-C", str(openclaw_dir.parent)],
        capture_output=True, text=True
    )

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/rollback.py (reported line 123)May include surrounding context.

python
# 重启服务
    print("🚀 重启服务...")
    subprocess.run(["systemctl", "--user", "start", "openclaw-gateway"], capture_output=True)
    subprocess.run(["systemctl", "--user", "start", "vector-search"], capture_output=True)
    subprocess.run(["systemctl", "--user", "start", "openclaw-gateway-guardian"], capture_output=True)
    
    return f"✅ 成功还原到 {timestamp},当前状态已备份到 pre_rollback_{timestamp}.tar.gz"

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/rollback.py (reported line 124)May include surrounding context.

python
print("🚀 重启服务...")
    subprocess.run(["systemctl", "--user", "start", "openclaw-gateway"], capture_output=True)
    subprocess.run(["systemctl", "--user", "start", "vector-search"], capture_output=True)
    subprocess.run(["systemctl", "--user", "start", "openclaw-gateway-guardian"], capture_output=True)
    
    return f"✅ 成功还原到 {timestamp},当前状态已备份到 pre_rollback_{timestamp}.tar.gz"