Back to skill

Security audit

OpenClaw DX

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent OpenClaw gateway troubleshooting guide, but it includes unsafe credential-display guidance and broad persistent system/config changes without enough safeguards.

Use this only in a trusted OpenClaw operations context. Do not allow an agent to print gateway tokens or read setup-token files into chat/logs, and require explicit approval plus backups before it edits configs, plists, session files, lock files, or restarts LaunchAgents.

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
SKILL.md:68
Finding
Gateway Authentication Token Exposed During Triage## Vulnerability Details **File Location**: `SKILL.md:68` **Vulnerability Type**: Authentication token disclosure through command output **Risk Level**: High **Complete Vulnerable Code Snippet**: ```bash # 11. Check OPENCLAW_GATEWAY_TOKEN env var (multi-profile foot-gun) echo "OPENCLAW_GATEWAY_TOKEN=${OPENCLAW_GATEWAY_TOKEN:-unset}" ``` ### Technical Analysis The triage command expands and prints the complete value of `OPENCLAW_GATEWAY_TOKEN`. Because Skill command output can be displayed in a terminal, recorded in an agent transcript, or retained by execution and observability systems, this unnecessarily exposes a reusable authentication credential. Diagnosis only requires determining whether the environment variable is configured. Printing its value violates secret-handling and least-disclosure principles. The token is not hardcoded in the Skill, but it is disclosed at runtime whenever this triage step is executed. ### Attack Path 1. A user or agent invokes the gateway triage protocol while `OPENCLAW_GATEWAY_TOKEN` is set. 2. Shell expansion substitutes the active gateway token into the command output. 3. The complete token is captured in terminal history, agent transcripts, diagnostic records, or monitoring logs. 4. An attacker with access to one of those output channels retrieves the token. 5. The attacker presents the token to a reachable OpenClaw gateway. 6. If no additional control blocks the request, the attacker gains the gateway access associated with that token. ### Impact Assessment Successful exploitation can expose the authentication authority assigned to the gateway token. The precise reachable scope depends on gateway network exposure and server-side authorization, but it may include unauthorized gateway connections and access to operations available to an authenticated client. Exposure can also affect multiple profiles if they share the same profile-agnostic environment token.
Remediation
## Remediation Suggestions Never print the token value. Test only whether the variable is present: ```bash if [ -n "${OPENCLAW_GATEWAY_TOKEN:-}" ]; then echo "OPENCLAW_GATEWAY_TOKEN=set" else echo "OPENCLAW_GATEWAY_TOKEN=unset" fi ``` If profile comparison is necessary, use a non-reversible, narrowly scoped fingerprint and avoid retaining it in logs. Redact existing transcripts and diagnostic records that may contain the token, rotate any token that may already have been exposed, and ensure command tracing such as `set -x` is disabled around secret-handling operations.

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:251
Finding
Gateway Authentication Token Exposed During Multi-Profile Diagnosis## Vulnerability Details **File Location**: `SKILL.md:251` **Vulnerability Type**: Authentication token disclosure through command output **Risk Level**: High **Complete Vulnerable Code Snippet**: ```bash # Check env var echo $OPENCLAW_GATEWAY_TOKEN ``` ### Technical Analysis This diagnostic command prints the complete gateway token while investigating token mismatches across profiles. The command also leaves the variable unquoted, which introduces shell word splitting and pathname expansion, although the primary security issue is direct credential disclosure. The actual secret value is not necessary to establish whether the environment variable is overriding profile configuration. Printing it can propagate the credential into agent context, shell output, support records, or centralized logs. ### Attack Path 1. An operator follows the documented procedure for diagnosing a multi-profile token mismatch. 2. The shell expands `$OPENCLAW_GATEWAY_TOKEN` and emits the complete credential. 3. A local observer, transcript reader, support-system user, or log reader obtains the value. 4. The attacker uses the disclosed credential when connecting to the main or another profile configured with the same token. 5. The gateway treats the request as authenticated to the extent permitted by that token. ### Impact Assessment The disclosure may enable unauthorized authenticated gateway access. Because the document states that the environment variable is profile-agnostic and profiles may be synchronized to the same token, one leaked value can potentially affect every profile sharing it. Actual exploitation remains dependent on gateway reachability and any additional access controls.
Remediation
## Remediation Suggestions Replace the command with a presence-only check: ```bash [ -n "${OPENCLAW_GATEWAY_TOKEN:-}" ] \ && echo "OPENCLAW_GATEWAY_TOKEN=set" \ || echo "OPENCLAW_GATEWAY_TOKEN=unset" ``` For mismatch diagnosis, compare securely generated fingerprints rather than raw values, and display only a short portion if operationally necessary. Rotate any credential printed during previous diagnostic sessions and remove it from retained transcripts or logs where feasible.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:569
Finding
Specific Plaintext Anthropic Setup-Token Location Disclosed## Vulnerability Details **File Location**: `SKILL.md:569` **Vulnerability Type**: Sensitive credential-location disclosure **Risk Level**: Medium **Complete Vulnerable Code Snippet**: ```text Fresh Anthropic setup tokens: `~/clawd/inbox/2026-03-03-anthropic-setup-tokens` ``` ### Technical Analysis The Skill identifies a concrete local path that purportedly contains fresh Anthropic setup tokens. This project-specific credential location is not required for general gateway diagnosis and gives any agent or local user loading the Skill precise information about where high-value credentials may be stored. The document does not instruct the agent to read or transmit the file, so no credential exfiltration is confirmed. Nevertheless, disclosing the location of plaintext setup tokens reduces the effort required for credential discovery and indicates that sensitive material may be stored outside a dedicated secret manager. ### Attack Path 1. An attacker, compromised agent, or unauthorized local user reads the Skill. 2. The attacker learns the exact path of the setup-token file. 3. If the attacker's existing local permissions allow access, the attacker reads the file. 4. The attacker extracts any still-valid setup tokens. 5. The tokens are used against the applicable Anthropic authentication or setup workflow, subject to their validity and assigned permissions. ### Impact Assessment The immediate issue is information disclosure rather than direct privilege escalation. If the referenced file exists, contains valid credentials, and is readable by an attacker, compromise could extend to the services and account capabilities authorized by those tokens. The exact privileges cannot be established from the audited file alone.
Remediation
## Remediation Suggestions Remove the project-specific token path from the Skill. Replace it with provider-neutral guidance that does not identify live credential files, for example: ```text Retrieve provider setup credentials from the approved secret manager. Do not store or print setup tokens in plaintext diagnostic files. ``` Move existing setup tokens to an approved secret manager or operating-system keychain, restrict file permissions if temporary local storage is unavoidable, delete expired token files securely, and rotate any credentials whose confidentiality cannot be assured.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
Findings (52)

Ssd 3

High
Confidence
97% confidence
Finding
The skill directs reading auth profile files that contain token-bearing state and encourages surfacing token presence, type, and expiry from those files. Even though it does not intentionally exfiltrate raw token strings, it normalizes direct access to credential stores and increases the likelihood that secrets or sensitive auth metadata will be exposed in agent output, logs, or copied diagnostics.

Credential Access

High
Category
Privilege Escalation
Content
**Symptom:** `All models failed (N):` followed by per-provider errors. May also appear as "The model has crashed without additional information. (Exit code: null)"
**Diagnosis:** Check the full error chain — each attempt cycles primary → fallback1 → fallback2. All must fail for the user to see an error. Common error signatures per provider:
- Anthropic: `The AI service is temporarily overloaded` (transient, or stale token)
- OpenAI Codex: `OAuth token refresh failed for openai-codex` or `refresh_token_reused` (expired access token + consumed refresh token)
- Google/Gemini: `No API key found for provider "google"` (provider never configured in auth-profiles.json)
- LM Studio: Python errors like `AttributeError: 'list' object has no attribute 'swapaxes'` (model inference bug)
**Fix:** Identify which providers are broken and fix each:
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
**Symptom:** `All models failed (N):` followed by per-provider errors. May also appear as "The model has crashed without additional information. (Exit code: null)"
**Diagnosis:** Check the full error chain — each attempt cycles primary → fallback1 → fallback2. All must fail for the user to see an error. Common error signatures per provider:
- Anthropic: `The AI service is temporarily overloaded` (transient, or stale token)
- OpenAI Codex: `OAuth token refresh failed for openai-codex` or `refresh_token_reused` (expired access token + consumed refresh token)
- Google/Gemini: `No API key found for provider "google"` (provider never configured in auth-profiles.json)
- LM Studio: Python errors like `AttributeError: 'list' object has no attribute 'swapaxes'` (model inference bug)
**Fix:** Identify which providers are broken and fix each:
Confidence
70% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
ls ~/.openclaw/gateway.*.lock
cat ~/.openclaw/gateway.*.lock  # check PID
kill -0 <pid>  # verify dead
rm ~/.openclaw/gateway.*.lock
openclaw gateway start
```
Confidence
93% confidence
Finding
The skill instructs deleting lock files with a wildcard after only a minimal liveness check, which can remove multiple files and alter gateway state destructively. In an agentic context, broad deletion commands are risky because stale assumptions, glob expansion, or symlink/path confusion can lead to unintended data loss or service disruption.

Ssd 3

High
Confidence
99% confidence
Finding
The documentation points to a specific inbox artifact described as containing fresh setup tokens, effectively telling an agent or operator where highly sensitive secrets are stored. That creates a direct retrieval path for credentials and meaningfully raises exfiltration risk in an adversarial or over-permissive agent setting.

Credential Access

High
Category
Privilege Escalation
Content
### OpenAI Codex OAuth Refresh
**Symptom:** `OAuth token refresh failed for openai-codex` or `refresh_token_reused` — the access token expired and the refresh token is single-use/already consumed.
**Diagnosis:** Check `expires` field in `auth-profiles.json` — if epoch ms is in the past, access token is expired. If refresh also fails, full re-auth needed.
**Fix:** Interactive re-auth: `openclaw configure` (add `--profile vesper` if vesper profile).

### Unconfigured Fallback Provider
Confidence
84% confidence
Finding
The guidance tells operators to inspect `expires` in `auth-profiles.json`, a credential-bearing file, to determine token validity. Although the purpose is legitimate, using a secret store as a diagnostic source increases the chance of exposing associated access and refresh tokens during agent-assisted triage.

Missing User Warnings

Medium
Confidence
87% confidence
Finding
The metadata and workflow instruct the agent to apply fixes and write reports into local directories, but do not warn that these actions modify persistent system state and may overwrite configuration or session files. In a semi-autonomous troubleshooting context, omission of change-control guidance increases the chance of unsafe edits and accidental data loss.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill explicitly instructs operators to echo and inspect authentication-related environment variables during troubleshooting, which can expose live secrets to terminal history, screen sharing, logs, or downstream agent output. In a diagnostic skill used by an agent, this creates a realistic path for credential disclosure even if the intent is operational debugging.

Session Persistence

Medium
Category
Rogue Agent
Content
"
done

# 12. Verify plist profile alignment
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.gateway.plist
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.vesper.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
"
done

# 12. Verify plist profile alignment
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.gateway.plist
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.vesper.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
"
done

# 12. Verify plist profile alignment
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.gateway.plist
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.vesper.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
"
done

# 12. Verify plist profile alignment
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.gateway.plist
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.vesper.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
"
done

# 12. Verify plist profile alignment
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.gateway.plist
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.vesper.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
"
done

# 12. Verify plist profile alignment
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.gateway.plist
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.vesper.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
"
done

# 12. Verify plist profile alignment
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.gateway.plist
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.vesper.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
"
done

# 12. Verify plist profile alignment
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.gateway.plist
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.vesper.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
"
done

# 12. Verify plist profile alignment
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.gateway.plist
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.vesper.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
"
done

# 12. Verify plist profile alignment
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.gateway.plist
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.vesper.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
"
done

# 12. Verify plist profile alignment
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.gateway.plist
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.vesper.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
"
done

# 12. Verify plist profile alignment
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.gateway.plist
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.vesper.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
"
done

# 12. Verify plist profile alignment
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.gateway.plist
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.vesper.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
"
done

# 12. Verify plist profile alignment
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.gateway.plist
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.vesper.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
"
done

# 12. Verify plist profile alignment
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.gateway.plist
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.vesper.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
"
done

# 12. Verify plist profile alignment
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.gateway.plist
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.vesper.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
"
done

# 12. Verify plist profile alignment
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.gateway.plist
grep OPENCLAW_STATE_DIR ~/Library/LaunchAgents/ai.openclaw.vesper.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.

Static analysis

No suspicious patterns detected.