Back to skill

Security audit

OpenClaw Rescue Instances

Security checks for vulnerabilities and agentic risk

Overview

The skill has a coherent OpenClaw rescue-gateway purpose, but it creates persistent background services and has unsafe input/deletion handling that could affect unrelated user files and sensitive configuration.

Review this skill carefully before installing. Use it only if you are comfortable with macOS user-level background services that auto-start and restart, copied OpenClaw configuration files, and destructive cleanup scripts. The scripts should be hardened with strict instance/port validation, confirmation before deletion, canonical path checks, minimal non-secret config generation, and an explicit opt-in for persistence.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • System PersistenceInstalls backdoors, hooks, services, or scheduled tasks that survive the run
  • 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
Findings (4)

T06 · System Persistence

Error
Location
scripts/create-rescue-instance.sh:48
Finding

Mandatory Persistent LaunchAgent Registration

Content
View full analysis
RunAtLoad KeepAlive ThrottleInterval 1 ``` ```bash # 4. 加载并启动服务 launchctl load "$PLIST_FILE" echo "✓ 服务已加载" ``` ### Technical Analysis The script creates and loads a macOS LaunchAgent for every rescue instance. `RunAtLoad` causes the gateway to start whenever the user session loads, while `KeepAlive` causes `launchd` to restart it whenever it exits. The registration therefore survives completion of the Skill invocation and establishes a continuously running background process. LaunchAgent integration is disclosed as a feature in `SKILL.md`, so the behavior is not hidden. However, persistence is mandatory: the script provides no non-persistent mode, consent prompt, expiration mechanism, or separate opt-in switch. Merely creating or temporarily starting a rescue gateway does not inherently require cross-session autostart or continuous automatic restart. The service runs with the privileges of the invoking user and uses a copied OpenClaw configuration. It can therefore retain access to user-level files and any credentials present in that configuration for substantially longer than the initiating task. ### Attack Path 1. A user or agent invokes `create-rescue-instance.sh`. 2. The script writes a plist into `~/Library/LaunchAgents/`. 3. The plist enables both `RunAtLoad` and `KeepAlive`. 4. `launchctl load` immediately registers and starts the service. 5. The gateway remains registered after the Skill invocation finishes. 6. The gateway starts during later login sessions and is restarted after termination until explicitly removed. ### Impact Assessment The persistent process obtains the same user-level privileges as the invoking account. It may c ...[truncated 532 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/delete-rescue-instance.sh:17
Finding

Arbitrary User-Directory Deletion Through Path Traversal

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/create-rescue-instance.sh:7
Finding

Unvalidated Arguments Embedded into Paths, Configuration, and LaunchAgent XML

Content
View full analysis
"$PLIST_FILE" << EOF Label ai.openclaw.gateway-$RESCUE_NAME ``` ```bash --port $PORT ``` ```bash OPENCLAW_CONFIG_PATH $RESCUE_DIR/openclaw.json OPENCLAW_STATE_DIR $RESCUE_DIR OPENCLAW_GATEWAY_PORT $PORT ``` ### Technical Analysis Neither `INSTANCE_NUM` nor `PORT` is validated before use. These values flow into: - Arithmetic expansion. - Directory and plist paths. - `sed` replacement expressions. - JSON configuration content. - XML text nodes in the generated LaunchAgent. - Gateway command-line arguments and environment variables. Quoting the shell variables does not make them safe for these destination syntaxes. Path separators and traversal components remain meaningful to the filesystem. XML metacharacters such as `<`, `>`, and `&` are not escaped. Newlines and replacement metacharacters can affect tex ...[truncated 2132 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/create-rescue-instance.sh:16
Finding

Unrestricted Duplication of Potentially Sensitive Primary Configuration

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
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (28)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
60% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

健康检查

for port in 8080 19001 20000 30000 40000; do curl -sk https://localhost:$port/health && echo " ($port)" done

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
60% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/quick-reference.md (reported line 31)May include surrounding context.

健康检查

for port in 8080 19001 20000 30000 40000; do curl -sk https://localhost:$port/health && echo " ($port)" done

text

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill explicitly supports deleting rescue instances, and later example dialogue shows removal of the service and deletion of the instance directory. The documentation does not warn users that this can remove configuration, sessions, credentials, logs, and agent data, which affects user data and system state.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

The skill explicitly creates a macOS LaunchAgent plist, which establishes persistence for the gateway instance. Persistence is not inherently malicious, but in security terms it increases the blast radius of any misconfiguration or compromise by ensuring the service restarts automatically and may continue handling stored sessions and credentials over time.

Content

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

└── agents/ # 独立 Agent 数据

~/Library/LaunchAgents/ └── ai.openclaw.gateway-rescueN.plist # LaunchAgent 服务

text

---

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file contains user-facing operational instructions exclusively in Chinese, and there is no accompanying note that the language is optional, selectable, or justified by a region-specific requirement. Under the language/locale policy rule, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

This duplicate finding corresponds to the same launchctl load operation and same persistence risk: it registers and starts a user-level background process that survives beyond the script's execution. In context the behavior is not covert, but it still creates durable execution and should be gated more safely.

Content

Scanner excerpt · scripts/create-rescue-instance.sh (reported line 99)May include surrounding context.

sh
echo "✓ 服务文件:$PLIST_FILE"

# 4. 加载并启动服务
launchctl load "$PLIST_FILE"
echo "✓ 服务已加载"

# 5. 等待启动并检查

Session Persistence

Medium
Category
Rogue Agent
Confidence
85% confidence
Finding

This duplicate finding corresponds to the same launchctl load operation and same persistence risk: it registers and starts a user-level background process that survives beyond the script's execution. In context the behavior is not covert, but it still creates durable execution and should be gated more safely.

Content

Scanner excerpt · scripts/create-rescue-instance.sh (reported line 99)May include surrounding context.

sh
echo "✓ 服务文件:$PLIST_FILE"

# 4. 加载并启动服务
launchctl load "$PLIST_FILE"
echo "✓ 服务已加载"

# 5. 等待启动并检查

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · references/quick-reference.md (reported line 62)May include surrounding context.

md
fi

RESCUE_DIR="$HOME/.openclaw-$RESCUE_NAME"
PLIST_FILE="$HOME/Library/LaunchAgents/ai.openclaw.gateway-$RESCUE_NAME.plist"

echo "=== 删除救援实例 $RESCUE_NAME ==="

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/create-rescue-instance.sh (reported line 35)May include surrounding context.

sh
fi

RESCUE_DIR="$HOME/.openclaw-$RESCUE_NAME"
PLIST_FILE="$HOME/Library/LaunchAgents/ai.openclaw.gateway-$RESCUE_NAME.plist"

echo "=== 删除救援实例 $RESCUE_NAME ==="

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/create-rescue-instance.sh (reported line 36)May include surrounding context.

sh
fi

RESCUE_DIR="$HOME/.openclaw-$RESCUE_NAME"
PLIST_FILE="$HOME/Library/LaunchAgents/ai.openclaw.gateway-$RESCUE_NAME.plist"

echo "=== 删除救援实例 $RESCUE_NAME ==="

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/create-rescue-instance.sh (reported line 39)May include surrounding context.

sh
fi

RESCUE_DIR="$HOME/.openclaw-$RESCUE_NAME"
PLIST_FILE="$HOME/Library/LaunchAgents/ai.openclaw.gateway-$RESCUE_NAME.plist"

echo "=== 删除救援实例 $RESCUE_NAME ==="

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/create-rescue-instance.sh (reported line 40)May include surrounding context.

sh
fi

RESCUE_DIR="$HOME/.openclaw-$RESCUE_NAME"
PLIST_FILE="$HOME/Library/LaunchAgents/ai.openclaw.gateway-$RESCUE_NAME.plist"

echo "=== 删除救援实例 $RESCUE_NAME ==="

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/create-rescue-instance.sh (reported line 94)May include surrounding context.

sh
fi

RESCUE_DIR="$HOME/.openclaw-$RESCUE_NAME"
PLIST_FILE="$HOME/Library/LaunchAgents/ai.openclaw.gateway-$RESCUE_NAME.plist"

echo "=== 删除救援实例 $RESCUE_NAME ==="

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/delete-rescue-instance.sh (reported line 25)May include surrounding context.

sh
fi

RESCUE_DIR="$HOME/.openclaw-$RESCUE_NAME"
PLIST_FILE="$HOME/Library/LaunchAgents/ai.openclaw.gateway-$RESCUE_NAME.plist"

echo "=== 删除救援实例 $RESCUE_NAME ==="

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/create-rescue-instance.sh (reported line 36)May include surrounding context.

sh
fi

RESCUE_DIR="$HOME/.openclaw-$RESCUE_NAME"
PLIST_FILE="$HOME/Library/LaunchAgents/ai.openclaw.gateway-$RESCUE_NAME.plist"

echo "=== 删除救援实例 $RESCUE_NAME ==="

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/create-rescue-instance.sh (reported line 37)May include surrounding context.

sh
fi

RESCUE_DIR="$HOME/.openclaw-$RESCUE_NAME"
PLIST_FILE="$HOME/Library/LaunchAgents/ai.openclaw.gateway-$RESCUE_NAME.plist"

echo "=== 删除救援实例 $RESCUE_NAME ==="

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/create-rescue-instance.sh (reported line 39)May include surrounding context.

sh
fi

RESCUE_DIR="$HOME/.openclaw-$RESCUE_NAME"
PLIST_FILE="$HOME/Library/LaunchAgents/ai.openclaw.gateway-$RESCUE_NAME.plist"

echo "=== 删除救援实例 $RESCUE_NAME ==="

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/create-rescue-instance.sh (reported line 96)May include surrounding context.

sh
fi

RESCUE_DIR="$HOME/.openclaw-$RESCUE_NAME"
PLIST_FILE="$HOME/Library/LaunchAgents/ai.openclaw.gateway-$RESCUE_NAME.plist"

echo "=== 删除救援实例 $RESCUE_NAME ==="

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/delete-rescue-instance.sh (reported line 25)May include surrounding context.

sh
fi

RESCUE_DIR="$HOME/.openclaw-$RESCUE_NAME"
PLIST_FILE="$HOME/Library/LaunchAgents/ai.openclaw.gateway-$RESCUE_NAME.plist"

echo "=== 删除救援实例 $RESCUE_NAME ==="

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/delete-rescue-instance.sh (reported line 30)May include surrounding context.

sh
fi

RESCUE_DIR="$HOME/.openclaw-$RESCUE_NAME"
PLIST_FILE="$HOME/Library/LaunchAgents/ai.openclaw.gateway-$RESCUE_NAME.plist"

echo "=== 删除救援实例 $RESCUE_NAME ==="

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/delete-rescue-instance.sh (reported line 31)May include surrounding context.

sh
fi

RESCUE_DIR="$HOME/.openclaw-$RESCUE_NAME"
PLIST_FILE="$HOME/Library/LaunchAgents/ai.openclaw.gateway-$RESCUE_NAME.plist"

echo "=== 删除救援实例 $RESCUE_NAME ==="

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/delete-rescue-instance.sh (reported line 32)May include surrounding context.

sh
fi

RESCUE_DIR="$HOME/.openclaw-$RESCUE_NAME"
PLIST_FILE="$HOME/Library/LaunchAgents/ai.openclaw.gateway-$RESCUE_NAME.plist"

echo "=== 删除救援实例 $RESCUE_NAME ==="

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% 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 · scripts/delete-rescue-instance.sh (reported line 35)May include surrounding context.

sh
fi

RESCUE_DIR="$HOME/.openclaw-$RESCUE_NAME"
PLIST_FILE="$HOME/Library/LaunchAgents/ai.openclaw.gateway-$RESCUE_NAME.plist"

echo "=== 删除救援实例 $RESCUE_NAME ==="

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script performs irreversible deletion of a LaunchAgent plist and a directory using rm and rm -rf based solely on a user-supplied instance name, with no confirmation, dry-run mode, or additional validation. While this appears to be an administrative cleanup utility rather than malware, destructive operations without safeguards increase the risk of accidental data loss, especially if an unexpected or mistyped instance name is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill's natural-language instructions, examples, and user interaction text are entirely in Chinese, which implicitly forces a specific language for users. The file does not offer an opt-in language choice or explain that the skill is intentionally region- or locale-specific.

Content

No source excerpt is available for this finding.