Back to skill

Security audit

OpenClaw 沙盒测试系统

Security checks for vulnerabilities and agentic risk

Overview

The skill appears intended for OpenClaw sandbox testing, but its scripts can affect live configuration and leave a localhost gateway running while overstating safety guarantees.

Review this carefully before installing. It is best treated as an operational helper for experienced OpenClaw users, not a zero-risk sandbox. Do not run it on shared machines or production systems without first changing the static token, using a unique secure temporary directory, disabling third-party plugins by default, adding a reliable stop/cleanup path for the background Gateway, and verifying backups and rollback manually before any live Gateway restart.

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 (3)

T09 · Insecure Skill Coding Practices

Error
Location
templates/safe-try.sh:75
Finding
Predictable Temporary Directory Enables Symlink-Based File Overwrite<![CDATA[ ## Vulnerability Details **File Location**: `templates/safe-try.sh:17-20, 75-81` **Vulnerability Type**: Unsafe predictable temporary file and directory usage **Risk Level**: High ### Vulnerable Code ```bash SANDBOX_DIR="/tmp/openclaw-sandbox-3.8" SANDBOX_CONFIG="$SANDBOX_DIR/.openclaw/openclaw.json" PROD_CONFIG="$HOME/.openclaw/openclaw.json" BACKUP_DIR="$HOME/.openclaw/backups" ``` ```bash create_sandbox_dir() { echo -e "${BLUE}[2/6] 创建沙盒目录(配置隔离 + 插件隔离)...${NC}" # 创建独立目录(不复制生产!) mkdir -p $SANDBOX_DIR/.openclaw/{extensions,agents/writer,agents/media,logs,backups} # 创建独立配置(空插件列表) cat > $SANDBOX_CONFIG << 'EOF' ``` ### Technical Analysis The script creates its sandbox under the fixed, publicly predictable path `/tmp/openclaw-sandbox-3.8`. It does not reject a pre-existing directory, verify path ownership, check for symbolic links, or create the directory atomically. The `cat > $SANDBOX_CONFIG` redirection follows symbolic links. A local attacker who can write to `/tmp` can therefore pre-create the expected directory hierarchy and make `openclaw.json` a symbolic link to another file writable by the victim. When the victim runs the script, the shell opens and truncates the symlink target before executing `cat`. The same predictable hierarchy is subsequently used for logs, backups, and the Gateway PID file, expanding the opportunity for local path-manipulation attacks. The unquoted path expansions are also unsafe coding practice, although the current hardcoded path contains no whitespace. ### Attack Path 1. A local attacker creates `/tmp/openclaw-sandbox-3.8/.openclaw`. 2. The attacker creates `openclaw.json` as a symbolic link to a file writable by the intended victim. 3. The victim invokes `templates/safe-try.sh`. 4. `mkdir -p` accepts the attacker-prepared hierarchy because it already exists. 5. The shell processes `cat > $SANDBOX_CONFIG` and follows the symbolic link. 6. The linked target is truncated and overwr ...[truncated 744 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Create a unique sandbox atomically with `mktemp -d`, for example: ```bash umask 077 SANDBOX_DIR="$(mktemp -d "${TMPDIR:-/tmp}/openclaw-sandbox.XXXXXXXX")" ``` 2. Abort if secure temporary-directory creation fails. 3. Do not reuse a pre-existing fixed path. 4. Quote every path expansion: ```bash mkdir -p "$SANDBOX_DIR/.openclaw/extensions" cat > "$SANDBOX_CONFIG" <<'EOF' ``` 5. Ensure generated configuration and token-bearing files have mode `0600`. 6. Validate that critical files are regular files owned by the current user and are not symbolic links before writing. 7. Register cleanup handlers that stop the spawned Gateway and remove only the uniquely created directory: ```bash trap cleanup EXIT INT TERM ``` 8. Where supported, use no-follow or exclusive-creation semantics rather than ordinary shell redirection for security-sensitive files. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
templates/safe-try.sh:87
Finding
Sandbox Gateway Uses a Static Publicly Disclosed Authentication Token<![CDATA[ ## Vulnerability Details **File Location**: `templates/safe-try.sh:87-92, 167, 225` **Vulnerability Type**: Hardcoded authentication credential **Risk Level**: Medium ### Vulnerable Code ```bash "gateway": { "auth": { "mode": "token", "token": "sandbox-token-xxx" }, "port": 18800, ``` ```bash echo -e "${BLUE}WebUI: http://127.0.0.1:18800/#token=sandbox-token-xxx${NC}" ``` ```bash echo -e "${BLUE}WebUI: ${NC} http://127.0.0.1:18800/#token=sandbox-token-xxx" ``` ### Technical Analysis Every invocation uses the same hardcoded token, `sandbox-token-xxx`. The value is available in the distributed source code, written to a predictable temporary configuration file, and printed in terminal output as part of a URL. A token only provides authentication when it is unpredictable and appropriately protected. Because this value is constant and publicly known, it does not meaningfully distinguish authorized users from attackers who can reach the service. Binding the Gateway to loopback reduces direct remote exposure but does not eliminate the risk. Other users and processes on the same host can connect to loopback services. Shared terminal logs, shell transcripts, process automation, and browser interactions with localhost may further expose or use the token. ### Attack Path 1. An attacker obtains the constant token from the published Skill source. 2. The victim starts the sandbox Gateway on loopback port 18800. 3. The attacker monitors or probes the local port until the service is available. 4. The attacker connects to `127.0.0.1:18800` and authenticates with `sandbox-token-xxx`. 5. The attacker accesses any Gateway operations authorized by that sandbox token. This path requires the attacker to be able to reach the victim's loopback service, such as by running another process under the same host or local user environment. ### Impact Assessment A successful attacker can obtain the permissions exposed by the sandbox Gat ...[truncated 425 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Generate a cryptographically random token for every sandbox run, for example: ```bash SANDBOX_TOKEN="$(openssl rand -hex 32)" ``` 2. Inject the generated value into the configuration without committing it to source control. 3. Apply `umask 077` and mode `0600` to files containing the token. 4. Do not print the token inside a URL. If it must be shown, display it only when explicitly requested and avoid persistent logs. 5. Use a unique port or a securely created per-run endpoint where supported. 6. Stop the Gateway immediately after testing and remove token-bearing temporary files through an `EXIT`, `INT`, and `TERM` cleanup trap. 7. Consider additional local access controls, such as Unix-domain sockets or per-user process isolation, if OpenClaw supports them. ]]>

T08 · Insecure Dependencies

Warning
Location
templates/safe-try.sh:108
Finding
Sandbox Automatically Enables an Unpinned Third-Party Plugin<![CDATA[ ## Vulnerability Details **File Location**: `templates/safe-try.sh:108-112` **Vulnerability Type**: Unsafe third-party dependency activation **Risk Level**: Medium ### Vulnerable Code ```bash "plugins": { "allow": ["feishu-openclaw-plugin"], "entries": { "feishu-openclaw-plugin": {"enabled": true} } }, ``` ### Technical Analysis The generated sandbox configuration automatically allows and enables `feishu-openclaw-plugin`. The script does not pin a plugin version, verify integrity, validate its origin, or request explicit user approval before activation. When the Gateway resolves and loads that plugin, the plugin executes as part of the OpenClaw process with the invoking user's privileges. If the locally available plugin is compromised, replaced, malicious, or resolved from an unsafe source, launching the supposedly isolated sandbox can execute untrusted plugin code. This behavior also conflicts with the project's documented claim that the sandbox starts with an empty plugin list. Automatically enabling the plugin unnecessarily expands the executable and potentially network-capable attack surface of a configuration-validation environment. ### Attack Path 1. An attacker compromises, replaces, or otherwise controls the plugin installation resolved under the identifier `feishu-openclaw-plugin`. 2. The victim invokes `templates/safe-try.sh`. 3. The script writes a configuration that explicitly allows and enables that plugin. 4. The script starts `openclaw gateway run`. 5. The Gateway resolves and loads the allowed plugin. 6. Malicious plugin initialization code executes with the permissions of the user running OpenClaw. Exploitation depends on the plugin being installed or resolvable and on the Gateway loading enabled plugin entries during startup. ### Impact Assessment A malicious plugin can execute within the OpenClaw Gateway process under the invoking user's account. Its potential scope includes reading or modifying use ...[truncated 367 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Default the sandbox to an empty plugin allowlist: ```json "plugins": { "allow": [], "entries": {} } ``` 2. Require explicit user opt-in before enabling any plugin. 3. Pin each approved plugin to a specific trusted version where supported. 4. Verify plugin provenance and integrity using package signatures, checksums, or lockfiles. 5. Resolve plugins only from trusted registries or administrator-controlled local directories. 6. Document the permissions and network behavior required by each optional plugin. 7. Keep plugin testing separate from baseline configuration validation so the default sandbox has the smallest possible execution surface. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (28)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The document promises Git version management and automatic rollback while mostly describing provisioning and manual steps, with no verifiable implementation shown in this file. This is primarily an integrity and operational safety issue: false assurances in a configuration tool can lead to data loss, incomplete recovery, and unsafe change management.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The document promises Git version management and automatic rollback while mostly describing provisioning and manual steps, with no verifiable implementation shown in this file. This is primarily an integrity and operational safety issue: false assurances in a configuration tool can lead to data loss, incomplete recovery, and unsafe change management.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The document promises Git version management and automatic rollback while mostly describing provisioning and manual steps, with no verifiable implementation shown in this file. This is primarily an integrity and operational safety issue: false assurances in a configuration tool can lead to data loss, incomplete recovery, and unsafe change management.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The document promises Git version management and automatic rollback while mostly describing provisioning and manual steps, with no verifiable implementation shown in this file. This is primarily an integrity and operational safety issue: false assurances in a configuration tool can lead to data loss, incomplete recovery, and unsafe change management.

Context-Inappropriate Capability

High
Confidence
98% confidence
Finding
The hard-coded HOME reassignment is unrelated to the stated sandbox cleanup purpose and introduces a dangerous side effect. In a script presented as 'zero-risk' and safe for preparing production commands, this can mislead users into trusting a command that silently changes global execution context, increasing the chance of accidental production misuse or cross-user data access.

Intent-Code Divergence

High
Confidence
99% confidence
Finding
The script claims to clean OpenClaw-related environment state but also overwrites HOME with a hard-coded user-specific path. Changing HOME affects where shells and tools resolve config files, credentials, SSH keys, and output paths, which can redirect later commands into an unintended account context and cause data loss, credential misuse, or execution under the wrong environment.

Description-Behavior Mismatch

High
Confidence
98% confidence
Finding
The skill is marketed as a sandbox testing system, but this script directly targets the production configuration path under $HOME/.openclaw/openclaw.json and restarts the live gateway. That mismatch can mislead users into running production-affecting actions under the assumption they are operating in an isolated test environment, increasing the chance of unintended service disruption or unsafe config deployment.

Natural-Language Policy Violations

Medium
Confidence
87% confidence
Finding
The display name and description are written in Chinese, and the rest of the skill documentation is also presented exclusively in Chinese. Under the policy, language or locale constraints should either offer user choice or be clearly documented as region-specific; this file does neither.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The document instructs users to run an apply script that changes live configuration immediately after sandbox testing, but it does not explicitly warn that this step affects production settings. That omission can cause operators to treat the action as low-risk and unintentionally modify active system behavior, especially because the surrounding text emphasizes sandbox safety and rollback convenience.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
This markdown file describes operational steps that modify user configuration and invoke a script which restarts a service, as shown by the sample output. Under the markdown criteria for missing user warnings, actions that can affect system integrity or service availability should be accompanied by a clear warning, but none is provided near the execution step.

Session Persistence

Medium
Category
Rogue Agent
Content
```bash
# ✅ 正确做法:创建独立配置
mkdir -p /tmp/openclaw-sandbox/.openclaw/{extensions,agents,logs}

cat > /tmp/openclaw-sandbox/.openclaw/openclaw.json << 'EOF'
{
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.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
This shell script's comments and interface strings are written in Chinese, and there is no indication that the skill is region-specific or that users may opt into another language. The policy explicitly flags language or locale constraints when they are imposed without user choice or documented justification.

Intent-Code Divergence

Medium
Confidence
96% confidence
Finding
The script claims to verify 9 protection layers, but most checks are only hardcoded status messages rather than real validation. This can mislead operators into believing safety controls such as port isolation, plugin isolation, CORS, process protection, and performance settings are active when they may be absent or misconfigured.

Session Persistence

Medium
Category
Rogue Agent
Content
echo -e "${GREEN}✓ 7. CORS 修复${NC} (allowedOrigins 同步端口)"
    
    # 8. 进程保护
    echo -e "${GREEN}✓ 8. 进程保护${NC} (nohup 后台运行)"
    
    # 9. 性能优化
    echo -e "${GREEN}✓ 9. 性能优化${NC} (关闭 memorySearch)"
Confidence
65% 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.

Session Persistence

Medium
Category
Rogue Agent
Content
echo -e "${GREEN}✓ 7. CORS 修复${NC} (allowedOrigins 同步端口)"
    
    # 8. 进程保护
    echo -e "${GREEN}✓ 8. 进程保护${NC} (nohup 后台运行)"
    
    # 9. 性能优化
    echo -e "${GREEN}✓ 9. 性能优化${NC} (关闭 memorySearch)"
Confidence
65% 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.

Session Persistence

Medium
Category
Rogue Agent
Content
echo -e "${GREEN}✓ 7. CORS 修复${NC} (allowedOrigins 同步端口)"
    
    # 8. 进程保护
    echo -e "${GREEN}✓ 8. 进程保护${NC} (nohup 后台运行)"
    
    # 9. 性能优化
    echo -e "${GREEN}✓ 9. 性能优化${NC} (关闭 memorySearch)"
Confidence
65% 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.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
All user-facing strings, usage instructions, prompts, and status messages in the script are written in Chinese, which imposes a specific language on users. The file does not indicate that the skill is China-specific or provide any opt-in or alternative language, so this is a natural-language locale policy concern.

Intent-Code Divergence

Medium
Confidence
94% confidence
Finding
The script claims safety properties such as rollback on error, but it does not implement any automatic rollback path after failed validation, restart failure, or failed post-deployment health checks. This creates a false sense of safety and can leave production in a broken or partially applied state after an unsuccessful change.

Intent-Code Divergence

Medium
Confidence
98% confidence
Finding
The script advertises environment cleanup as a safety control, but it only unsets `OPENCLAW_HOME` and leaves `HOME` changed to the sandbox directory for the remainder of the script. This can misdirect subsequent commands, reads, writes, and tool behavior, creating confusing state leakage and undermining the claimed safety guarantees.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The script claims sandbox isolation but writes a config that explicitly enables a real plugin, `feishu-openclaw-plugin`, inside the test environment. That weakens the isolation boundary because the sandbox may still interact with external services or production-adjacent resources through the plugin, making the 'zero-risk' claim misleading.

Session Persistence

Medium
Category
Rogue Agent
Content
export OPENCLAW_HOME=$SANDBOX_DIR/.openclaw
    export HOME=$SANDBOX_DIR  # 破解~/陷阱
    
    # 后台启动(nohup 进程保护)
    cd $SANDBOX_DIR
    nohup openclaw gateway run --bind loopback --port 18800 \
      > $SANDBOX_DIR/.openclaw/logs/gateway.log 2>&1 &
Confidence
91% confidence
Finding
Using `nohup` to detach the gateway creates a persistent background process that survives the invoking shell session. In a skill presented as a safe sandbox helper, this increases risk because it leaves a long-lived service and token-bearing web UI running beyond the user's immediate awareness, expanding the window for unintended access or misuse.

Session Persistence

Medium
Category
Rogue Agent
Content
# 后台启动(nohup 进程保护)
    cd $SANDBOX_DIR
    nohup openclaw gateway run --bind loopback --port 18800 \
      > $SANDBOX_DIR/.openclaw/logs/gateway.log 2>&1 &
    
    # 记录 PID
Confidence
91% confidence
Finding
The `nohup openclaw gateway run ... &` command creates durable session persistence and leaves a service listening on a local port with a static token disclosed in script output. In context, the danger is elevated because the skill markets itself as 'zero-risk' and '9 layers of protection,' which may cause users to underestimate the risk of a persistent service remaining active after the script exits.

Natural-Language Policy Violations

Low
Confidence
83% confidence
Finding
This markdown file presents the entire verification report in Chinese, with no indication that language choice is optional or configurable. Under the natural-language policy rule, forcing a specific language without user opt-in can be a locale-policy violation.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
The natural-language instructions and examples are presented only in Chinese, which can amount to forcing a specific language without user opt-in. The file does not indicate that the skill is region-specific or provide an alternative language option.

Natural-Language Policy Violations

Low
Confidence
96% confidence
Finding
Natural-language policy violations include forcing a specific language without user opt-in. This file presents all instructions, labels, and guidance only in Chinese and does not offer an alternative language or note that the skill is intended exclusively for a Chinese-speaking audience.

Static analysis

No suspicious patterns detected.