Back to skill

Security audit

hook-auditor

Security checks for vulnerabilities and agentic risk

Overview

This skill is mostly a coherent Claude Code hook auditor, but it gives an unsafe dry-run procedure that can execute untrusted hook scripts on the user's machine while claiming it has no side effects.

Review this skill carefully before installing. The read-only scan is aligned with its hook-audit purpose, but do not run the documented dry-run command against hooks from unknown skills or plugins on your real machine; inspect hook source statically first or use an isolated sandbox with no home directory, credentials, or network access. Also expect the scan report to expose local Claude Code skill/plugin configuration details.

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

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:66
Finding

Unsafe Execution of Untrusted Hook Scripts During Dynamic Analysis

Content
View full analysis
``` The documentation characterizes this procedure as an isolated test with no side effects. However, piping controlled JSON into a hook does not constrain what the hook script can do. The `bash` interpreter executes the entire script with the current user's privileges. ### Technical Analysis Hook scripts are arbitrary executable programs. The supplied standard input only simulates a Claude Code hook event; it does not provide process isolation, filesystem restrictions, network restrictions, or privilege separation. A malicious hook can ignore its input and perform unrelated actions, including: - Reading files available to the current user. - Modifying shell initialization files or Claude Code configuration. - Accessing locally stored tokens, credentials, or SSH configuration. - Creating persistent user-level processes or scheduled tasks. - Sending information to a remote system if network access is available. - Deleting or encrypting user-accessible data. Static discovery of a hook does not establish that it is safe to execute. This procedure is particularly dangerous because the skill is explicitly intended to inspect hooks from unknown or untrusted skills and plugins. ### Attack Path 1. An attacker distributes a skill or plugin containing a malicious hook script. 2. The victim installs the package, causing the hook to appear in the audited configuration. 3. Hook Auditor discovers the script and recommends a dynamic dry run. 4. The victim executes the documented command using Bash. 5. Bash runs the full attacker-controlled script under the victim's account. 6. The script ignores or superficially processes the supplied JSON and performs malicious actions. 7. A ...[truncated 637 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/scan_hooks.py:61
Finding

Terminal Control-Sequence Injection Through Unsanitized Hook Metadata

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (8)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

这段代码的主要目的与声明中的“审计”部分基本一致:它遍历 ~/.claude 下多个位置,区分真正生效与不生效的 hooks,识别 skill 自带 hooks、plugin 是否启用、以及 marketplace 缓存,并输出 per-turn 成本提示。该部分与描述较为吻合。但声明的另一核心能力是‘清理’,包括在用户确认后移除或禁用这些常驻 hooks;代码完全没有写入文件、删除配置、修改 enabledPlugins 或其他清理行为,因此属于实质性能力缺失。此外,声明中提到‘标注可信度’与‘量化每轮成本’,代码只用固定说明文字和 per_turn 标记进行近似提示,没有看到明确的可信度评估机制或详细量化。综合看,这是描述大于实际实现的情况,应判定为不匹配。

Content

No source excerpt is available for this finding.

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
91% confidence
Finding

The skill explicitly targets ~/.claude/settings.json, skill hook registrations, and plugin configuration, which are sensitive agent-control files. Access to these paths is contextually necessary for hook auditing, but it is still dangerous because broad or accidental activation could expose installed skills/plugins, enabled plugin IDs, and operational policy state, and later workflow steps instruct modification of global config after confirmation.

Content

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

md
| 位置 | 是否生效 |
|---|---|
| `~/.claude/settings.json`、`settings.local.json` | **生效**(用户自己配的,默认可信) |
| `~/.claude/skills/<name>/hooks/hooks.json` | **生效**,安装即常驻 ← 意外 hook 主要来源 |
| `~/.claude/plugins/cache/<mkt>/<plugin>/hooks/hooks.json` | **仅当** settings 的 `enabledPlugins["<plugin>@<mkt>"]` 为 `true` |
| `~/.claude/plugins/marketplaces/**/hooks/hooks.json` | **永不生效**——marketplace 仓库缓存 ← 最易误判 |

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill also triggers on vague reports of unexpected behavior, permissions prompts, or injected text, without clear boundaries. That ambiguity can cause unsolicited escalation into scanning plugin/skill state and config data even when the user is merely describing symptoms, increasing privacy and surprise-risk in a sensitive local environment.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill also triggers on vague reports of unexpected behavior, permissions prompts, or injected text, without clear boundaries. That ambiguity can cause unsolicited escalation into scanning plugin/skill state and config data even when the user is merely describing symptoms, increasing privacy and surprise-risk in a sensitive local environment.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The entire skill description and operating guidance are presented only in Chinese, with no indication that the user may choose another language. This creates a locale/language constraint that is not documented as optional or justified as region-specific.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code enumerates data from ~/.claude settings, local settings, installed plugins, and skill hook files, which may reveal local configuration and operational details about the user's environment. Although that access is central to the script's purpose, the file provides no explicit warning in output, prompt, or comments that it inspects user-local configuration and plugin installation metadata.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script's natural-language interface, including the top-level description and runtime output, is written only in Chinese, which effectively fixes the language/locale without user opt-in. The file does not document that it is intentionally region-specific or provide any mechanism to choose another language.

Content

No source excerpt is available for this finding.