Back to skill

Security audit

claw-graceful-recovery

Security checks for vulnerabilities and agentic risk

Overview

This recovery skill is mostly purpose-aligned, but it includes an unsafe shell logging template that could execute injected command text if used literally.

Review before installing. The skill is intended to stop stuck permission-error workflows, but its fallback logging command should be changed to a safe file-write or fixed printf command before use. Also narrow the recovery triggers so ordinary messages do not clear an active task, and sanitize user-facing examples so they do not expose full paths or encourage broad sudo use.

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

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:73
Finding

Shell Command Injection Through Dynamic Recovery Log Content

Content
View full analysis
| <错误类型>" >> ~/claw_recovery.log ``` `i18n/en.md:75`: ```bash echo "[$(date)] | " >> ~/claw_recovery.log ``` `references/feedback-templates.md:55`: ```bash echo "[$(date)] 权限错误恢复:<操作描述> | <错误类型>" >> ~/claw_recovery.log ``` `i18n-en-references/feedback-templates.md:56`: ```bash echo "[$(date)] Permission error recovery: | " >> ~/claw_recovery.log ``` ### Technical Analysis The recovery workflow instructs the Agent to place an operation description and error type directly into a shell command. These values may contain content derived from a user's instruction, a file name, tool output, or an error message. If the Agent performs textual placeholder substitution and executes the resulting command as shell source, shell metacharacters in the inserted content will be interpreted. Double quotes do not disable command substitution through constructs such as `$(command)` or backticks. For example, an operation description containing: ```text process $(malicious_command) ``` could produce: ```bash echo "[$(date)] Permission error recovery: process $(malicious_command) | permission denied" >> ~/claw_recovery.log ``` The shell would execute `malicious_command` before writing the resulting log entry. The vulnerable behavior is conditional on the Agent interpolating untrusted text into the command source, but that is the natural implementation implied by the documented placeholders. ### Attack Path 1. An attacker submits a task whose description, target name, or other logged content contains shell command-substitution syntax. 2. The task encoun ...[truncated 1324 chars]
Remediation
View remediation
> "$HOME/claw_recovery.log" ' sh "$operation" "$error_type" ``` The execution layer must pass `operation` and `error_type` as distinct argument values rather than concatenating them into the command string. 4. **Normalize log content.** Remove carriage returns, newlines, and control characters to prevent log forging and multiline injection. 5. **Apply size limits.** Truncate operation descriptions and error messages to a reasonable maximum length before logging. 6. **Restrict log-file permissions.** Create `~/claw_recovery.log` with owner-only access where supported, such as mode `0600`. 7. **Update all localized copies consistently.** Apply the same safe logging guidance to: - `SKILL.md` - `i18n/en.md` - `references/feedback-templates.md` - `i18n-en-references/feedback-templates.md` ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • 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 (15)

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · i18n-en-references/feedback-templates.md (reported line 70)May include surrounding context.

md
at Object.readFileSync (fs.js:364:35)

# ❌ 禁止:暴露系统路径给用户
无法访问 /Users/admin/.ssh/id_rsa,权限被拒

# ❌ 禁止:技术性描述
errno: -13, code: 'EACCES', syscall: 'open'

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/feedback-templates.md (reported line 69)May include surrounding context.

md
at Object.readFileSync (fs.js:364:35)

# ❌ 禁止:暴露系统路径给用户
无法访问 /Users/admin/.ssh/id_rsa,权限被拒

# ❌ 禁止:技术性描述
errno: -13, code: 'EACCES', syscall: 'open'

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger list includes broad, everyday phrases such as ‘卡住了’, ‘无响应’, ‘强制恢复’, and ‘恢复待命’, which can match normal conversational text rather than a true permission-error recovery condition. In an agent skill that clears task context and stops current work, accidental activation can cause denial of service, loss of in-progress state, skipped work, or inappropriate task termination.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The example user-facing message includes a full filesystem path even though the policy explicitly says not to expose full paths. In a WeChat-facing recovery skill, leaking local paths can disclose host layout, sensitive file targets, and environmental details that help an attacker refine later probes or social engineering.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
92% confidence
Finding

Telling the user to 'run sudo manually' encourages privileged execution to overcome access controls without sufficient safety framing. In an agent-recovery context, normalizing elevation as the default workaround can lead users to run overly broad privileged commands and increase the blast radius of mistakes or malicious follow-up instructions.

Content

Scanner excerpt · i18n-en-references/feedback-templates.md (reported line 26)May include surrounding context.

text
⚠️ Task aborted: reading /var/log/system.log
Reason: Insufficient permissions (root required)
Suggestion: Try running sudo manually in terminal, then retry

Ready. Send your next instruction.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

This batch example exposes multiple sensitive absolute paths to the user, directly contradicting the documented prohibition. Repeated path disclosure provides reconnaissance about the system, accessed resources, and privilege boundaries, which is especially risky in a remote command channel like WeChat.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file explicitly requires all feedback to 'Use English' for responses. Per the policy criteria, forcing a specific language is a natural-language policy violation unless the skill offers a language choice or clearly documents a justified region-specific constraint, which this file does not.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This markdown file is entirely Chinese-language instructional content, and there is no indication that users may opt into another language or that the skill is intentionally restricted to a Chinese-speaking context. Under the policy rule for language or locale constraints, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/feedback-templates.md (reported line 26)May include surrounding context.

text
⚠️ 任务中止:读取 /var/log/system.log
原因:权限不足(需要 root 权限)
建议:可尝试在终端手动执行 sudo 后重试

已就绪,可以发送下一条指令。

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Line L79 explicitly requires responses to be in Chinese ('用中文') as a blanket rule. This is a natural-language locale policy constraint and the file does not indicate any user preference, opt-in, or justified region-specific limitation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

The instruction says to describe the issue '用中文简洁描述', which forces a specific language for user-facing communication. This is a natural-language policy concern because the file does not offer the user a language/locale choice or document a justified locale restriction.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The text states a platform-specific behavioral assumption, "WeChat has no STDIN available," in an English i18n reference file without any indication that locale or channel behavior is optional or user-selectable. Under the policy rule, fixed language/locale or platform-specific natural-language constraints should be documented as justified or offer opt-in; this file does not do so.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The template uses 'root required', which is a technical privilege term, while the language principles instruct authors not to use technical terms in user feedback. This creates a documentation-level contradiction about the acceptable style of user messaging.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
72% confidence
Finding

The file begins by stating raw error stack traces are strictly prohibited, but Scenario 4 directs silently logging an operation description and error type. Although not a full stack trace and intended for logs rather than user output, this creates ambiguous documentation that partially undermines the strict prohibition language.

Content

No source excerpt is available for this finding.

Excessive Permissions

Low
Category
Privilege Escalation
Confidence
85% confidence
Finding

Skill requests more permissions than appear necessary for its stated functionality. Review if elevated access is justified.

Content

Scanner excerpt · i18n/en.md (reported line 38)May include surrounding context.

md
- Stop the current operation, do not retry
- Do not attempt to execute again with different parameters
- Do not attempt to bypass permission checks
- Clear the execution context of the current task

### 2. Record the Error (internal, do not send to user)

Static analysis

No suspicious patterns detected.