Back to skill

Security audit

hook-authoring

Security checks for vulnerabilities and agentic risk

Overview

ClawScan marks this hook-authoring skill suspicious because scanners report behavior and examples that can undermine its stated security purpose, with some files only partially analyzed.

Consider the suspicious verdict and incomplete analysis before installing. Review the hook examples carefully, especially whether their checks actually block actions and whether any example writes to global settings, stores state across sessions, or sends hook inputs to a remote service. The scan does not establish that flagged example commands or network requests were executed.

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
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (44)

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The supplied shell commands concern plugin update configuration and application startup. They contain no hook creation, validation, or enforcement logic, and the update configuration is not shown as a supporting implementation detail of those activities. The snippet requests forced updates through an environment variable; it does not itself demonstrate that any update or network access occurs.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The code is relevant to hooks and the SDK, but its central behavior does not implement the advertised validation and enforcement. Valid and invalid inputs both produce the same non-blocking return, and even a validation exception permits execution to continue. Error-tolerant logging is a supporting implementation detail, not a separate undeclared capability. No unrelated resource access is shown.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The supplied chunk contains only a Git commit command. It provides no hook configuration, security validation, or enforcement logic, and no visible context establishes the commit as a supporting step in the declared workflow.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Although the code uses hooks and the SDK, its primary function is context enrichment, not security validation or enforcement. It incorporates project-file content into user prompts without implementing security checks or enforcement decisions. The keyword triggers support that undeclared enrichment behavior. No network access, exfiltration, or file modification is shown.

Content

No source excerpt is available for this finding.

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 83)May include surrounding context.

md
"""Validate tool inputs before execution."""
        if tool_name == "Bash":
            command = tool_input.get("command", "")
            if "rm -rf /" in command:
                raise ValueError("Dangerous command blocked by hook")

        # Return None to proceed unchanged, or modified dict to transform

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 · modules/common-patterns.md (reported line 13)May include surrounding context.

md
command = tool_input.get("command", "")

        # Block dangerous patterns
        if any(pattern in command for pattern in ["rm -rf /", ":(){ :|:& };:"]):
            raise ValueError(f"Dangerous command blocked: {command}")

        # Block production access

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 · modules/sdk-callbacks.md (reported line 590)May include surrounding context.

md
hooks = ValidationHooks()

    with pytest.raises(ValueError, match="blocked by security policy"):
        await hooks.on_pre_tool_use("Bash", {"command": "rm -rf /"})


@pytest.mark.asyncio

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 83)May include surrounding context.

md
"""Validate tool inputs before execution."""
        if tool_name == "Bash":
            command = tool_input.get("command", "")
            if "rm -rf /" in command:
                raise ValueError("Dangerous command blocked by hook")

        # Return None to proceed unchanged, or modified dict to transform

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
SessionStart input schema, are in `modules/hook-types.md`.

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **Hook Types**: `modules/hook-types.md` - Detailed event signatures and parameters

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
`modules/sdk-callbacks.md`.

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **SDK Callbacks**: `modules/sdk-callbacks.md` - Python SDK implementation patterns

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

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

md
Plugin hooks are in `hooks/hooks.json`, which auto-loads when the
plugin is enabled. Listing it again in `plugin.json` causes duplicate
load errors. Project hooks are in `.claude/settings.json` and
global hooks in `~/.claude/settings.json`. The decision framework is
`modules/scope-selection.md`, also served as `abstract:hook-scope-guide`.

## Common Patterns

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

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

md
## Exit Criteria

- [ ] The authored hook file exists at a valid scope location (`hooks/hooks.json`,
  `.claude/settings.json`, or `~/.claude/settings.json`) with correct JSON or Python syntax.
- [ ] The hook fires on the target event: a test invocation of the matching tool call triggers
  the hook command or callback without error.
- [ ] The hook contains no secret logging: no field names matching `api[_-]?key`, `password`,

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · modules/scope-selection.md (reported line 550)May include surrounding context.

cat .claude/settings.json

Verify global hooks exist

cat ~/.claude/settings.json

text

### Hook Executing Unexpectedly

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
`modules/scope-selection.md`, also served as `abstract:hook-scope-guide`.

Incomplete referenced artifact analysis

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- **Scope Selection**: `modules/scope-selection.md` - Choosing plugin/project/global

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 · modules/common-patterns.md (reported line 13)May include surrounding context.

md
command = tool_input.get("command", "")

        # Block dangerous patterns
        if any(pattern in command for pattern in ["rm -rf /", ":(){ :|:& };:"]):
            raise ValueError(f"Dangerous command blocked: {command}")

        # Block production access

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 · modules/hook-types.md (reported line 275)May include surrounding context.

md
"matcher": "Bash",
      "hooks": [{
        "type": "command",
        "if": "Bash(rm -rf *)",
        "command": "block-rm.sh",
        "timeout": 10
      }]

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 · modules/observability-warnings.md (reported line 22)May include surrounding context.

To remove all listed sessions in one go, run:

text
rm -rf .superpowers/brainstorm/abc .superpowers/brainstorm/def
text

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · modules/scope-selection.md (reported line 36)May include surrounding context.

md
|-------|----------|----------|-------------------|-------------|
| **Plugin** | `<plugin-root>/hooks/hooks.json` | Plugin users | Yes (with plugin) | When plugin enabled |
| **Project** | `.claude/settings.json` | Team members | Yes (in repo) | Per project |
| **Global** | `~/.claude/settings.json` | Only you | Never | All sessions |

## Decision Framework

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · modules/scope-selection.md (reported line 71)May include surrounding context.

└─ NO ↓

Should this hook apply to all my Claude sessions? ├─ YES → Global hooks (~/.claude/settings.json) └─ NO → Reconsider if you need a hook at all

text

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · modules/scope-selection.md (reported line 284)May include surrounding context.

Configuration

JSON Format (~/.claude/settings.json):

json
{

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Skill reads from agent configuration directories (.claude/, .codex/, .gemini/). These directories may contain API keys, personal settings, and other credentials that the skill has no legitimate need to access.

Content

Scanner excerpt · modules/scope-selection.md (reported line 368)May include surrounding context.

md
2. **Command-line arguments** (`claude --flag`)
3. **Local project settings** (`.claude/settings.local.json` - not committed)
4. **Shared project settings** (`.claude/settings.json` - committed)
5. **User settings** (`~/.claude/settings.json`)

### Multiple Matching Hooks

The examples claim to block production operations but use non-blocking hook exit codes (L194, L210–L219, L425–L432).

High
Category
Excessive Agency
Confidence
99% confidence
Finding

The production-protection examples use exit 1, but Claude Code command hooks require exit 2 to block a PreToolUse operation; other nonzero exits generally report non-blocking errors. Users copying this security-enforcement example could therefore allow the production changes they believe are prohibited.

Content

No source excerpt is available for this finding.