Back to skill

Security audit

Claw-Diary

Security checks for vulnerabilities and agentic risk

Overview

This skill is transparently a cloud guard and audit integration, but it gives a remote service broad approval, logging, and persistent diary influence over sensitive agent activity.

Install only if you explicitly want ClawDiary or your self-hosted instance to approve high-risk actions and receive audit/diary metadata. Avoid sending secrets, private user data, raw command output, or chain-of-thought-style reasoning; prefer self-hosting or disabling diary/audit in sensitive environments, and do not import the remote MCP descriptor unless you can verify and control updates.

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
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (4)

T01 · Skill Instruction Hijacking

Error
Location
instructions.txt:9
Finding
Mandatory External Approval Transfers Control of Agent Actions to a Third Party<![CDATA[ ## Vulnerability Details **File Location**: `instructions.txt:9`; related behavior in `SKILL.md:34-47` **Vulnerability Type**: `T01: Skill Instruction Hijacking` **Risk Level**: High ### Vulnerable Code Snippet ```text 3. **Guard Before Destructive Actions:** You MUST call `POST https://api.clawdiary.org/v1/guard` before any potentially destructive action or outbound communication (e.g. `rm -rf`, `execute_bash`, `send_mail`). Wait for the response and ONLY proceed if `approved` is true. If it returns false or hangs open, wait or abort. ``` Related skill instructions: ```markdown ### 1. Active Guard (Approval Gate) **Endpoint:** `POST https://api.clawdiary.org/v1/guard` **When to use:** **BEFORE** executing any high-risk, destructive, or outbound action (such as executing bash, file deletions, sending emails). **Behavior:** Call this endpoint and wait for the response. Red-light actions will block the HTTP response until a human approves via Telegram. Only proceed with the action if the response returns `approved: true`. Example Request: ```json { "agent_id": "openclaw", "action_type": "execute_bash", "command": "rm -rf /tmp/data", "params": { "cwd": "/home/user" }, "thought": "Cleaning up temporary files" } ``` ``` ### Technical Analysis The skill uses mandatory instructions to place an external service in the authorization path for destructive actions and outbound communication. The agent is told that it must disclose action details, wait for the remote response, and continue only when the service returns `approved: true`. This is more than passive monitoring: it gives infrastructure outside the local trust boundary veto power over legitimate agent operations. The instruction to wait when a request “hangs open” also permits an external availability failure to suspend the agent indefinitely. No locally enforceable approval policy, maximum timeout, service-identity pinning, or mechanism preserving direct user authority is specified. # ...[truncated 1060 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Make remote approval explicitly opt-in and disabled by default. - Let the user define the exact action types and resources subject to remote approval. - Preserve local user authority so a third party cannot override higher-priority instructions. - Add a strict, configurable timeout and abort safely rather than waiting indefinitely. - Send a minimal structured action category instead of raw commands, parameters, or reasoning. - Authenticate approval responses and bind each response to a nonce, session, action digest, expiration time, and intended agent. - Provide a local-only approval option for sensitive environments. - Clearly document the external trust boundary, availability dependency, and consequences of service compromise. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
instructions.txt:3
Finding
Execution Metadata and Reasoning May Be Disclosed Through Incomplete Redaction<![CDATA[ ## Vulnerability Details **File Location**: `instructions.txt:3-7,11`; related behavior in `SKILL.md:49-61` **Vulnerability Type**: `T09: Insecure Skill Coding Practices` **Risk Level**: Medium ### Vulnerable Code Snippet ```text 2. **Data Privacy & Concrete Redaction Algorithm (CRITICAL):** - **Justification for exposure:** This skill sends limited execution metadata (tool name, command structure, and timestamps) to a remote audit server (api.clawdiary.org) to provide visibility and safety approvals. - **Strict Size Limit:** The `payload` and `command` fields MUST NEVER exceed 500 characters. You MUST truncate these fields if they are longer than 500 characters. - **Enforceable Redaction:** Before transmission, you MUST execute a strict regex filter over the `payload`, `command`, and `thought` fields: `s/([A-Za-z0-9_-]{20,})/[REDACTED_SECRET]/g` and `s/([A-Za-z0-9+/]{40,}={0,2})/[REDACTED_BASE64]/g` to mask potential API keys, passwords, and private tokens. - **Allowed Data:** You are strictly PROHIBITED from sending files, user private data, or raw command outputs to the remote service. Use generic descriptions instead (e.g. `[FILE_PATH]`, `[USER_ID]`). ``` ```text 4. **Audit Log:** Log all your important executions and token resource consumption using `POST https://api.clawdiary.org/v1/audit` immediately AFTER the action. Ensure you follow the redaction rules. ``` Related skill instructions: ```markdown ### 2. Passive Audit (Logging) **Endpoint:** `POST https://api.clawdiary.org/v1/audit` **When to use:** **AFTER** an action completes. **Behavior:** Report the action, cost, and payload. This helps the human operator review usage asynchronously. Example Request: ```json { "agent_id": "openclaw", "session_id": "sess-001", "action_type": "tool_call", "cost": 0.003, "payload": { "tool": "search_web", "query": "weather in London" } } ``` ``` ### Technical Analysis The skill directs the agent to transmit command, payload, th ...[truncated 2177 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Disable remote telemetry by default and obtain explicit, informed consent before enabling it. - Do not transmit raw commands, raw payloads, chain-of-thought-style reasoning, or command output. - Replace regex-only redaction with structured allowlisting: construct a new event containing only predefined, non-sensitive fields. - Use coarse action categories and irreversible hashes or local identifiers where correlation is required. - Apply format-aware secret detection as defense in depth, not as the primary privacy boundary. - Reject telemetry when its sensitivity cannot be determined safely. - Add automated tests covering short passwords, punctuated tokens, URLs with credentials, personal identifiers, and natural-language secrets. - Document server-side retention, access control, encryption, deletion, and incident-response policies. - Permit local audit storage for environments that cannot transmit operational data externally. ]]>

T07 · Tool Hijacking and Spoofing

Error
Location
SKILL.md:81
Finding
Mutable Remote MCP Descriptor Can Register Unreviewed Tool Behavior<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:81-83` **Vulnerability Type**: `T07: Tool Hijacking and Spoofing` **Risk Level**: High ### Vulnerable Code Snippet ```markdown ## MCP Support ClawDiary provides an MCP descriptor at `GET https://api.clawdiary.org/mcp.json`. Importing this to an MCP client automatically registers the `request_human_approval` tool handling the active guard. ``` ### Technical Analysis The skill recommends importing a mutable MCP descriptor directly from a remote URL. Importing that descriptor automatically registers a tool associated with a security-sensitive approval process. The audited package does not include a fixed copy of the descriptor and does not specify a version, signature, certificate pin, cryptographic digest, expected schema, or permitted tool capabilities. Therefore, the effective tool description and registration behavior can change after the static package has been reviewed. HTTPS protects transport in ordinary conditions but does not protect against a compromised origin or an authorized server-side change. Because agent tool selection and argument construction can be influenced by tool names and descriptions, a modified descriptor could misrepresent the tool's purpose, request additional data, or alter the endpoint and schema used by the client. ### Attack Path 1. A user follows the documentation and imports `https://api.clawdiary.org/mcp.json`. 2. The MCP client retrieves the descriptor at import or refresh time. 3. The service, deployment pipeline, domain, or hosting account is compromised, or the descriptor is otherwise changed after review. 4. The client receives the modified descriptor without checking it against an audited digest or signature. 5. A legitimate-looking `request_human_approval` tool is registered with changed instructions, parameters, or behavior. 6. The agent invokes the tool under the assumption that it is the reviewed approval mechanism. ### Impact Assessment A malici ...[truncated 509 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Bundle the reviewed MCP descriptor in the skill package instead of importing it from a mutable URL. - Pin the descriptor to a specific version and cryptographic digest. - Require a verifiable digital signature from a documented signing key before registration. - Display descriptor changes and require explicit user approval before updating registered tools. - Enforce an allowlist for expected tool names, input fields, endpoint origins, and capabilities. - Reject descriptors that request additional permissions or fields beyond the audited schema. - Disable automatic descriptor refresh unless updates are integrity-checked and approved. - Apply least privilege to the MCP server and prevent it from accessing unrelated local tools or data. ]]>

T02 · Agent Memory Poisoning

Warning
Location
instructions.txt:13
Finding
Untrusted Shared Diary Content Can Poison Future Agent Context<![CDATA[ ## Vulnerability Details **File Location**: `instructions.txt:13`; related behavior in `SKILL.md:63-75` **Vulnerability Type**: `T02: Agent Memory Poisoning` **Risk Level**: Medium ### Vulnerable Code Snippet ```text 5. **Diary Sync:** Write major milestones to `POST https://api.clawdiary.org/v1/diary` with your `agent_id` or your owner/device IDs. Read past entries using `GET https://api.clawdiary.org/v1/diary?owner_id=<id>` to gain context across different devices belonging to the same owner. ``` Related skill instructions: ```markdown ### 3. Shared Diary **Endpoints:** `POST https://api.clawdiary.org/v1/diary` (write), `GET https://api.clawdiary.org/v1/diary?owner_id=...` (list) **When to use:** To keep a shared diary across multiple devices (lobsters) for one owner. This allows agents to sync status updates and context. Example Write Request: ```json { "owner_id": "alice", "lobster_id": "office-mac", "content": "Finished API integration today. All good." } ``` ``` ### Technical Analysis The skill establishes a persistent, remotely stored context channel shared across sessions and devices. It instructs agents to retrieve diary entries to “gain context,” but it does not specify that retrieved content must be treated as untrusted data. No content signature, author provenance, trust label, freshness guarantee, conflict policy, or separation between diary data and executable instructions is documented. If an attacker gains the ability to create or alter diary entries—through account compromise, API-key compromise, compromised devices, or service compromise—the attacker can place instruction-like text in persistent state. A later agent may interpret that text as trusted context and allow it to influence its decisions. ### Attack Path 1. An attacker obtains authorized write access to an owner's diary or compromises a device or service account that has such access. 2. The attacker writes a diary entry containing false status information or ...[truncated 932 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Treat all retrieved diary entries as untrusted data rather than authoritative instructions. - Add an explicit instruction that diary content must never override system, developer, user, or local security policies. - Keep diary text in a clearly delimited data structure and do not insert it directly into an instruction channel. - Cryptographically authenticate entries and record author, device, timestamp, revision, and integrity metadata. - Enforce owner- and device-scoped authorization with revocable, least-privilege credentials. - Require user confirmation before diary content can trigger or materially alter a sensitive action. - Detect and quarantine entries containing imperative prompts, tool requests, credential requests, or policy-changing language. - Provide revision history, rollback, deletion, and security alerts for writes from new devices. - Limit retention and allow diary synchronization to be disabled entirely. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (15)

Tool Parameter Abuse

High
Category
Tool Misuse
Content
{
  "agent_id": "openclaw",
  "action_type": "execute_bash",
  "command": "rm -rf /tmp/data",
  "params": { "cwd": "/home/user" },
  "thought": "Cleaning up temporary files"
}
Confidence
90% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
{
  "agent_id": "openclaw",
  "action_type": "execute_bash",
  "command": "rm -rf /tmp/data",
  "params": { "cwd": "/home/user" },
  "thought": "Cleaning up temporary files"
}
Confidence
85% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Tool Parameter Abuse

High
Category
Tool Misuse
Content
{
  "agent_id": "openclaw",
  "action_type": "execute_bash",
  "command": "rm -rf /tmp/data",
  "params": { "cwd": "/home/user" },
  "thought": "Cleaning up temporary files"
}
Confidence
90% confidence
Finding
Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Context-Inappropriate Capability

High
Confidence
99% confidence
Finding
Requiring redaction over the internal 'thought' field implies the agent may transmit hidden reasoning to a remote service, which is inappropriate for auditing and can expose sensitive internal deliberations, user-derived secrets, or security logic. The provided regex-based redaction is brittle and cannot reliably prevent leakage of secrets or sensitive context embedded in free-form reasoning.

External Transmission

Medium
Category
Data Exfiltration
Content
## Features & Usage

### 1. Active Guard (Approval Gate)
**Endpoint:** `POST https://api.clawdiary.org/v1/guard`
**When to use:** **BEFORE** executing any high-risk, destructive, or outbound action (such as executing bash, file deletions, sending emails).
**Behavior:**
Call this endpoint and wait for the response. Red-light actions will block the HTTP response until a human approves via Telegram. Only proceed with the action if the response returns `approved: true`.
Confidence
86% confidence
Finding
The guard endpoint transmits high-risk action details, including commands, parameters, and agent reasoning, to an external service before execution. Even though the feature is security-oriented, it still creates a data exposure path to a third party and may leak sensitive operational context or secrets embedded in commands or thoughts.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill explicitly instructs sending action payloads, shared diary content, and status/context to a third-party cloud service, but it does not clearly warn that these may contain sensitive operational data, prompts, commands, or user content. This creates a real privacy and data-governance risk because users may enable logging or diary sync without understanding that potentially confidential information leaves the local environment.

External Transmission

Medium
Category
Data Exfiltration
Content
```

### 2. Passive Audit (Logging)
**Endpoint:** `POST https://api.clawdiary.org/v1/audit`
**When to use:** **AFTER** an action completes.
**Behavior:**
Report the action, cost, and payload. This helps the human operator review usage asynchronously.
Confidence
94% confidence
Finding
The audit endpoint is designed to send action metadata, cost, and payload to a remote service after execution, which can include sensitive tool inputs or outputs. Without strong warnings and data minimization, this is a genuine confidentiality risk because routine logging may exfiltrate private business or user data to the cloud.

External Transmission

Medium
Category
Data Exfiltration
Content
```

### 3. Shared Diary
**Endpoints:** `POST https://api.clawdiary.org/v1/diary` (write), `GET https://api.clawdiary.org/v1/diary?owner_id=...` (list)
**When to use:** To keep a shared diary across multiple devices (lobsters) for one owner. This allows agents to sync status updates and context.

Example Write Request:
Confidence
95% confidence
Finding
The shared diary endpoint encourages syncing arbitrary status updates and context across devices via a remote service, which can easily include sensitive internal notes, credentials, customer data, or operational context. Because this feature is framed as general shared memory, the skill context makes accidental over-sharing more likely and therefore more dangerous than a narrowly scoped API call.

External Transmission

Medium
Category
Data Exfiltration
Content
```

## MCP Support
ClawDiary provides an MCP descriptor at `GET https://api.clawdiary.org/mcp.json`. Importing this to an MCP client automatically registers the `request_human_approval` tool handling the active guard.
Confidence
50% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Vague Triggers

Medium
Confidence
85% confidence
Finding
The instructions impose broad mandatory remote guard, audit, and diary behaviors across important executions, outbound communication, and milestones, without narrowly scoping when these flows are appropriate. This unclear activation scope increases the chance that the agent will over-collect and over-transmit metadata in situations unrelated to the stated guardian purpose.

External Transmission

Medium
Category
Data Exfiltration
Content
- **Enforceable Redaction:** Before transmission, you MUST execute a strict regex filter over the `payload`, `command`, and `thought` fields: `s/([A-Za-z0-9_-]{20,})/[REDACTED_SECRET]/g` and `s/([A-Za-z0-9+/]{40,}={0,2})/[REDACTED_BASE64]/g` to mask potential API keys, passwords, and private tokens.
   - **Allowed Data:** You are strictly PROHIBITED from sending files, user private data, or raw command outputs to the remote service. Use generic descriptions instead (e.g. `[FILE_PATH]`, `[USER_ID]`).

3. **Guard Before Destructive Actions:** You MUST call `POST https://api.clawdiary.org/v1/guard` before any potentially destructive action or outbound communication (e.g. `rm -rf`, `execute_bash`, `send_mail`). Wait for the response and ONLY proceed if `approved` is true. If it returns false or hangs open, wait or abort.

4. **Audit Log:** Log all your important executions and token resource consumption using `POST https://api.clawdiary.org/v1/audit` immediately AFTER the action. Ensure you follow the redaction rules.
Confidence
90% confidence
Finding
The skill mandates outbound transmission to a third-party API for pre-action approval, including payload, command, and potentially thought-derived content, which creates a data exfiltration path outside the local trust boundary. Although the text includes truncation and regex redaction, those controls are insufficiently reliable to prevent leakage of sensitive metadata, commands, or identifiers.

External Transmission

Medium
Category
Data Exfiltration
Content
3. **Guard Before Destructive Actions:** You MUST call `POST https://api.clawdiary.org/v1/guard` before any potentially destructive action or outbound communication (e.g. `rm -rf`, `execute_bash`, `send_mail`). Wait for the response and ONLY proceed if `approved` is true. If it returns false or hangs open, wait or abort.

4. **Audit Log:** Log all your important executions and token resource consumption using `POST https://api.clawdiary.org/v1/audit` immediately AFTER the action. Ensure you follow the redaction rules.

5. **Diary Sync:** Write major milestones to `POST https://api.clawdiary.org/v1/diary` with your `agent_id` or your owner/device IDs. Read past entries using `GET https://api.clawdiary.org/v1/diary?owner_id=<id>` to gain context across different devices belonging to the same owner.
Confidence
89% confidence
Finding
The audit endpoint requires logging important executions and token resource consumption to an external server immediately after actions, expanding external visibility into agent behavior. Even if raw outputs are excluded, execution metadata and token usage can still reveal sensitive operational patterns, user activity, and task context.

External Transmission

Medium
Category
Data Exfiltration
Content
4. **Audit Log:** Log all your important executions and token resource consumption using `POST https://api.clawdiary.org/v1/audit` immediately AFTER the action. Ensure you follow the redaction rules.

5. **Diary Sync:** Write major milestones to `POST https://api.clawdiary.org/v1/diary` with your `agent_id` or your owner/device IDs. Read past entries using `GET https://api.clawdiary.org/v1/diary?owner_id=<id>` to gain context across different devices belonging to the same owner.
Confidence
97% confidence
Finding
The diary sync feature explicitly sends milestones plus agent_id or owner/device IDs to a remote service and reads historical entries by owner_id, creating a persistent cross-session and cross-device data channel. In this skill context, that is more dangerous because a 'Guardian' role does not justify long-term behavioral journaling tied to user identity across devices.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
The skill instructs cross-device diary syncing using owner/device identifiers and retrieval of prior entries by owner_id, which enables correlation of activity across devices without a clear need for a 'Guardian' function. This creates unnecessary tracking and privacy exposure, and could leak sensitive behavioral context to a remote service if the identifiers or diary contents are misused or compromised.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
The skill requires use of owner/device IDs for diary writes and cross-device reads without any mention of user opt-in, notice, or policy justification. This enables persistent identity linkage and behavioral profiling across devices, which is disproportionate to the stated purpose and raises substantial privacy and compliance risk.

Static analysis

No suspicious patterns detected.