Back to skill

Security audit

OpenClaw Cost Optimizer

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly does what it says, but it gives the agent broad local command authority and includes an unsafe tracker-writing command that could execute unintended shell commands from task text.

Review this skill before installing. The model-alias setup is understandable, but only approve commands you expect, avoid using the tracker with sensitive task names or customer/project details, and be especially cautious of the cost-tracker append/reset behavior until it is changed to write data safely without shell interpolation.

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

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:711
Finding

Shell Command Injection Through Unsanitized Cost Tracker Task Descriptions

Content
View full analysis
> ~/.openclaw/cost-tracker.md ``` ### Technical Analysis The skill instructs the agent to interpolate a short task description into a shell command executed through the `exec` tool. The task description is derived from user-provided content, but the instructions do not require shell escaping, validation, or removal of shell metacharacters. Because the value is inserted inside a double-quoted shell argument, shell constructs such as command substitution using `$(...)` or backticks remain active. Embedded quotation marks, newlines, redirection operators, and other metacharacters could also terminate or alter the intended command. The same input could corrupt the Markdown table even when it does not achieve command execution. The vulnerability is conditional on the agent constructing the command by replacing `[SHORT TASK DESC]` with task-derived text, as explicitly directed by the skill. ### Attack Path 1. An attacker submits a task containing shell syntax in text likely to be retained in the generated short description, such as a command substitution expression. 2. The Cost Advisor recommends a model change for that task. 3. The user follows the recommendation and switches models. 4. The skill directs the agent to append a tracker row through `exec`. 5. The agent places the attacker-controlled description into the documented double-quoted `echo` command. 6. The local shell evaluates the injected syntax while appending the tracker entry. 7. The injected command executes with the same operating-system privileges and environment access as the OpenClaw agent process. ### Impact Assess ...[truncated 549 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
SKILL.md:432
Finding

Persistent Plaintext Storage of Potentially Sensitive Task Information

Content
View full analysis
~/.openclaw/cost-tracker.md << 'EOF' # Cost Tracker Installed: [TODAY'S DATE] Default model: [DETECTED DEFAULT] ## Log | Date | Task | Model Used | Default Cost (est) | Actual Cost (est) | Saved | |------|------|-----------|-------------------|------------------|-------| EOF ``` ```sh echo "| [DATE] | [SHORT TASK DESC] | [MODEL] | $[DEFAULT_EST] | $[ACTUAL_EST] | $[SAVED] |" >> ~/.openclaw/cost-tracker.md ``` ### Technical Analysis The skill persistently stores task descriptions in a plaintext Markdown file. Task descriptions may expose customer names, internal project identifiers, security incident details, source-code context, or other sensitive information derived from user prompts. The instructions do not require data minimization, secret detection, redaction, retention limits, user consent for task-description logging, or explicit restrictive file permissions. The effective file permissions therefore depend on the process umask and the existing directory configuration. This is not a remote exfiltration mechanism: the reviewed project does not instruct the agent to transmit tracker contents externally. The risk is local disclosure through other accounts or processes, backups, synchronization software, diagnostic bundles, or later tools with access to the OpenClaw state directory. ### Attack Path 1. A user submits a task containing confidential or identifying information. 2. The Cost Advisor recommends a different model. 3. The ...[truncated 897 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (12)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
| `SKILL.md` | This file — the entire skill |

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The quoted triggers such as "advisor off", "advisor on", "how much have I saved?", and similar natural-language phrases are broad enough to overlap with ordinary user conversation. In a chat environment, this can cause unintended command activation, leading to accidental model changes, settings changes, or state resets without the user deliberately invoking the skill.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill prominently claims 'only adds aliases' and 'never changes your default,' but later instructs the agent to remove aliases and overwrite a persistent tracker file. This mismatch can mislead users about the true scope of filesystem and configuration changes, undermining informed consent and making later destructive actions more likely to be approved.

Content

No source excerpt is available for this finding.

Behavior Manipulation

Medium
Category
Prompt Injection
Confidence
75% confidence
Finding

Subtle instructions detected that may alter agent decision-making or introduce hidden biases.

Content

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

md
> ## ⛔ AGENT RULES — READ BEFORE DOING ANYTHING
> 1. **Use EXACT text from this file.** Do not paraphrase menus, preset names, or instructions. If you invent preset names, the config-patcher will break.
> 2. **Only these 8 presets exist:** `balanced`, `code-machine`, `claude-diehards`, `big-context`, `openai-focused`, `tool-master`, `ultra-budget`, `free-tier`. No others. Never invent names like "strict", "thrifty", "standard", "quality", "performance", "max", "custom" — they don't exist and will cause errors.
> 3. **NEVER tell the user to open a terminal or run commands.** You have the exec tool. USE IT. Run every command yourself via exec. The user's only job is clicking "Approve" on the exec popup. If you find yourself typing "Run this in your terminal" — STOP. Use exec instead.
> 4. **One step at a time.** Run one exec, show the result, explain it, then proceed.
> 5. **We NEVER change the user's default model, fallbacks, or existing config.** We ONLY add model aliases. Their setup stays exactly as it was.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

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

md
> - Run via exec: `openclaw models auth add --provider openrouter`
> - This starts OpenClaw's built-in interactive auth wizard
> - The user follows the prompts to enter their key securely
> - **NEVER ask the user to paste API keys into chat.** Always use the auth wizard via exec.
>   Keys in chat are a security risk — the auth wizard stores them safely in the credential store.
>
> **Step 3b: Add model aliases.** Use exec to run ALL aliases for the chosen preset in ONE command.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill instructs the agent to maintain a persistent natural-language log of user tasks, dates, model choices, and estimated costs in ~/.openclaw/cost-tracker.md. Storing task descriptions from user interactions can capture sensitive business, code, security, or personal information and retain it locally without strong minimization or consent controls.

Content

No source excerpt is available for this finding.

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

md
- No code, no attachments

**WORK-level** (suggest work-tier model):
- "Write a function/component/test", "debug this", "fix this error"
- "Draft an email/document", "explain this code", "review this PR"
- Single file scope, 200-2000 char messages, one attachment or code block

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Appending a 'short task description' from user interactions into a persistent file creates a direct path for sensitive prompt content to be written to disk. Even abbreviated summaries can expose proprietary code, incident details, credentials mentioned in context, or other confidential information over time.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The command recognizers for savings, reset, mix-and-match, and monthly cost estimation rely on broad natural-language phrases such as 'savings,' 'custom preset,' or 'monthly cost.' Generic phrases can be matched in unrelated conversation, causing unintended reads, writes, or setup flows that touch persistent files and model aliases.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The first-run trigger conditions are overly broad, activating on generic topics like costs, saving money, models, setup, or 'what can you do.' That increases the chance the skill will launch setup flows and execute privileged commands during ordinary conversation without a clear, intentional request to modify the local environment.

Content

No source excerpt is available for this finding.

Behavior Manipulation

Medium
Category
Prompt Injection
Confidence
75% confidence
Finding

Subtle instructions detected that may alter agent decision-making or introduce hidden biases.

Content

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

md
**ONE STEP AT A TIME.** Run one exec, show result, then proceed. If exec fails, troubleshoot before moving on.

**ALWAYS use exec.** Never tell users to run commands in a terminal. If exec fails, fix the error and retry exec.

### Preset mapping:

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file states 'No scripts, no generated configs, no backup systems' while also directing the agent to create and overwrite a persistent file under ~/.openclaw/cost-tracker.md. This is a deceptive safety signal that downplays persistent local state and may cause users to approve file-writing actions they would otherwise scrutinize.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.