Back to skill

Security audit

ClawDoctor

Security checks for vulnerabilities and agentic risk

Overview

This cost-analysis skill is useful in purpose, but it needs review because it can read private chat histories and change fleet settings with weak confirmation controls.

Install only if you are comfortable giving this skill access to fleet usage data and selected chat histories. Run it manually first, avoid daily cron until consent and retention expectations are clear, and do not let it apply fixes unless you have reviewed the exact patch, affected agents, global impact, and rollback plan.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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)

T01 · Skill Instruction Hijacking

Error
Location
SKILL.md:17
Finding
Global Agent Role and Session-Control Instruction Hijacking<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:17-17` **Vulnerability Type**: `T01: Skill Instruction Hijacking` **Risk Level**: Critical ### Vulnerable Code Snippet ```markdown **SCOPE LOCK: You are ONLY a cost analyst. Never discuss, recommend, or help with anything outside cost optimization. If the user asks something else, say "I only do cost analysis — try your main agent." Never say "Shall I continue monitoring or help with another task?" — you are not a general assistant.** ``` Additional controlling instructions appear throughout the file: ```markdown Execute these steps IN EXACT ORDER. Do NOT skip steps. Do NOT summarize session data without fetching transcripts first. ``` ```markdown **OUTPUT THE REPORT IN THE EXACT FORMAT SPECIFIED IN report-formats.md. DO NOT FREESTYLE.** ``` ```markdown 8. On subsequent runs, stay SILENT if no major+ findings. ``` ### Technical Analysis The Skill does not merely describe the cost-analysis task. It attempts to redefine the hosting Agent's global role, restrict the topics on which it may assist, prescribe mandatory tool use, control the exact output format, and require silence in specified circumstances. These directives alter the current session goals when the Skill is loaded. In particular: - The “SCOPE LOCK” forces the Agent to refuse requests outside cost analysis. - Mandatory execution-order language attempts to prevent the Agent from exercising safer or more privacy-preserving alternatives. - Mandatory transcript retrieval forces access to sensitive data even when metadata could be sufficient. - The silence instruction can suppress an expected response. - The fixed-output instruction disallows adapting the report to user or platform security requirements. This matches `T01: Skill Instruction Hijacking` because the Skill text attempts to override the Agent's current-session behavior and role rather than remaining scoped to an explicitly authorized cost-analysis operation. ### Attack P ...[truncated 1210 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove the global “SCOPE LOCK” and replace it with task-scoped guidance, such as: “When explicitly invoked for cost analysis, focus the analysis on cost optimization.” 2. State that higher-priority instructions, platform security requirements, and current user intent always take precedence. 3. Remove instructions that require silence; return a concise “no material findings” result instead. 4. Change mandatory execution directives into conditional workflow guidance. 5. Permit metadata-only analysis and require explicit consent before retrieving transcript content. 6. Allow the Agent to adapt its output to platform security policies and the user's requested format. 7. Ensure the Skill becomes active only through explicit invocation rather than affecting the Agent merely because it is installed or available. ]]>

T05 · Unauthorized Access and Privilege Escalation

Error
Location
SKILL.md:68
Finding
Mandatory Fleet-Wide Retrieval and Analysis of Sensitive Chat Histories<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:68-77` **Vulnerability Type**: `T05: Unauthorized Access and Privilege Escalation` **Risk Level**: High ### Vulnerable Code Snippet ```markdown ### STEP 5: FETCH TRANSCRIPTS — MANDATORY **THIS STEP IS NOT OPTIONAL.** For EACH of the top 5 sessions, run: ```bash openclaw gateway call chat.history --params '{"sessionKey":"EXACT_KEY_HERE","limit":200}' --json --timeout 15000 ``` Use the EXACT session key from step 3. Do NOT modify, shorten, or construct keys. **CHECKPOINT:** You MUST have transcript messages for at least 3 sessions before proceeding. ``` The subsequent analysis expressly requires inspection and reproduction of user content: ```markdown 1. **What did the user ask?** Quote or closely paraphrase their first message. This becomes the receipt title. ``` ### Technical Analysis The Skill requires retrieving up to 200 messages from each of the five most expensive sessions, potentially placing up to 1,000 fleet messages into the analysis context on every run. This access is mandatory and is designed to occur during daily scheduled execution as well as manual execution. Session transcripts may contain: - Personal or customer information. - Authentication material or credentials pasted into conversations. - Proprietary business data. - Internal URLs, infrastructure details, or source code. - Confidential instructions from unrelated agents. - Regulated or otherwise sensitive content. Although behavioral cost analysis can benefit from limited message inspection, unconditional retrieval of complete histories from unrelated high-cost sessions does not implement least privilege. The Skill has no per-session consent check, sensitivity classification, redaction stage, agent allowlist, purpose limitation, or fallback to aggregated usage metadata. The transcript-token statement identified by the static pre-scan is an estimate and does not itself send information externally. The actual sensitiv ...[truncated 1721 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Make usage metadata the default analysis source. 2. Require explicit, informed user approval before retrieving any transcript. 3. Display the affected agents, number of sessions, message limit, and purpose before requesting approval. 4. Allow users to select or exclude agents and sessions. 5. Retrieve only the minimum relevant message ranges instead of a fixed 200-message history. 6. Add a redaction stage for credentials, tokens, personal data, internal URLs, and other secrets before model analysis or report generation. 7. Avoid quoting messages verbatim; use sanitized summaries unless the user explicitly requests quotations. 8. Enforce access controls in the gateway so the Skill can read only sessions specifically delegated to it. 9. Do not run transcript retrieval automatically from cron without a separately configured consent and retention policy. 10. Record an auditable reason for each transcript access without storing transcript bodies. 11. Define retention and deletion rules for transcript-derived data and generated reports. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:200
Finding
Ambiguous Approval Can Trigger High-Impact Fleet Configuration Changes<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:200-214` **Vulnerability Type**: `T09: Insecure Skill Coding Practices` **Risk Level**: High ### Vulnerable Code Snippet ```markdown ## WHEN USER ASKS TO FIX SOMETHING Understand naturally — no rigid commands needed: - "yeah do that" / "sure" → apply most recently discussed fix - "fix the model thing" → match keywords in pending-fixes.json - "do all of them" → apply all config-patch fixes - "tell me more" → explain in plain English - "never mind" → acknowledge, move on - If ambiguous, ASK which fix they mean. Read `{baseDir}/references/fix-payloads.md` for config patch payloads. Apply via: ```bash openclaw gateway call config.patch --params '{"patch": <fixPayload>}' --json --timeout 10000 ``` After applying, confirm naturally with dollar savings. Update pending-fixes.json to mark applied. ``` The referenced payload file permits broad changes: ```markdown | Set tool budget (50 calls) | `{"agents":{"defaults":{"toolBudget":50}}}` | | Set session timeout (5 min) | `{"agents":{"defaults":{"sessionTimeout":300}}}` | | Set session timeout (1 hour) | `{"agents":{"defaults":{"sessionTimeout":3600}}}` | | Enable prompt caching | `{"gateway":{"promptCaching":{"enabled":true}}}` | | Add conciseness instruction | `{"agents":{"list":[{"id":"<agent>","systemPrompt":{"append":"Be concise. Under 500 tokens unless asked."}}]}}` | | Switch heartbeat to budget model | `{"agents":{"defaults":{"heartbeat":{"model":"google/gemini-2.5-flash-lite"}}}}` | ``` ### Technical Analysis The Skill treats short, context-dependent phrases such as “sure” or “yeah do that” as authorization to execute configuration changes. It also permits “do all of them” to apply every pending configuration patch. Some available patches modify global agent defaults or gateway behavior rather than only the agent associated with a finding. The affected settings include: - Default tool-call budgets. - Default session timeouts. - Agent model ...[truncated 2231 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not accept generic acknowledgements as authorization for configuration changes. 2. Before each patch, display: - The exact setting being changed. - Its current and proposed values. - Every affected agent or gateway component. - Whether the change is global. - Expected operational and cost impact. 3. Require explicit confirmation tied to a unique change identifier, such as “Apply fix 2 to agents A and B.” 4. Require separate confirmation for global-default or gateway-level changes. 5. Never interpret “do all of them” as approval when any patch has fleet-wide scope. 6. Validate patch schemas and agent identifiers before execution. 7. Read and preserve prior values so every applied patch has a rollback operation. 8. Apply patches atomically where possible and report partial failures. 9. Restrict the Skill's gateway credentials so it can modify only explicitly delegated settings. 10. Maintain an audit log containing the approving user, timestamp, exact diff, affected scope, result, and rollback data. 11. Prefer generating a proposed patch for administrator review rather than executing it directly. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (10)

Intent-Code Divergence

High
Confidence
98% confidence
Finding
The 'ONLY a cost analyst' language conflicts directly with instructions to perform `config.patch` operations later in the skill. This kind of self-contradictory scope definition increases the chance of unsafe delegation because the skill appears narrower than it really is.

Description-Behavior Mismatch

High
Confidence
98% confidence
Finding
The skill is presented as an analyzer/coach, but later instructs the agent to apply live configuration changes through `config.patch`. That creates a capability mismatch: a user may invoke or install it expecting read-only analysis, while it can mutate fleet configuration and operational state.

Description-Behavior Mismatch

Medium
Confidence
97% confidence
Finding
The scope lock says the skill is 'ONLY a cost analyst', but the workflow includes writing memory files and modifying configuration. This contradiction can mislead users and reviewers about the true privileges and side effects of the skill.

Session Persistence

Medium
Category
Rogue Agent
Content
```bash
openclaw gateway call sessions.usage --params '{"startDate":"YYYY-MM-DD","endDate":"YYYY-MM-DD","limit":200}' --json --timeout 15000
```
**CHECKPOINT:** You MUST now have a sessions[] array. If empty, write memory/last-analysis.json with zero findings and STOP.

### STEP 3b: COST ESTIMATE (show before proceeding)
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.

Vague Triggers

Medium
Confidence
96% confidence
Finding
The skill treats broad conversational phrases like 'yeah do that', 'sure', and 'do all of them' as authorization to apply fixes. Ambiguous natural-language triggers can cause unintended configuration changes, especially in multi-turn conversations where referents are unclear.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill instructs the agent to apply configuration patches without requiring an explicit warning that system configuration will be modified. Users may not realize they are authorizing state-changing actions, increasing the risk of accidental or surprising changes.

Description-Behavior Mismatch

Medium
Confidence
92% confidence
Finding
The documentation explicitly instructs the skill to apply live configuration changes through an exec-driven `config.patch` call, which materially expands behavior from passive analysis/coaching into active modification of fleet settings. In an agent context, operational docs often become execution guidance, so this creates a real risk of unauthorized or unexpected changes to models, budgets, timeouts, or prompts if the skill consumes or follows this reference.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The file instructs writing `memory/pending-fixes.json` and `memory/last-analysis.json` after every run without any warning or consent mechanism for modifying local data. Even if the data seems operationally harmless, silent persistence can surprise users, leak sensitive cost or agent metadata, and violate least-surprise expectations for an analysis tool.

Natural-Language Policy Violations

Low
Confidence
98% confidence
Finding
The instruction "You speak in plain English" imposes a language constraint for all users. There is no opt-in, locale selection, or justification that this is a region-specific skill, so it conflicts with the policy against forcing a specific language without user choice.

Description-Behavior Mismatch

Low
Confidence
84% confidence
Finding
The state-file instructions direct the skill to persist data after every report and run, which goes beyond a purely analytical coach and introduces side effects on the local environment. While lower severity than direct config changes, undocumented persistence can create privacy, integrity, and operational issues, especially if users expect read-only analysis.

Static analysis

No suspicious patterns detected.