Back to skill

Security audit

Hook Guard

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent safety guard, but it can automatically log broad agent activity and make retained plaintext backups of sensitive files such as .env.

Install only if you are comfortable with an always-on guard that records operation metadata and creates short-lived backups. Before enabling it broadly, exclude secret-bearing files such as .env, private keys, token stores, and production configs from automatic backup; restrict backup and log permissions; and require explicit opt-in for cross-session audit reuse.

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:72
Finding

Plaintext Backups of Sensitive Configuration Files

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 72–80
Vulnerability Type: Plaintext storage of sensitive configuration backups
Risk Level: Medium

Vulnerable Code

markdown
**自动备份的场景:**
- 编辑配置文件(openclaw.json、.env、nginx.conf 等)
- 覆盖写入工作区文件
- 修改 cron jobs
- 更新数据库记录

**备份机制:**
- 备份路径:`~/.openclaw/workspace-main/.hook-guard/backups/YYYY-MM-DD/`
- 文件名:`{原始文件名}.{HHmmss}.bak`
- 保留最近 7 天的备份,自动清理旧备份

Technical Analysis

The Skill explicitly instructs the Agent to back up sensitive configuration files, including .env, into a predictable workspace directory. Such files commonly contain API keys, access tokens, database credentials, and passwords.

The backup procedure does not require encryption, redaction, restrictive file permissions, secure directory permissions, or exclusion of secret-bearing files. It can therefore create additional plaintext copies of credentials and retain them for seven days. The predictable directory and filename scheme also makes those copies easy to locate.

Exploitation requires an attacker, local process, another Agent, workspace scanner, synchronization service, or backup tool to have read access to the workspace backup directory. The Skill does not itself grant such access.

Attack Path

  1. A user or Agent modifies a secret-bearing file such as .env.
  2. Hook Guard classifies the modification as a Yellow operation.
  3. Before editing, it copies the original file to ~/.openclaw/workspace-main/.hook-guard/backups/YYYY-MM-DD/.
  4. The backup retains the original secrets in plaintext under a predictable filename.
  5. A principal or process with workspace read access enumerates the backup directory.
  6. The principal reads the backup and obtains any credentials stored in the source file.
  7. The exposed credentials may then be used against the services for which they are valid.

Impact Assessment

Successful exploitation can disclose API keys, passwords, tokens, database credentials, and other secr ...[truncated 456 chars]

Remediation
View remediation

Remediation Suggestions

  • Exclude .env, private keys, credential stores, token files, and other secret-bearing files from automatic backups by default.
  • Require explicit user confirmation before creating a backup of any file detected as containing secrets.
  • Store backups outside shared or routinely indexed workspace directories.
  • Create backup directories and files with owner-only permissions, such as directory mode 0700 and file mode 0600.
  • Preserve restrictive source permissions and never make a backup more broadly readable than its source.
  • Encrypt sensitive backups at rest using keys stored separately from the backup directory.
  • Apply secret-aware redaction when a complete byte-for-byte backup is unnecessary.
  • Avoid predictable filenames where feasible and prevent symlink-based redirection when creating backup files.
  • Securely remove expired sensitive backups and document that filesystem snapshots or synchronization services may retain copies.
  • Add tests verifying that secret-bearing files are excluded or protected and that backup permissions remain restrictive.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • 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
Findings (21)

Tool Parameter Abuse

High
Category
Tool Misuse
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).

Content

Scanner excerpt · README.md (reported line 91)May include surrounding context.

🟢 日志:47 条操作记录

最近拦截:

  • rm -rf /tmp/old-project/ → 改用 trash
  • sudo systemctl restart nginx → 确认后执行
text

Tool Parameter Abuse

High
Category
Tool Misuse
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).

Content

Scanner excerpt · SKILL.md (reported line 150)May include surrounding context.

🟢 日志:47 条操作记录

最近拦截:

  • rm -rf /tmp/old-project/ → 改用 trash
  • sudo systemctl restart nginx → 确认后执行
text

Tool Parameter Abuse

High
Category
Tool Misuse
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).

Content

Scanner excerpt · README.md (reported line 91)May include surrounding context.

🟢 日志:47 条操作记录

最近拦截:

  • rm -rf /tmp/old-project/ → 改用 trash
  • sudo systemctl restart nginx → 确认后执行
text

Tool Parameter Abuse

High
Category
Tool Misuse
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).

Content

Scanner excerpt · README.md (reported line 57)May include surrounding context.

md
🔴 危险操作拦截
━━━━━━━━━━━━

⚠️ 操作:rm -rf /home/wavm/important-project/
📁 影响:将永久删除 342 个文件
🔒 风险:不可逆操作

Tool Parameter Abuse

High
Category
Tool Misuse
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).

Content

Scanner excerpt · README.md (reported line 91)May include surrounding context.

md
🔴 危险操作拦截
━━━━━━━━━━━━

⚠️ 操作:rm -rf /home/wavm/important-project/
📁 影响:将永久删除 342 个文件
🔒 风险:不可逆操作

Tool Parameter Abuse

High
Category
Tool Misuse
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).

Content

Scanner excerpt · SKILL.md (reported line 56)May include surrounding context.

md
🔴 危险操作拦截
━━━━━━━━━━━━

⚠️ 操作:rm -rf /home/wavm/important-project/
📁 影响:将永久删除 342 个文件
🔒 风险:不可逆操作

Tool Parameter Abuse

High
Category
Tool Misuse
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).

Content

Scanner excerpt · SKILL.md (reported line 150)May include surrounding context.

md
🔴 危险操作拦截
━━━━━━━━━━━━

⚠️ 操作:rm -rf /home/wavm/important-project/
📁 影响:将永久删除 342 个文件
🔒 风险:不可逆操作

Tool Parameter Abuse

High
Category
Tool Misuse
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).

Content

Scanner excerpt · README.md (reported line 57)May include surrounding context.

md
🔴 危险操作拦截
━━━━━━━━━━━━

⚠️ 操作:rm -rf /home/wavm/important-project/
📁 影响:将永久删除 342 个文件
🔒 风险:不可逆操作

Tool Parameter Abuse

High
Category
Tool Misuse
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).

Content

Scanner excerpt · SKILL.md (reported line 56)May include surrounding context.

md
🔴 危险操作拦截
━━━━━━━━━━━━

⚠️ 操作:rm -rf /home/wavm/important-project/
📁 影响:将永久删除 342 个文件
🔒 风险:不可逆操作

Tool Parameter Abuse

High
Category
Tool Misuse
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).

Content

Scanner excerpt · SKILL.md (reported line 150)May include surrounding context.

md
📅 时间范围:最近 24 小时

🔴 拦截:2 次
  - rm -rf /tmp/old-project/ → 用户确认后改用 trash
  - sudo systemctl restart nginx → 用户确认后执行

🟡 备份:5 次

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 · README.md (reported line 92)May include surrounding context.

最近拦截:

  • rm -rf /tmp/old-project/ → 改用 trash
  • sudo systemctl restart nginx → 确认后执行
text

### 设计原则

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 · SKILL.md (reported line 134)May include surrounding context.

最近拦截:

  • rm -rf /tmp/old-project/ → 改用 trash
  • sudo systemctl restart nginx → 确认后执行
text

### 设计原则

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README states that all operations are logged and retained for 30 days, but it does not clearly warn users about the privacy and data-retention implications. In a skill designed to audit agent actions, this omission can lead to inadvertent collection of sensitive file paths, command history, message metadata, or other operational data without informed consent.

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 · README.md (reported line 109)May include surrounding context.

md
**🔴 Red(必须确认):**
- 删除文件(rm、rm -rf)
- 含 sudo 的命令
- 停止系统服务
- 清理 Docker 容器/镜像
- 发送消息到新聊天

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 · SKILL.md (reported line 151)May include surrounding context.

md
**🔴 Red(必须确认):**
- 删除文件(rm、rm -rf)
- 含 sudo 的命令
- 停止系统服务
- 清理 Docker 容器/镜像
- 发送消息到新聊天

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · README.md (reported line 168)May include surrounding context.

md
AI agents have powerful permissions — file read/write, command execution, message sending, config changes. With great power comes great risk:

- Accidentally deleting important files
- Running destructive commands without confirmation
- Sending messages to wrong recipients
- Breaking configurations

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill metadata embeds broad trigger phrases such as '守卫', '备份保护', and '安全模式', which can plausibly occur in ordinary conversation and cause unintended activation. Because this skill changes agent execution policy and may add logging, backup, and confirmation behavior automatically, accidental triggering can alter the agent's behavior without a clear user request.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest description and trigger phrases are presented entirely in Chinese, and the skill behavior is described as responding to specific Chinese-language phrases, without stating that other languages are supported or that the user can choose locale. This can amount to a language policy violation if the organization expects language neutrality or user choice.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The line 'Agent 自行判断当前操作需要额外防护' allows the agent to invoke the skill based on subjective internal judgment rather than an explicit user request. Self-activation creates prompt-scope creep: the skill can silently change execution flow, confirmation requirements, and persistence behavior in contexts where the user did not intend it.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill explicitly states that interception records can persist across sessions and be reused by other skills, creating a cross-session retention channel for user interaction data. Even though it claims not to log file contents, audit logs and interception metadata can still reveal sensitive operational history, counterparties, file paths, and behavior patterns.

Content

No source excerpt is available for this finding.

Vague Triggers

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The trigger phrase "守卫报告" / "guard report" is broad enough that ordinary conversation could unintentionally activate the skill and expose audit summaries or alter agent behavior. In a security-control skill, accidental triggering is more concerning because it may surface sensitive operational metadata or create unexpected workflow interruptions.

Content

No source excerpt is available for this finding.