Back to skill

Security audit

Cost Guardian

Security checks for vulnerabilities and agentic risk

Overview

This is a local cost-tracking skill that stores costs and token-usage summaries on the user's machine without evidence of exfiltration or hidden execution.

Before installing, be aware that running scan-tokens reads local OpenClaw gateway logs and records aggregate model/token/cost data in a local SQLite database. Use COST_GUARDIAN_DIR or edit config.json if you need the data stored somewhere else, and avoid running scans on shared systems unless that local usage history is acceptable.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The scan-tokens feature parses gateway logs to extract token usage, but the skill does not warn that log files may contain sensitive metadata such as prompts, model names, request identifiers, timestamps, or other usage details. Without a privacy notice and scope clarification, users may unknowingly process or retain sensitive operational data.

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 · scripts/cost-guardian.py (reported line 82)May include surrounding context.

python
# ─── Database ─────────────────────────────────────────────────────────────────

def get_db():
    """Get database connection, create tables if needed."""
    DATA_DIR.mkdir(parents=True, exist_ok=True)
    conn = sqlite3.connect(str(DB_PATH))
    conn.row_factory = sqlite3.Row

Tainted flow: 'CONFIG_PATH' from os.environ.get (line 25, credential/environment) → open (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/cost-guardian.py (reported line 153)May include surrounding context.

python
def save_config(config):
    """Save config."""
    DATA_DIR.mkdir(parents=True, exist_ok=True)
    with open(CONFIG_PATH, "w") as f:
        json.dump(config, f, indent=2)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The scan-tokens feature reads multiple log locations, parses model/usage metadata, and persists the results into a local SQLite database without any consent prompt, redaction step, or retention control. While it does not exfiltrate data, gateway logs can contain sensitive operational metadata, and silently aggregating that information into another persistent store increases exposure if the workstation or data directory is later accessed by another user or process.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill instructs users to run initialization and tracking commands that create persistent files under ~/.openclaw/workspace/costs/, but it does not clearly warn that local state will be written to the user's home directory. This can surprise users, affect privacy expectations, and leave residual financial data on shared or managed systems.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.