Back to skill

Security audit

Agent State Backup

Security checks for vulnerabilities and agentic risk

Overview

The skill has a clear backup purpose, but it asks users to run unreviewed local scripts and set up a recurring cron job that can affect sensitive OpenClaw state.

Review the referenced shell scripts before using this skill, confirm their ownership and permissions, and verify the exact cron entry before enabling automatic backups. Treat restore as destructive because it overwrites current state, and make sure backup archives containing memory, user information, and knowledge files are stored with appropriate access controls.

Vulnerability Patterns
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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
Findings (2)

T06 · System Persistence

Error
Location
SKILL.md:31
Finding
Persistent Scheduled Execution Through Cron## Vulnerability Details **File Location**: `SKILL.md`, lines 31-34 **Vulnerability Type**: Scheduled cross-session execution **Risk Level**: High ### Vulnerable Code ```markdown ### 设置自动备份 (每日凌晨 2 点) ```bash ~/.openclaw/workspace/scripts/setup-backup-cron.sh ``` ``` ### Technical Analysis The Skill instructs the user to execute `setup-backup-cron.sh` to establish an automated backup task that runs every day at 02:00. A cron entry survives the current agent session and executes without subsequent user interaction, constituting system persistence. The referenced setup script is not included in the audited project. Consequently, the audit cannot verify the precise cron expression, executed command, environment, permissions, logging behavior, or whether the installation process creates additional persistent mechanisms. The scheduled target is also located in a user-writable workspace, making its future behavior dependent on the integrity of a mutable file. ### Attack Path 1. The user follows the Skill instructions and invokes `setup-backup-cron.sh`. 2. The script installs a recurring cron entry under the user's account. 3. The cron entry invokes a script from the mutable `~/.openclaw/workspace/scripts/` directory. 4. An attacker with the ability to modify that script replaces or alters it after cron installation. 5. Cron executes the modified commands automatically at the scheduled time. 6. The malicious execution repeats across sessions until the cron entry is removed. ### Impact Assessment Exploitation permits recurring command execution with the privileges of the account that owns the cron entry. This can affect all files and resources accessible to that account, including OpenClaw identity, personality, memory, user-information, knowledge-base, and backup files. It does not, based on the available evidence, grant root privileges or cross an operating-system privilege boundary by itself.
Remediation
## Remediation Suggestions - Include the cron setup and backup scripts in the reviewed package rather than referencing unavailable implementations. - Display the exact cron entry and require explicit user approval before installing it. - Resolve executable paths from a trusted, package-controlled directory instead of a mutable workspace. - Verify script ownership, restrictive permissions, and a cryptographic checksum or signature before installation and before each execution. - Ensure scripts are not writable by other users or untrusted processes. - Run the task with the minimum required account privileges and a restricted environment and `PATH`. - Document how to inspect and remove the installed cron entry. - Provide an opt-in manual backup mode that does not create persistent scheduled execution.

T07 · Tool Hijacking and Spoofing

Error
Location
SKILL.md:21
Finding
Execution of Unbundled and Unverified Local Scripts## Vulnerability Details **File Location**: `SKILL.md`, lines 21-34 **Vulnerability Type**: Unverified local tool execution **Risk Level**: High ### Vulnerable Code ```markdown ### 手动备份 ```bash ~/.openclaw/workspace/scripts/agent-backup.sh ``` ### 手动恢复 ```bash ~/.openclaw/workspace/scripts/agent-restore.sh ``` ### 设置自动备份 (每日凌晨 2 点) ```bash ~/.openclaw/workspace/scripts/setup-backup-cron.sh ``` ``` ### Technical Analysis The Skill directs the user to execute three shell scripts from `~/.openclaw/workspace/scripts/`, but none of those scripts is present in the audited project. No checksum, signature, ownership check, permission validation, trusted installation procedure, or provenance requirement is specified. Because these paths are external to the reviewed artifact and reside in a mutable user workspace, the commands executed under these names may differ from the behavior described by the Skill. A malicious or compromised local process capable of writing to that directory could pre-position or replace one of the scripts. The user would then execute attacker-controlled shell commands through a legitimate-looking documented operation. ### Attack Path 1. An attacker obtains write access to `~/.openclaw/workspace/scripts/` or causes an untrusted script to be placed there. 2. The attacker creates or replaces `agent-backup.sh`, `agent-restore.sh`, or `setup-backup-cron.sh`. 3. The user follows the instructions in `SKILL.md` and executes the expected path. 4. The attacker's shell commands run with the user's privileges. 5. If `setup-backup-cron.sh` is replaced, the attacker can additionally establish recurring execution. 6. If `agent-restore.sh` is replaced, the attacker can exploit the user's expectation that current state files will be overwritten to tamper with or destroy those files. ### Impact Assessment Successful exploitation provides arbitrary command execution with the invoking user's privi ...[truncated 382 chars]
Remediation
## Remediation Suggestions - Bundle all referenced scripts within the Skill so their complete implementations can be reviewed. - Invoke scripts through a canonical path rooted in a trusted, versioned package directory. - Publish and verify cryptographic signatures or checksums before execution. - Validate that each script is owned by the expected user and is not writable by group members, other users, or untrusted processes. - Refuse execution when symlinks, unexpected file types, insecure parent-directory permissions, or ownership mismatches are detected. - Present the script contents or a precise operation summary to the user before first execution. - Apply least privilege and avoid granting backup or restore scripts access beyond the documented state and backup directories. - Keep backup and restore operations separate from cron installation so users can authorize each capability independently.
Vulnerability Patterns
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
Findings (2)

Chaining Abuse

High
Category
Tool Misuse
Content
```bash
# 修改保留天数 (默认 7 天)
ls -t agent_backup_*.tgz | tail -n +8 | xargs -r rm
# 改为保留 30 天:tail -n +31

# 修改备份目录
Confidence
88% confidence
Finding
The retention example uses a shell pipeline ending in `xargs -r rm`, which performs deletion on filenames derived from command output without safer argument handling. If unexpected filenames are present, or if the command is run from the wrong directory, it can delete unintended files; in a backup/restore skill, destructive deletion logic is especially sensitive because it targets the very data meant to preserve state.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The main descriptive sentence is presented in Chinese, while the rest of the file is largely in another language, and there is no indication that the skill is region-specific or that users can choose their preferred language. This creates a natural-language locale policy concern because the skill imposes a language without opt-in or documented necessity.

Static analysis

No suspicious patterns detected.