Back to skill

Security audit

Openclaw Gateway Manager

Security checks for vulnerabilities and agentic risk

Overview

The skill is a real OpenClaw gateway manager, but its scripts can create persistent user services and perform destructive file/process actions without enough input validation.

Review before installing. Only use this skill with trusted instance names and numeric ports, avoid letting an agent pass untrusted arguments to its scripts, and do not run create/delete workflows until the package validates ports, constrains instance names to safe identifiers, canonicalizes target paths, and verifies process identity before killing anything.

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/common.sh:216
Finding

Unchecked arguments allow persistent command injection through generated service definitions

Content
View full analysis
"$CONFIG_DIR/openclaw.json.tmp" && mv "$CONFIG_DIR/openclaw.json.tmp" "$CONFIG_DIR/openclaw.json" echo "✅ 端口已设置为:$PORT" fi if create_service_file "$INSTANCE_KEY" "$CONFIG_DIR" "$PORT" "$SERVICE_FILE"; then echo "✅ 服务文件已创建:$SERVICE_FILE" else echo "ℹ️ 当前系统仅创建配置目录,服务请手动启动" fi if enable_service "$INSTANCE_KEY" "$SERVICE_FILE"; then ``` From `scripts/gateway-set-port.sh`: ```bash INSTANCE="$1" NEW_PORT="$2" ``` ```bash jq ".gateway.port = $NEW_PORT" "$CONFIG_FILE" > "$CONFIG_FILE.tmp" && mv "$CONFIG_FILE.tmp" "$CONFIG_FILE" echo "✅ 配置文件已更新:$CONFIG_FILE" if [ -d "$CONFIG_DIR/.openclaw" ]; then cp "$CONFIG_FILE" "$CONFIG_DIR/.openclaw/openclaw.json" echo "✅ 嵌套配置已同步" fi if [ -n "$SERVICE_FILE" ] && [ -f "$SERVICE_FILE" ]; then create_service_file "$INSTANCE_KEY" "$CONFIG_DIR" "$NEW_PORT" "$SERVICE_FILE" echo "✅ 服务文件已更新:$SERVICE_FILE" else echo "⚠️ 未找到服务文件,将仅更新配置" fi ``` From the macOS service template in `scripts/common.sh`: ```bash require('child_process').execSync('openclaw gateway --port $port', {cwd: '$config_dir', stdio: 'inherit', env: {...process.env, OPENCLAW_HOME: '$config_dir'}}) ``` From the Linux systemd service template in `scripts/common.sh`: ```bash [Service] Type=simple WorkingDirectory=$config_dir Environment=OPENCLAW_HOME=$config_dir Environment=OPENCLAW_GATEWAY_PORT=$port ExecStart=/bin/sh -lc 'openclaw gateway --port $port' Restart=always RestartSec=2 StandardOutput=append:$config_dir/logs/ ...[truncated 3013 chars]
Remediation
View remediation
&2 exit 1 ;; esac if [ "$PORT" -lt 1 ] || [ "$PORT" -gt 65535 ]; then echo "Invalid port: expected a value from 1 to 65535" >&2 exit 1 fi ``` 2. Restrict instance identifiers to a conservative format, such as: ```bash case "$INSTANCE_NAME" in ''|*[!A-Za-z0-9_-]*) echo "Invalid instance name" >&2 exit 1 ;; esac ``` Also impose a reasonable maximum length. 3. Do not use `/bin/sh -lc` or JavaScript `execSync` with a constructed command string. Launch the executable with fixed, separately encoded arguments. On macOS, use `ProgramArguments` entries for the executable and each argument rather than executing a shell through Node. 4. Use a fixed, absolute path to the trusted `openclaw` executable after verifying it is a regular executable owned by an expected user or package source. 5. Escape all values for their destination format. XML escaping, systemd argument encoding, shell quoting, and JavaScript string escaping are different operations and must not be treated as interchangeable. 6. Abort immediately when `jq`, service generation, or validation fails. Generate a temporary file, validate it, set restrictive permissions, and atomically move it into place only after all checks succeed. 7. Validate generated LaunchAgent files with `plutil` and generated systemd units with an appropriate unit verifier before enabling them. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/gateway-delete.sh:41
Finding

Unvalidated instance names allow path traversal in creation, service-file handling, backup, and recursive deletion

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/gateway-delete.sh:42
Finding

Instance deletion can terminate an unrelated process solely because it listens on the configured port

Content
View full analysis
/dev/null sleep 2 echo "✅ 进程已停止" fi fi ``` The shared lookup helper selects a listener based only on the port: ```bash port_pid() { local port="$1" if command -v lsof >/dev/null 2>&1; then lsof -nP -iTCP:"$port" -sTCP:LISTEN 2>/dev/null | awk 'NR>1 {print $2; exit}' return 0 fi if command -v ss >/dev/null 2>&1; then ss -lntp 2>/dev/null | awk -v port=":$port" '$4 ~ port {gsub(/.*pid=/, "", $NF); gsub(/,.*/, "", $NF); print $NF; exit}' return 0 fi if command -v netstat >/dev/null 2>&1; then netstat -tlnp 2>/dev/null | awk -v port=":$port" '$4 ~ port {split($7, a, "/"); print a[1]; exit}' fi } ``` ### Technical Analysis A listening port is not a reliable process identity. The configured gateway may already have stopped, its port may have changed, or the configuration may have been modified. Another application can subsequently bind to that port. The script does not verify that the discovered PID: - Belongs to the current user. - Runs the expected `openclaw` executable. - Has the expected command line. - Uses the selected instance's `OPENCLAW_HOME`. - Is owned by the generated service definition. The process is killed before the known service is stopped. This increases the likelihood of terminating an unrelated process and can also allow a managed servic ...[truncated 1177 chars]
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (51)

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/common.sh (reported line 214)May include surrounding context.

sh
delete_service_file() {
    local service_file="$1"
    [ -n "$service_file" ] && [ -f "$service_file" ] && rm -f "$service_file"
}

create_service_file() {

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% 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 · README.en.md (reported line 81)May include surrounding context.

md
# Verify config
./scripts/gateway-verify.sh local-shrimp

# Create new instance
./scripts/gateway-create.sh test-bot 18899 openim

# Delete instance (triple confirmation)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This README is written entirely in Chinese and does not indicate that language selection is optional within the document itself. The policy requires flagging language or locale constraints when a specific language is imposed without user opt-in; although an English README is linked, the current file still presents the skill documentation in a single forced language.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
82% confidence
Finding

This duplicate finding reflects the same core issue: the document accepts script-driven writes to $HOME, persistent user services, local port scanning, Node execution, and rm -rf deletion as normal behavior. Those actions are within product scope, but they remain security-sensitive and could be abused or cause harm if triggered unintentionally, misleadingly, or against the wrong paths.

Content

Scanner excerpt · SECURITY_RESPONSE.md (reported line 8)May include surrounding context.

md
### ℹ Instruction Scope 指令范围

**审查意见:**
> SKILL.md tells the agent to run the included scripts. The scripts read and write user files under $HOME, create and load user-level service definitions, run openclaw via Node, scan local ports, and perform rm -rf on instance directories.

**回应:**
✅ **这是预期行为** - 作为网关管理器,这些操作是必要的:

Session Persistence

Medium
Category
Rogue Agent
Confidence
82% confidence
Finding

This duplicate finding reflects the same core issue: the document accepts script-driven writes to $HOME, persistent user services, local port scanning, Node execution, and rm -rf deletion as normal behavior. Those actions are within product scope, but they remain security-sensitive and could be abused or cause harm if triggered unintentionally, misleadingly, or against the wrong paths.

Content

Scanner excerpt · SECURITY_RESPONSE.md (reported line 8)May include surrounding context.

md
### i Instruction Scope 指令范围

**审查意见:**
> SKILL.md tells the agent to run the included scripts. The scripts read and write user files under $HOME, create and load user-level service definitions, run openclaw via Node, scan local ports, and perform rm -rf on instance directories.

**回应:**
✅ **这是预期行为** - 作为网关管理器,这些操作是必要的:

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

Referencing transparent plist files is not itself dangerous, but in context it confirms creation of LaunchAgent persistence artifacts. User-level persistence is still a meaningful security concern because it allows code to auto-start on login and survive across sessions under the user's account.

Content

Scanner excerpt · SECURITY_RESPONSE.md (reported line 40)May include surrounding context.

md
- ✅ 仅创建**用户级**服务,不需要系统权限
- ✅ 每个用户独立管理
- ✅ 可以随时卸载(`gateway-delete.sh`)
- ✅ plist 文件透明,用户可以审查

**改进(跨平台):**
- ✅ macOS: LaunchAgent (用户级)

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

This line again confirms use of reviewable plist-based user services, which implies persistence rather than a transient action. Transparency helps, but it does not remove the underlying risk of establishing auto-start behavior for managed processes.

Content

Scanner excerpt · SECURITY_RESPONSE.md (reported line 95)May include surrounding context.

md
| 三重确认 | ✅ | 删除需要 3 次确认 |
| 自动备份 | ✅ | 删除前自动备份 |
| 用户级服务 | ✅ | 不需要 sudo |
| 透明配置 | ✅ | plist 文件可审查 |
| 安全文档 | ✅ | SKILL.md + clawhub.json |
| 依赖检查 | ✅ | check-dependencies.sh |
| 路径安全 | ✅ | 使用 $HOME 而非硬编码 |

Session Persistence

Medium
Category
Rogue Agent
Confidence
75% confidence
Finding

This service-management guidance states that the tool creates user-level services that can be reviewed and uninstalled, which still indicates session persistence. In context, the danger is moderated by user scope and uninstallability, but persistent execution remains a real security-relevant capability.

Content

Scanner excerpt · SECURITY_RESPONSE.md (reported line 142)May include surrounding context.

md
3. **服务管理**
   - 仅创建用户级服务
   - 可以随时卸载
   - 审查 plist 文件

---

Session Persistence

Medium
Category
Rogue Agent
Confidence
80% confidence
Finding

The documentation advertises creation of new instances and elsewhere describes automatic user-level service setup for persistence. Even without system privileges, creating persistent LaunchAgent/systemd user services enables code to auto-start on login, which is a meaningful persistence capability in an agent skill.

Content

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

md
# Verify config
./scripts/gateway-verify.sh local-shrimp

# Create new instance
./scripts/gateway-create.sh test-bot 18899 openim

# Delete instance (triple confirmation)

Session Persistence

Medium
Category
Rogue Agent
Confidence
93% confidence
Finding

The reference to a LaunchAgent plist at this line is part of a persistence mechanism, since such plists define programs that run automatically for the user. Even if legitimate for a gateway manager, persistence should be treated as a security-sensitive capability in an agent-delivered skill.

Content

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

bash
# macOS
launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist

# Linux
systemctl --user start ai.openclaw.gateway-<name>

Session Persistence

Medium
Category
Rogue Agent
Confidence
93% confidence
Finding

The reference to a LaunchAgent plist at this line is part of a persistence mechanism, since such plists define programs that run automatically for the user. Even if legitimate for a gateway manager, persistence should be treated as a security-sensitive capability in an agent-delivered skill.

Content

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

bash
# macOS
launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist

# Linux
systemctl --user start ai.openclaw.gateway-<name>

Session Persistence

Medium
Category
Rogue Agent
Confidence
92% confidence
Finding

This duplicate finding points to the same acknowledged behavior: writing user files, creating persistence, scanning ports, and deleting paths. In aggregate, these are real security-sensitive operations in a skill and deserve treatment as a true persistence-related risk.

Content

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

md
### 指令范围 Instruction Scope

**审查意见:**
> Scripts read/write user files, create user-level service definitions, scan ports, and perform rm -rf.

**回应:**
✅ **这是预期行为** - 作为网关管理器,这些操作是必要的。

Session Persistence

Medium
Category
Rogue Agent
Confidence
92% confidence
Finding

This duplicate finding points to the same acknowledged behavior: writing user files, creating persistence, scanning ports, and deleting paths. In aggregate, these are real security-sensitive operations in a skill and deserve treatment as a true persistence-related risk.

Content

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

md
### 指令范围 Instruction Scope

**审查意见:**
> Scripts read/write user files, create user-level service definitions, scan ports, and perform rm -rf.

**回应:**
✅ **这是预期行为** - 作为网关管理器,这些操作是必要的。

Session Persistence

Medium
Category
Rogue Agent
Confidence
88% confidence
Finding

This line states that plist files are created and auditable, which still confirms persistence-related artifact creation. Transparency helps, but it does not remove the security risk that auto-start entries can survive the original interaction.

Content

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

md
- ✅ 三重确认机制
- ✅ 自动备份到 `~/.openclaw-deleted-backups/`
- ✅ 仅创建用户级服务(无需 sudo)
- ✅ 透明配置(plist 文件可审查)
- ✅ 完整文档(SKILL.md + SECURITY_RESPONSE.md)

### 持久性和权限 Persistence & Privilege

Session Persistence

Medium
Category
Rogue Agent
Confidence
93% confidence
Finding

The plist mention here accompanies LaunchAgent loading instructions and therefore indicates user-session persistence. In the context of a skill repository, that is a real security-relevant capability, not just harmless documentation.

Content

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

bash
# macOS
launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist

# Linux
systemctl --user start ai.openclaw.gateway-<name>

Session Persistence

Medium
Category
Rogue Agent
Confidence
93% confidence
Finding

The plist mention here accompanies LaunchAgent loading instructions and therefore indicates user-session persistence. In the context of a skill repository, that is a real security-relevant capability, not just harmless documentation.

Content

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

bash
# macOS
launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist

# Linux
systemctl --user start ai.openclaw.gateway-<name>

Session Persistence

Medium
Category
Rogue Agent
Confidence
92% confidence
Finding

The English security response confirms that the scripts create persistent user-level service definitions and modify user files. Persistence in an agent skill is dangerous because it survives the immediate task and can continue running or be repurposed later without fresh user intent.

Content

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

md
### Instruction Scope

**Review Feedback:**
> Scripts read/write user files, create user-level service definitions, scan ports, and perform rm -rf.

**Response:**
✅ **This is intended behavior** - These operations are necessary for a gateway manager.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

md
**Safety Measures:**
- ✅ Triple confirmation mechanism
- ✅ Automatic backup to `~/.openclaw-deleted-backups/`
- ✅ User-level services only (no sudo required)
- ✅ Transparent configuration (plist files auditable)
- ✅ Complete documentation (SKILL.md + SECURITY_RESPONSE.md)

Session Persistence

Medium
Category
Rogue Agent
Confidence
88% confidence
Finding

This line confirms the use of auditable plist files for persistence. While the author frames this as a safety feature, persistent startup entries remain potentially dangerous because they outlive the current task and can be abused if the managed executable or config is later altered.

Content

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

md
- ✅ Triple confirmation mechanism
- ✅ Automatic backup to `~/.openclaw-deleted-backups/`
- ✅ User-level services only (no sudo required)
- ✅ Transparent configuration (plist files auditable)
- ✅ Complete documentation (SKILL.md + SECURITY_RESPONSE.md)

### Persistence & Privilege

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The entire markdown file is written in Chinese and does not provide any language choice, opt-in, or explanation that the content is intended only for a Chinese-speaking or region-specific audience. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script's natural-language interface is entirely in Chinese, including the header comment and all user-facing echo messages. Under the policy, forcing a specific language without opt-in or a documented region-specific justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

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 · SECURITY_RESPONSE.md (reported line 123)May include surrounding context.

md
service_name="$(instance_service_name "$instance")"

    case "$(service_kind)" in
        launchagent) echo "$HOME/Library/LaunchAgents/$service_name.plist" ;;
        systemd-user) echo "$HOME/.config/systemd/user/$service_name.service" ;;
        *) echo "" ;;
    esac

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/common.sh (reported line 51)May include surrounding context.

sh
service_name="$(instance_service_name "$instance")"

    case "$(service_kind)" in
        launchagent) echo "$HOME/Library/LaunchAgents/$service_name.plist" ;;
        systemd-user) echo "$HOME/.config/systemd/user/$service_name.service" ;;
        *) echo "" ;;
    esac

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/common.sh (reported line 262)May include surrounding context.

sh
service_name="$(instance_service_name "$instance")"

    case "$(service_kind)" in
        launchagent) echo "$HOME/Library/LaunchAgents/$service_name.plist" ;;
        systemd-user) echo "$HOME/.config/systemd/user/$service_name.service" ;;
        *) echo "" ;;
    esac

Session Persistence

Medium
Category
Rogue Agent
Confidence
94% confidence
Finding

This finding points to the same unsafe LaunchAgent generation site: untrusted data is inserted into a persistent service definition and into a JavaScript execSync payload. In this skill context, that is more dangerous than ordinary persistence because the persistence artifact can become the execution vehicle for injected commands.

Content

Scanner excerpt · scripts/common.sh (reported line 233)May include surrounding context.

sh
mkdir -p "$(dirname "$service_file")" "$config_dir/logs"
            cat > "$service_file" <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/common.sh:246