Back to skill

Security audit

Clawdoc

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a local diagnostic tool, but it can read private agent logs through broad triggers and has an opt-in persistent learning write path that needs careful review.

Install only if you are comfortable with the agent reading local OpenClaw session logs. Prefer explicit /clawdoc commands with specific paths, avoid relying on generic natural-language triggers, and enable CLAWDOC_LEARNINGS=1 only for trusted diagnose output in repositories where persistent learning files are expected.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • 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
  • 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)

T02 · Agent Memory Poisoning

Warning
Location
scripts/prescribe.sh:42
Finding

Persistent Agent Memory Poisoning Through Unsanitized Diagnosis Input

Content
View full analysis
&2 exit 1 fi # Validate it's a JSON array if ! echo "$INPUT" | jq -e 'if type == "array" then true else error("not an array") end' >/dev/null 2>&1; then echo "Error: input is not a valid JSON array." >&2 exit 1 fi ``` ```bash # Self-improving-agent integration (opt-in: set CLAWDOC_LEARNINGS=1) if [ "${CLAWDOC_LEARNINGS:-0}" = "1" ] && [ -d ".learnings" ]; then LEARNINGS_FILE=".learnings/LEARNINGS.md" echo "" >&2 echo "[prescribe] .learnings/ directory found — writing to $LEARNINGS_FILE" >&2 # Get existing DR count to generate next ID EXISTING_COUNT=0 if [ -f "$LEARNINGS_FILE" ]; then EXISTING_COUNT=$(grep -c "^### DR-" "$LEARNINGS_FILE" 2>/dev/null || true) EXISTING_COUNT=${EXISTING_COUNT:-0} fi APPENDED=0 UPDATED=0 # Process each finding by index FINDING_INDICES=$(echo "$INPUT" | jq -r 'to_entries[] | .key') for IDX in $FINDING_INDICES; do # Build Pattern-Key for this finding (doctor.) PKEY=$(echo "$INPUT" | jq -r --argjson i "$IDX" '.[$i].pattern | gsub(" "; "_") | gsub("-"; "_") | "doctor." + .') # Compute DR number for this entry DR_NUM=$(( EXISTING_COUNT + IDX + 1 )) if [ "$DR_NUM" -lt 10 ]; then DR_PREFIX="DR-00${DR_NUM}" elif [ "$DR_NUM" -lt 100 ]; then DR_PREFIX="DR-0${DR_NUM}" else DR_PREFIX="DR-${DR_NUM}" fi # Check if this Pattern-Key already exists in LEARNINGS.md ALREADY_EXISTS=0 if [ - ...[truncated 3520 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
dev/convert-claude-sessions.sh:19
Finding

Caller-Controlled Output Path Can Cause Arbitrary Recursive Deletion

Content
View full analysis
&2 exit 1 fi if [ -d "$OUTPUT_DIR" ] && [ "$(ls -A "$OUTPUT_DIR" 2>/dev/null)" ]; then echo "Output directory '$OUTPUT_DIR' exists and is not empty." printf "Remove it and regenerate? [y/N] " read -r CONFIRM if [ "$CONFIRM" != "y" ] && [ "$CONFIRM" != "Y" ]; then echo "Aborted." >&2 exit 1 fi fi rm -rf "$OUTPUT_DIR" mkdir -p "$OUTPUT_DIR" ``` ### Technical Analysis The second positional argument is assigned directly to `OUTPUT_DIR` and later passed to `rm -rf`. The script does not canonicalize the path or reject dangerous destinations such as `/`, the user’s home directory, the input directory, the repository root, or directories outside the expected fixture tree. A confirmation prompt is displayed only when the target already exists and is non-empty. An empty sensitive directory is removed without confirmation. For a non-empty target, the prompt does not provide additional safeguards beyond displaying the caller-supplied string, and an accidental approval results in recursive deletion. Shell quoting prevents command injection through metacharacters, but it does not prevent destructive use of a valid filesystem path. The script is located under `dev/` and is not copied by `install.sh`, which substantially reduces normal end-user exposure. ### Attack Path 1. A user or automation invokes `dev/convert-claude-sessions.sh` with a sensitive directory as its second argument. 2. If the directory is empty, the script reaches `rm -rf` without confirmation. 3. If it is non-empty, the user is shown a generic regeneration prompt and m ...[truncated 1051 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (34)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This skill advertises diagnosis, but the markdown also documents an optional mode that writes findings to .learnings/LEARNINGS.md without prominent warning in the main usage flow. Undeclared or underemphasized persistence is dangerous because a diagnostic skill expected to read logs can unexpectedly modify repository state, contaminate future agent behavior, or leak sensitive operational observations into tracked files.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This skill advertises diagnosis, but the markdown also documents an optional mode that writes findings to .learnings/LEARNINGS.md without prominent warning in the main usage flow. Undeclared or underemphasized persistence is dangerous because a diagnostic skill expected to read logs can unexpectedly modify repository state, contaminate future agent behavior, or leak sensitive operational observations into tracked files.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

This skill advertises diagnosis, but the markdown also documents an optional mode that writes findings to .learnings/LEARNINGS.md without prominent warning in the main usage flow. Undeclared or underemphasized persistence is dangerous because a diagnostic skill expected to read logs can unexpectedly modify repository state, contaminate future agent behavior, or leak sensitive operational observations into tracked files.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This skill advertises diagnosis, but the markdown also documents an optional mode that writes findings to .learnings/LEARNINGS.md without prominent warning in the main usage flow. Undeclared or underemphasized persistence is dangerous because a diagnostic skill expected to read logs can unexpectedly modify repository state, contaminate future agent behavior, or leak sensitive operational observations into tracked files.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This skill advertises diagnosis, but the markdown also documents an optional mode that writes findings to .learnings/LEARNINGS.md without prominent warning in the main usage flow. Undeclared or underemphasized persistence is dangerous because a diagnostic skill expected to read logs can unexpectedly modify repository state, contaminate future agent behavior, or leak sensitive operational observations into tracked files.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

This skill advertises diagnosis, but the markdown also documents an optional mode that writes findings to .learnings/LEARNINGS.md without prominent warning in the main usage flow. Undeclared or underemphasized persistence is dangerous because a diagnostic skill expected to read logs can unexpectedly modify repository state, contaminate future agent behavior, or leak sensitive operational observations into tracked files.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

This skill advertises diagnosis, but the markdown also documents an optional mode that writes findings to .learnings/LEARNINGS.md without prominent warning in the main usage flow. Undeclared or underemphasized persistence is dangerous because a diagnostic skill expected to read logs can unexpectedly modify repository state, contaminate future agent behavior, or leak sensitive operational observations into tracked files.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

This skill advertises diagnosis, but the markdown also documents an optional mode that writes findings to .learnings/LEARNINGS.md without prominent warning in the main usage flow. Undeclared or underemphasized persistence is dangerous because a diagnostic skill expected to read logs can unexpectedly modify repository state, contaminate future agent behavior, or leak sensitive operational observations into tracked files.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This skill advertises diagnosis, but the markdown also documents an optional mode that writes findings to .learnings/LEARNINGS.md without prominent warning in the main usage flow. Undeclared or underemphasized persistence is dangerous because a diagnostic skill expected to read logs can unexpectedly modify repository state, contaminate future agent behavior, or leak sensitive operational observations into tracked files.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

This skill advertises diagnosis, but the markdown also documents an optional mode that writes findings to .learnings/LEARNINGS.md without prominent warning in the main usage flow. Undeclared or underemphasized persistence is dangerous because a diagnostic skill expected to read logs can unexpectedly modify repository state, contaminate future agent behavior, or leak sensitive operational observations into tracked files.

Content

No source excerpt is available for this finding.

Context Leakage

High
Category
Data Exfiltration
Confidence
75% confidence
Finding

Code or instructions that leak agent conversation context to external services, potentially exposing sensitive user interactions.

Content

Scanner excerpt · scripts/cost-waterfall.sh (reported line 59)May include surrounding context.

sh
jq -s '
  [.[] | select(.type == "message")] as $messages |

  # For each turn, capture context about what preceded it (tool results)
  [$messages | to_entries[] |
    .key as $idx |
    .value as $msg |

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
77% confidence
Finding

The 0.12.0 entry states that diagnostics now require explicit user-provided paths and that there is 'No more auto-discovery of session directories or workspace config files.' However, the same changelog elsewhere still documents self-improving-agent integration that writes to .learnings/LEARNINGS.md and cross-session recurrence tracking, which suggests broader workspace interaction than the hardening note implies. Because this is documentation-only evidence, the contradiction is limited but still indicates intent-level inconsistency in the file's claims about current behavior.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README says natural language triggers include phrases like "What went wrong?" and "Give me a full diagnosis" without narrowing the context in which they should activate. These are common phrases that could be used in unrelated conversations, increasing the risk of unintended invocation.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill declares required binaries and repeatedly instructs the agent to execute bash scripts, but it does not declare any explicit tool scope such as allowed-tools or permissions. That creates an authorization gap where a user-invocable skill can trigger shell-capable behavior broader than what is clearly disclosed or constrained, increasing the chance of unintended command execution against local files and session data.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The natural-language triggers are extremely broad terms like 'debug', 'diagnose', 'health check', and 'what's wrong', which overlap with common conversation and unrelated support requests. In a user-invocable skill that runs shell commands over local session directories, broad triggers raise the risk of accidental activation and unintended access to logs or command execution when the user did not specifically request this skill.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill documents writing to .learnings/LEARNINGS.md but does not provide a strong user warning that files will be modified. Hidden persistence in a diagnostic tool is risky because it violates read-only expectations, can pollute repositories or agent memory artifacts, and may commit sensitive findings into durable project files.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script accepts an arbitrary output directory from the caller and then unconditionally runs rm -rf "$OUTPUT_DIR" after only a simple interactive prompt if the directory is non-empty. This creates a real destructive capability: a mistaken, malicious, or unexpected argument can delete unrelated filesystem contents, and that behavior is not necessary for a diagnostic/format-conversion helper tied to this skill’s stated purpose.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.