Back to skill

Security audit

OpenClaw Gateway Manager

Security checks for vulnerabilities and agentic risk

Overview

This gateway manager largely matches its stated purpose, but unsafe script handling could enable persistent command execution or unintended data loss.

Review this skill carefully before installing. It can modify OpenClaw configuration, create auto-start services, restart or stop gateway processes, and delete instance directories. Only use trusted instance names and numeric ports, manually inspect generated LaunchAgent files, keep your own backups, and prefer an audited pinned release over the documented default-branch clone.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/gateway-create.sh:4
Finding

Persistent Command Injection Through Unvalidated Port Input

Content
View full analysis
/dev/null 2>&1; then echo "Port $PORT is already occupied" exit 1 fi ``` ```bash # 4. Modify the port if [ -f "$CONFIG_DIR/openclaw.json" ]; then cat "$CONFIG_DIR/openclaw.json" | jq ".gateway.port = $PORT" > "$CONFIG_DIR/openclaw.json.tmp" && mv "$CONFIG_DIR/openclaw.json.tmp" "$CONFIG_DIR/openclaw.json" fi ``` ```bash # 6. Create LaunchAgent plist cat > "$PLIST_FILE" << PLISTEOF Label ai.openclaw.gateway-$INSTANCE_NAME Comment OpenClaw Gateway - $INSTANCE_NAME (port $PORT) RunAtLoad KeepAlive ThrottleInterval 1 Umask 63 ProgramArguments $NODE_PATH -e require('child_process').execSync('openclaw gateway --port $PORT', {cwd: '$CONFIG_DIR', stdio: 'inherit', env: {...process.env, OPENCLAW_HOME: '$CONFIG_DIR'}}) StandardOutPath $CONFIG_DIR/logs/gateway.log StandardErrorPath $CONFIG_DIR/logs/gateway.err.log EnvironmentVariables HOME $HOME OPENCLAW_HOME $CONFIG_DIR OPENCLAW_GATEWAY_PORT $PORT ...[truncated 2287 chars]
Remediation
View remediation
65535 )); then echo "Invalid port: expected an integer from 1 to 65535" >&2 exit 1 fi ``` 2. Restrict instance names to a conservative allowlist: ```bash if ! [[ "$INSTANCE_NAME" =~ ^[A-Za-z0-9_-]+$ ]]; then echo "Invalid instance name" >&2 exit 1 fi ``` 3. Do not invoke OpenClaw through Node `execSync()` or another shell. Put the executable and each argument into separate `ProgramArguments` entries: ```xml ProgramArguments /absolute/path/to/openclaw gateway --port 18899 ``` 4. Resolve the absolute path of the real `openclaw` executable and reject unexpected or writable replacements. 5. Generate plist files with an XML-aware mechanism rather than unescaped heredoc interpolation. 6. Validate the plist with `plutil -lint` before loading it. 7. Make auto-start an explicit opt-in operation. Creation should not silently imply persistent startup unless the user specifically requests it. ]]>

T09 · Insecure Skill Coding Practices

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

Path Traversal and Unsafe Recursive Deletion Through Instance Name

Content
View full analysis
/dev/null # 4. Delete configuration directory echo "Deleting configuration directory: $CONFIG_DIR" rm -rf "$CONFIG_DIR" ``` ### Technical Analysis For custom instances, the script directly appends the attacker-controlled instance name to `$HOME/.openclaw-`. It does not reject path separators, `..` components, control characters, or symbolic-link-based path redirection. Quoting `"$CONFIG_DIR"` prevents shell word splitting but does not prevent filesystem traversal. A crafted instance name can cause the computed path to resolve outside the intended custom-instance namespace when a suitable traversable directory or symbolic-link hierarchy exists. The script checks only whether the resulting path is a directory. It does not canonicalize the path or confirm that the resolved target remains an immediate child ...[truncated 1510 chars]
Remediation
View remediation
&2 exit 1 fi ``` 2. Explicitly reject `/`, `\`, `..`, leading dots, control characters, and empty names. 3. Canonicalize both the expected parent and deletion target before deletion. Confirm that: - the target is not `$HOME`, `/`, or an empty path; - the target is an immediate child of the approved parent; - its basename begins with `.openclaw-`; - it is not a symbolic link; - its canonical path remains under `$HOME`. 4. Add a defensive deletion guard: ```bash case "$CONFIG_DIR" in "$HOME"/.openclaw-[A-Za-z0-9_-]*) ;; *) echo "Refusing unsafe deletion target: $CONFIG_DIR" >&2 exit 1 ;; esac ``` The shell pattern should supplement, not replace, canonical-path verification. 5. Apply equivalent validation to `PLIST_FILE` and `BACKUP_DIR`. 6. Display the canonical target and require final confirmation against that exact path. 7. Prefer moving the instance into a quarantine or trash directory before any irreversible removal. ]]>

T09 · Insecure Skill Coding Practices

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

Configuration Deletion Continues After Backup Failure

Content
View full analysis
/dev/null echo "Backup completed (recoverable within seven days)" # 4. Delete configuration directory echo "Deleting configuration directory: $CONFIG_DIR" rm -rf "$CONFIG_DIR" echo "Configuration directory deleted" ``` ### Technical Analysis The script suppresses all error output from `cp -r` and does not examine its exit status. It unconditionally reports that the backup completed and immediately executes `rm -rf` against the source. Backup failure may occur because of insufficient disk space, filesystem permission errors, quotas, I/O failures, unreadable source files, interrupted copies, or invalid paths. A partial copy may also leave an incomplete backup while the script proceeds as if all data were recoverable. The documentation and script output claim that the deleted data can be recovered within seven days, but the implementation neither verifies backup integrity nor implements a seven-day retention mechanism. ### Attack Path 1. A gateway instance contains configuration, session, memory, or credential-bearing files. 2. The backup destination becomes unavailable or unwritable, or the filesystem lacks sufficient free space. 3. The user invokes the deletion workflow and passes the confirmation prompts. 4. `cp -r` fails completely or copies only part of the source. 5. Error output is discarded through `2>/dev/null`. 6. The script falsely reports successful backup completion. 7. `rm -rf` deletes the original instance directory. 8. Restoration fails because the backup is missing or incomplete. An attacker with the ability to i ...[truncated 530 chars]
Remediation
View remediation
&2 exit 1 fi if ! cp -a -- "$CONFIG_DIR" "$BACKUP_DIR/"; then echo "Backup failed; deletion has been cancelled" >&2 exit 1 fi ``` 2. Enable strict shell behavior where compatible: ```bash set -euo pipefail ``` 3. Do not suppress backup errors. Surface actionable diagnostics to the user. 4. Verify that the expected backup directory exists, is readable, and contains the copied source before deletion. 5. For stronger assurance, compare file counts, sizes, or cryptographic manifests between the source and backup. 6. Check available disk space before starting the copy. 7. Replace immediate `rm -rf` with an atomic move into a quarantine directory. Delete quarantined instances only after a documented retention period. 8. Remove the seven-day recovery claim unless an actual cleanup policy and integrity-checked recovery mechanism are implemented. ]]>

T08 · Insecure Dependencies

Warning
Location
clawhub.json:84
Finding

Installation Instructions Retrieve an Unpinned Mutable Repository State

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (117)

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 76)May include surrounding context.

md
# Verify config
~/.jvs/.openclaw/skills/gateway-manager/scripts/gateway-verify.sh local-shrimp

# Create new instance
~/.jvs/.openclaw/skills/gateway-manager/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

The file’s instructional and guidance content is predominantly written in Chinese, with only limited English headings and closing text. Under the policy, forcing a specific language without explicit user choice or documented locale justification is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
89% confidence
Finding

This duplicate finding again captures a cluster of risky capabilities: file writes under $HOME, LaunchAgent persistence, local port scanning, and recursive deletion. In context, the document attempts to justify these actions, but the combination remains dangerous for an agent-operated skill because user confirmation and backups do not eliminate abuse or accidental destructive outcomes.

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 LaunchAgent plists, run openclaw via Node, scan local ports, and perform rm -rf on instance directories.

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

Session Persistence

Medium
Category
Rogue Agent
Confidence
89% confidence
Finding

This duplicate finding again captures a cluster of risky capabilities: file writes under $HOME, LaunchAgent persistence, local port scanning, and recursive deletion. In context, the document attempts to justify these actions, but the combination remains dangerous for an agent-operated skill because user confirmation and backups do not eliminate abuse or accidental destructive outcomes.

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 LaunchAgent plists, run openclaw via Node, scan local ports, and perform rm -rf on instance directories.

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

Session Persistence

Medium
Category
Rogue Agent
Confidence
89% confidence
Finding

This duplicate finding again captures a cluster of risky capabilities: file writes under $HOME, LaunchAgent persistence, local port scanning, and recursive deletion. In context, the document attempts to justify these actions, but the combination remains dangerous for an agent-operated skill because user confirmation and backups do not eliminate abuse or accidental destructive outcomes.

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 LaunchAgent plists, run openclaw via Node, scan local ports, and perform rm -rf on instance directories.

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

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% confidence
Finding

This section acknowledges persistent execution via launchd under the user's account. User-level persistence is still security-relevant because it creates durable execution capability, increases attack surface, and can survive the original user interaction.

Content

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

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

**审查意见:**
> The scripts create and load LaunchAgent plists (user ~/Library/LaunchAgents) and run Node-based commands persistently via launchd. This is necessary for a manager that auto-starts gateways, but it does grant persistent execution under the user's account.

**回应:**
✅ **这是必要功能** - 网关需要开机自启:

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 · README.en.md (reported line 205)May include surrounding context.

md
**回应:**
✅ **这是必要功能** - 网关需要开机自启:
- **macOS**: LaunchAgent (`~/Library/LaunchAgents/`) - 用户级,无需 sudo
- **Linux**: systemd user service (`~/.config/systemd/user/`) - 用户级
- **Windows**: 可选,不强制创建服务

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

md
**回应:**
✅ **这是必要功能** - 网关需要开机自启:
- **macOS**: LaunchAgent (`~/Library/LaunchAgents/`) - 用户级,无需 sudo
- **Linux**: systemd user service (`~/.config/systemd/user/`) - 用户级
- **Windows**: 可选,不强制创建服务

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

md
**回应:**
✅ **这是必要功能** - 网关需要开机自启:
- **macOS**: LaunchAgent (`~/Library/LaunchAgents/`) - 用户级,无需 sudo
- **Linux**: systemd user service (`~/.config/systemd/user/`) - 用户级
- **Windows**: 可选,不强制创建服务

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 198)May include surrounding context.

md
**回应:**
✅ **这是必要功能** - 网关需要开机自启:
- **macOS**: LaunchAgent (`~/Library/LaunchAgents/`) - 用户级,无需 sudo
- **Linux**: systemd user service (`~/.config/systemd/user/`) - 用户级
- **Windows**: 可选,不强制创建服务

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 372)May include surrounding context.

md
**回应:**
✅ **这是必要功能** - 网关需要开机自启:
- **macOS**: LaunchAgent (`~/Library/LaunchAgents/`) - 用户级,无需 sudo
- **Linux**: systemd user service (`~/.config/systemd/user/`) - 用户级
- **Windows**: 可选,不强制创建服务

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 · clawhub.json (reported line 99)May include surrounding context.

json
**回应:**
✅ **这是必要功能** - 网关需要开机自启:
- **macOS**: LaunchAgent (`~/Library/LaunchAgents/`) - 用户级,无需 sudo
- **Linux**: systemd user service (`~/.config/systemd/user/`) - 用户级
- **Windows**: 可选,不强制创建服务

Session Persistence

Medium
Category
Rogue Agent
Confidence
79% confidence
Finding

The feature list states that the skill modifies LaunchAgent plist files, which is a form of persistence management. In this context it is part of the product's purpose, but modifying auto-start definitions still affects session persistence and should be treated as security-sensitive behavior.

Content

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

md
## ✨ 功能

- 🔍 **智能查询** - 自动检测所有 OpenClaw 实例(本地/JVS/QClaw/云端)
- ✏️ **修改端口** - 自动修改配置文件 + LaunchAgent plist
- 🔄 **重启网关** - 安全重启指定网关或所有网关
- ✅ **验证配置** - 检查配置一致性、端口监听状态
- ➕ **创建新实例** - 一键创建新网关实例

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Earlier documentation explicitly says macOS is required and Windows/Linux are not supported. Later documentation describes automatic OS detection and Linux/Windows service-management behavior, which directly contradicts the earlier platform limitation rather than merely adding detail.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
79% confidence
Finding

The English features section again states that the skill updates LaunchAgent plist files and creates instances with LaunchAgent setup. Because this establishes or modifies auto-start behavior, it is a genuine persistence-related capability with moderate security implications.

Content

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

md
## ✨ Features

- 🔍 **Smart Status Query** - Auto-detect all OpenClaw instances
- ✏️ **Modify Ports** - Automatically update config files + LaunchAgent plist
- 🔄 **Restart Gateways** - Safely restart specific or all gateways
- ✅ **Verify Configuration** - Check config consistency and port status
- ➕ **Create Instances** - One-click creation with LaunchAgent setup

Session Persistence

Medium
Category
Rogue Agent
Confidence
86% confidence
Finding

The documentation describes creating new gateway instances with LaunchAgent setup, which implies persistence on user login/session. Persistence is expected for a gateway manager, but it still creates code that auto-starts in the user's context and can expand the blast radius if a managed instance or config is compromised.

Content

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

md
# Verify config
~/.jvs/.openclaw/skills/gateway-manager/scripts/gateway-verify.sh local-shrimp

# Create new instance
~/.jvs/.openclaw/skills/gateway-manager/scripts/gateway-create.sh test-bot 18899 openim

# Delete instance (triple confirmation)

Session Persistence

Medium
Category
Rogue Agent
Confidence
82% confidence
Finding

The same line also references the LaunchAgent plist itself, which is part of the persistence mechanism. Persisting user-level execution is not automatically malicious, but it increases risk if configuration or managed binaries are tampered with.

Content

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

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

# Linux
systemctl --user start openclaw-gateway

Session Persistence

Medium
Category
Rogue Agent
Confidence
82% confidence
Finding

The same line also references the LaunchAgent plist itself, which is part of the persistence mechanism. Persisting user-level execution is not automatically malicious, but it increases risk if configuration or managed binaries are tampered with.

Content

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

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

# Linux
systemctl --user start openclaw-gateway

Session Persistence

Medium
Category
Rogue Agent
Confidence
88% confidence
Finding

This is another duplicate of the same Chinese security-response text confirming creation of persistent LaunchAgent entries together with file write/delete capabilities. The combination is not inherently malicious, but it meaningfully increases operational and abuse risk.

Content

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

md
### 指令范围 Instruction Scope

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

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

Session Persistence

Medium
Category
Rogue Agent
Confidence
88% confidence
Finding

This is another duplicate of the same Chinese security-response text confirming creation of persistent LaunchAgent entries together with file write/delete capabilities. The combination is not inherently malicious, but it meaningfully increases operational and abuse risk.

Content

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

md
### 指令范围 Instruction Scope

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

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

Session Persistence

Medium
Category
Rogue Agent
Confidence
88% confidence
Finding

This is another duplicate of the same Chinese security-response text confirming creation of persistent LaunchAgent entries together with file write/delete capabilities. The combination is not inherently malicious, but it meaningfully increases operational and abuse risk.

Content

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

md
### 指令范围 Instruction Scope

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

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

Session Persistence

Medium
Category
Rogue Agent
Confidence
92% confidence
Finding

This section explicitly states that LaunchAgent plists are created for persistent execution. That is a true persistence-related security behavior even if it is core functionality, because it causes code to run automatically in future sessions.

Content

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

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

**审查意见:**
> Creates LaunchAgent plists for persistent execution.

**回应:**
✅ **这是必要功能** - 网关需要开机自启。

Session Persistence

Medium
Category
Rogue Agent
Confidence
82% confidence
Finding

The plist reference on this line is part of the same persistence path. It is security-relevant because LaunchAgent contents determine what auto-runs on login, so any creation or modification of that file must be tightly controlled.

Content

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

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

# Linux
systemctl --user start openclaw-gateway

Session Persistence

Medium
Category
Rogue Agent
Confidence
82% confidence
Finding

The plist reference on this line is part of the same persistence path. It is security-relevant because LaunchAgent contents determine what auto-runs on login, so any creation or modification of that file must be tightly controlled.

Content

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

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

# Linux
systemctl --user start openclaw-gateway

Session Persistence

Medium
Category
Rogue Agent
Confidence
88% confidence
Finding

This duplicate finding on the English security response is still a true persistence-related issue. The text frames persistence as necessary, but necessity does not remove the risk of unwanted auto-start if the mechanism is altered or misused.

Content

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

md
### Instruction Scope

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

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