Back to skill

Security audit

Standardize the de-upgrading and iteration of SKILL

Security checks for vulnerabilities and agentic risk

Overview

The skill is purpose-aligned, but it needs Review because it installs always-on Claude hooks that log session/tool metadata and later guide edits to skill files without strong scoping or data-handling protections.

Install only if you are comfortable with Claude Code hooks running across sessions and recording session IDs, tool counts, and tool names. Review the scripts first, consider narrowing hook matchers, move state out of shared /tmp, sanitize hook input, and add a clear way to inspect, purge, or disable candidate logging before relying on it.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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

Warning
Location
scripts/count-tool-use.sh:7
Finding

Predictable Temporary Files Permit Symlink Attacks and Session-State Manipulation

Content
View full analysis
"$COUNTER_FILE" else count=$(($(cat "$COUNTER_FILE") + 1)) echo $count > "$COUNTER_FILE" fi # Log tool name if [ -n "$TOOL_NAME" ] && [ "$TOOL_NAME" != "null" ]; then echo "$TOOL_NAME" >> "$TOOLS_FILE" fi ``` The Stop hook reconstructs and trusts the same paths: ```bash COUNTER_FILE="/tmp/claude_skill_counter_${SESSION_ID}" TOOLS_FILE="/tmp/claude_skill_tools_${SESSION_ID}" if [ ! -f "$COUNTER_FILE" ]; then exit 0 fi count=$(cat "$COUNTER_FILE" 2>/dev/null || echo 0) if [ "$count" -ge "$THRESHOLD" ]; then # Get unique tool list if [ -f "$TOOLS_FILE" ]; then tools=$(sort "$TOOLS_FILE" | uniq | tr '\n' ',' | sed 's/,$//') unique_count=$(sort "$TOOLS_FILE" | uniq | wc -l | tr -d ' ') else tools="unknown" unique_count=0 fi fi rm -f "$COUNTER_FILE" "$TOOLS_FILE" ``` ### Technical Analysis The hooks store state under globally writable `/tmp` using filenames derived directly from a session identifier. They do not use `mktemp`, a private per-user directory, exclusive creation, restrictive permissions, ownership checks, or symlink checks. Shell output redirections follow symbolic links. Consequently, another local process running in the same security context—or a different local account where the platform's temporary-directory protections do not prevent the operation—may pre-create a matching path as a symbolic link. Subsequent hook execution can truncate or append to the symlink target if the Claude Code user has permission to write that target. An attacker can also create ordinary counter and too ...[truncated 1762 chars]
Remediation
View remediation

T01 · Skill Instruction Hijacking

Warning
Location
scripts/check-skill-candidate.sh:43
Finding

Unescaped Hook Metadata Enables Stored Instruction Injection During Candidate Review

Content
View full analysis
/dev/null) TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // ""' 2>/dev/null) COUNTER_FILE="/tmp/claude_skill_counter_${SESSION_ID}" TOOLS_FILE="/tmp/claude_skill_tools_${SESSION_ID}" # Log tool name if [ -n "$TOOL_NAME" ] && [ "$TOOL_NAME" != "null" ]; then echo "$TOOL_NAME" >> "$TOOLS_FILE" fi ``` The Stop hook reads and interpolates those values directly into persistent Markdown: ```bash SESSION_ID=$(echo "$INPUT" | jq -r '.session_id // "default"' 2>/dev/null) COUNTER_FILE="/tmp/claude_skill_counter_${SESSION_ID}" TOOLS_FILE="/tmp/claude_skill_tools_${SESSION_ID}" if [ -f "$TOOLS_FILE" ]; then tools=$(sort "$TOOLS_FILE" | uniq | tr '\n' ',' | sed 's/,$//') unique_count=$(sort "$TOOLS_FILE" | uniq | wc -l | tr -d ' ') else tools="unknown" unique_count=0 fi cat >> "$CANDIDATES_FILE" << ENTRY ## ${date_str} | ${count} calls | ${unique_count} tool types - **Session:** ${SESSION_ID} - **Tools:** ${tools} - **Status:** pending ENTRY ``` The Skill later directs the agent to consume the generated file: ```markdown ### Review mode When invoked directly, read candidates.md and for each pending entry: 1. Summarize key steps from the session 2. Evaluate three criteria: multi-step, multi-turn, repeatable 3. If YES → proceed to Phase 2 (Scaffold with duplicate check); if NO → mark skipped ``` ### Technical Analysis `session_id` and `tool_name` are treated as trusted strings even though they originate from hook input. No schema enforcement, character allowlist, length restriction, newline reje ...[truncated 2348 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (13)

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

1. Install

git clone https://github.com/ChamberZ40/skill-spec.git ~/.claude/skills/skill-spec

2. Add hooks to ~/.claude/settings.json (merge, don't replace)

text

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

1. Install

git clone https://github.com/ChamberZ40/skill-spec.git ~/.claude/skills/skill-spec

2. Add hooks to ~/.claude/settings.json (merge, don't replace)

text

```json

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description says the skill helps with discovering and managing reusable skills and workflow composition. The supplied code does not implement any of that behavior. Instead, it functions as a PostToolUse monitoring hook that records tool invocation counts and names in temporary files under /tmp. This is a materially different primary purpose and introduces undeclared file-based telemetry/logging behavior. Therefore the description does not accurately represent the code.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared purpose focuses on operational skill-management tasks: identifying repeated-work skill candidates, handling proposals/reviews, chaining workflows, and scaffolding/reviewing skills. The actual code does not perform any of those end-user functions. Instead, it is a QA/test harness for hook scripts, validating output schemas for PostToolUse and Stop hooks, checking JSON keys, enforcing hook-specific constraints, and setting up/removing temp files. That is a materially different primary purpose and includes undeclared testing/validation behavior, so this is a clear description-behavior mismatch.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% 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 · scripts/test-hooks.sh (reported line 40)May include surrounding context.

sh
echo ""

# Cleanup PostToolUse temp files
rm -f /tmp/claude_skill_counter_test-validate /tmp/claude_skill_tools_test-validate

# --- Stop hook (below threshold) ---
echo "[Stop] check-skill-candidate.sh (below threshold)"

Session Persistence

Medium
Category
Rogue Agent
Confidence
89% confidence
Finding

The README markets the ability to persist information about prior sessions and convert repeated workflows into accumulated candidates, which creates a session persistence mechanism. In this context, persistence is more sensitive because it captures operational history across sessions; if that data includes tool usage patterns or task descriptions, it can reveal confidential project activity and expand the blast radius of local compromise.

Content

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

md
## The Insight

Every 20+ tool-call session you run is a process waiting to be captured. But you never stop to write it down because:

- You don't notice the pattern until the 3rd time
- Writing a skill from scratch is friction

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The README explicitly states that session activity is logged silently and candidates accumulate automatically, but it does not present a clear, prominent warning about local data collection, retention, or review by the user before logging begins. In an agent skill context, silent telemetry-like collection of workflow metadata can expose sensitive project names, tool usage patterns, or operational details without meaningful informed consent.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest description is very broad and encourages invocation across multiple common activities such as identifying candidates, managing proposals, chaining workflows, scaffolding, and review. Overbroad activation criteria can cause the agent to invoke the skill in contexts the user did not intend, which is more dangerous here because the skill also describes persistent writes and scanning of the local skills directory. This is not arbitrary code execution, but it can expand the skill's reach and cause unintended data handling.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill explicitly describes auto-writing session-derived metadata such as session identifiers, tool usage counts, and tool names to data/candidates.md without any warning, consent gate, retention policy, or visibility control. Persistent storage of behavioral/session data can create privacy and security issues, especially if session IDs or tool histories are sensitive or later exfiltrated through other workflows. The skill context makes this more dangerous because the write is framed as automatic and continuous ('every session').

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
86% confidence
Finding

The skill directs scanning ~/.claude/skills/*/SKILL.md and writing to persistent files such as CHANGE.md, which introduces local session persistence and modification of user state. In context this is part of the skill's intended functionality, but it still increases risk because it touches files across the user's skills directory and can create or alter durable records without an explicit approval step. The danger is amplified when combined with the broad invocation language and automatic candidate handling.

Content

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

Before creating a new skill, check for duplicates:

  1. Scan ~/.claude/skills/*/SKILL.md frontmatter (name + description)
  2. If a similar skill exists → create a proposal in that skill's CHANGE.md instead of a new skill
  3. If no match → generate from templates/SKILL.template.md
text

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script persistently logs session metadata, including a session identifier and tool usage, into a file under the user's home directory without any explicit notice at the time of collection. Even if the data seems low sensitivity, silent retention can expose workflow history, enable correlation of user activity across sessions, and create privacy/compliance issues if the file is later accessed by other local processes or users.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The template leaves the skill activation criteria as a vague placeholder ('triggering conditions — be specific about symptoms and situations'), which can lead authors to publish skills with underspecified or overly broad invocation rules. In an agent ecosystem, ambiguous triggers can cause accidental activation in the wrong contexts, chaining into inappropriate actions or bypassing intended human review boundaries.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The script persists session-associated metadata and tool names in predictable files under /tmp without disclosure, access controls, or integrity protection. On multi-user systems, /tmp is shared and subject to symlink, tampering, and information exposure risks, so other local users or processes may read or manipulate these files and infer session activity.

Content

No source excerpt is available for this finding.