Back to skill

Security audit

Openclaw Troubleshoot

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent OpenClaw troubleshooting guide, but some manual repair commands can disrupt the gateway or damage configuration if run carelessly.

Before installing or using this skill, treat its commands as manual repair steps: back up ~/.openclaw/openclaw.json, avoid running gateway restart or kill commands during active sessions, and replace the /tmp/oc.json command with a secure mktemp-based config update if you use that repair path.

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

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:15
Finding
Predictable Temporary File Enables Symlink-Based File Overwrite## Vulnerability Details **File Location**: `SKILL.md`, line 15 **Vulnerability Type**: Unsafe predictable temporary file **Risk Level**: Medium ```bash jq '.plugins.allow += ["memory-core"]' ~/.openclaw/openclaw.json > /tmp/oc.json && mv /tmp/oc.json ~/.openclaw/openclaw.json ``` ### Technical Analysis The documented configuration update writes sensitive configuration output to the fixed, globally predictable path `/tmp/oc.json`. On systems where `/tmp` is shared, another local user or process can create this path before the command runs, including as a symbolic link. Shell output redirection follows symbolic links. Consequently, if `/tmp/oc.json` points to another file writable by the user executing the command, the `jq` output can overwrite that file. The subsequent `mv` can also replace `~/.openclaw/openclaw.json` with attacker-influenced content or otherwise corrupt the configuration. The procedure does not use exclusive temporary-file creation, restrictive permissions, ownership checks, or validation before replacement. ### Attack Path 1. A local attacker determines that the victim may run the documented troubleshooting command. 2. The attacker pre-creates `/tmp/oc.json` as a symbolic link to a file writable by the victim, or otherwise controls the predictable path. 3. The victim runs the command from `SKILL.md`. 4. Shell redirection follows the symbolic link and writes the generated JSON to the attacker-selected destination. 5. If execution continues, `mv` may replace the OpenClaw configuration using attacker-influenced or malformed temporary-file state. 6. The altered file or configuration can cause data corruption, service disruption, or unintended plugin configuration when OpenClaw next starts. Exploitation requires local access or control over another process capable of manipulating the shared temporary directory. The attack does not independently grant root privileges; its write capability is limited to files ...[truncated 874 chars]
Remediation
## Remediation Suggestions Replace the predictable shared temporary path with a uniquely and securely created file. Create it in the destination directory so the final rename remains atomic, apply restrictive permissions, validate the generated JSON, and remove the temporary file on failure. ```bash config="$HOME/.openclaw/openclaw.json" tmp="$(mktemp "$HOME/.openclaw/openclaw.json.XXXXXX")" || exit 1 trap 'rm -f "$tmp"' EXIT chmod 600 "$tmp" || exit 1 jq '.plugins.allow = ((.plugins.allow // []) + ["memory-core"] | unique)' \ "$config" > "$tmp" || exit 1 jq empty "$tmp" || exit 1 mv -- "$tmp" "$config" || exit 1 trap - EXIT ``` Additional hardening should include: - Backing up the original configuration before replacement. - Verifying the source configuration is a regular file owned by the expected user. - Preserving appropriate ownership and permissions. - Avoiding fixed filenames in shared temporary directories. - Restarting the gateway only after the replacement and validation succeed.
Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • 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 (6)

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The skill instructs the user to unload and reload a LaunchAgent-backed gateway service without any warning that this will interrupt active sessions and temporarily disable connected channels. In a troubleshooting skill, service-control commands can be legitimate, but omitting disruption warnings increases the chance of accidental denial of service or loss of in-flight work.

Session Persistence

Medium
Category
Rogue Agent
Content
jq '.plugins.allow += ["memory-core"]' ~/.openclaw/openclaw.json > /tmp/oc.json && mv /tmp/oc.json ~/.openclaw/openclaw.json

# 重启 Gateway
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist
launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist
```
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.

Session Persistence

Medium
Category
Rogue Agent
Content
jq '.plugins.allow += ["memory-core"]' ~/.openclaw/openclaw.json > /tmp/oc.json && mv /tmp/oc.json ~/.openclaw/openclaw.json

# 重启 Gateway
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist
launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist
```
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.

Session Persistence

Medium
Category
Rogue Agent
Content
jq '.plugins.allow += ["memory-core"]' ~/.openclaw/openclaw.json > /tmp/oc.json && mv /tmp/oc.json ~/.openclaw/openclaw.json

# 重启 Gateway
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist
launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist
```
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.

Session Persistence

Medium
Category
Rogue Agent
Content
# 重启 Gateway
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist
launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist
```

---
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.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The instructions use `killall openclaw-gateway` to forcefully terminate the gateway process, which can abruptly interrupt service and potentially lose transient state. While this appears intended for troubleshooting, force-kill guidance without a warning or fallback to a graceful restart is operationally risky.

Static analysis

No suspicious patterns detected.