Back to skill

Security audit

haircut

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a legitimate agent-configuration cleanup skill, but it deserves review because it can scan private agent data across the machine and optionally start configured MCP servers.

Review before installing. Use this only if you are comfortable with a skill reading local agent settings, memory, and transcript-derived usage data across multiple coding tools. Prefer running it with an explicit --agents limit, avoid --probe unless you have reviewed the MCP servers that will start, and treat generated reports as potentially sensitive files.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (2)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
SKILL.md:3
Finding
Broad Cross-Agent Collection of Sensitive Local Configuration and Transcript Data<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 3-8; supporting behavior at lines 46-53 and 66-68 **Vulnerability Type**: Excessive local-data access and sensitive-data aggregation **Risk Level**: Medium ### Vulnerable Code Snippet ```markdown description: >- The barber for your coding agents' config. Weighs everything every agent on this machine loads (instruction files, memory, MCP servers, hooks, skills, commands, subagents, plugins, leftovers), prices each item in tokens from your own transcripts, and parks the dead weight with a receipt and an undo. ``` Supporting instructions: ```markdown Everything in this stage is read-only. Claude Code transcripts take seconds; Codex rollouts can take a minute on a machine with months of them, so say so before you run it, and run it in the background if the user is waiting on something else. The command prints a JSON summary and the run folder path in `run_dir`. Read `REPORT.md` from that folder next. ``` ```markdown This comes from the API's own usage fields in the transcripts, so call it measured, not estimated. ``` ### Technical Analysis The Skill instructs an agent to inventory configuration and usage information across every supported coding agent on the machine. Its declared sources include instruction files, persistent memory, transcripts, MCP server definitions, hooks, commands, plugins, and related artifacts. This scope is broader than a single-agent configuration analysis and creates a centralized report derived from multiple potentially sensitive sources. Agent transcripts and memory can contain private prompts, project information, local paths, operational instructions, and other confidential material. MCP configuration can also reveal executable commands, server locations, and credential-bearing configuration files. Although the Skill describes the scan as read-only, confidentiality risk does not require modifying source files. Reading and consolidating sensitive in ...[truncated 2034 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Default the scan to the currently active agent rather than every agent on the machine. 2. Require explicit, informed approval before adding each additional agent environment. 3. Present the artifact classes that will be inspected, such as transcripts, memory, project instructions, and MCP configuration. 4. Use transcript usage metadata without reading transcript bodies whenever possible. 5. Apply secret detection and deterministic redaction before writing any report. 6. Never copy credential values, authorization headers, environment-variable values, or transcript content into generated reports. 7. Create report directories and files with restrictive user-only permissions. 8. Document where reports are stored, how long they persist, and how users can securely remove them. 9. Provide a metadata-only mode for users who do not consent to transcript or memory inspection. 10. Include and audit the referenced scanner implementation so that access scope, redaction, permissions, and retention claims can be verified. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:41
Finding
MCP Schema Probe Executes Configured Server Commands During a Stage Described as Read-Only<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 41-47 **Vulnerability Type**: Unsafe execution semantics and misleading read-only classification **Risk Level**: Medium ### Vulnerable Code Snippet ```markdown - `--probe` measures the cost of MCP tool schemas by connecting to each configured server. It starts those servers the way the agent would, so use it only when the user asks to measure MCP schema cost, and tell them it will start their servers before you run it. Everything in this stage is read-only. Claude Code transcripts take seconds; ``` ### Technical Analysis The `--probe` option starts configured MCP servers using their normal launch definitions. Starting a server is command execution, not a purely read-only operation. A launched process can read or modify files, open network connections, spawn child processes, access inherited environment variables, and perform any other action permitted to the invoking account. The later statement that everything in the stage is read-only can cause users or agents to underestimate these effects. The Skill does include partial safeguards: probing is optional, must be user-requested, and the user must be told that servers will start. However, it does not require disclosure of the exact commands, executable paths, working directories, environment exposure, or network behavior before execution. A malicious or previously compromised MCP configuration could therefore turn a schema-cost measurement into execution of attacker-controlled local commands. No malicious MCP configuration is included in the audited project, so this is an unsafe execution path rather than evidence that exploitation has already occurred. ### Attack Path 1. An attacker or compromised tool places a malicious launch command in an MCP server configuration accessible to one of the scanned agents. 2. The user requests measurement of MCP schema costs. 3. Following the Skill, the agent invokes the scanner with `--probe ...[truncated 1063 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not describe the probe stage as entirely read-only. Explicitly state that `--probe` executes configured MCP server commands and may have filesystem or network side effects. 2. Before probing, display the exact server names, executable paths, arguments, and working directories that will be launched. 3. Obtain explicit confirmation immediately after presenting the execution plan. 4. Allow users to approve or reject each server independently. 5. Reject shell-interpreted launch strings where possible; execute a validated binary with a structured argument array. 6. Resolve executable paths and warn about writable, relative, or unexpected binaries. 7. Run probes in a restricted environment with minimal environment variables and filesystem access. 8. Disable outbound network access unless a specific MCP server requires it and the user approves it. 9. Apply per-server startup and response timeouts, process limits, and reliable child-process cleanup. 10. Avoid probing configurations from untrusted repositories or shared project files without separate confirmation. 11. Audit and include the referenced `haircut.mjs` implementation to verify that command construction cannot be manipulated through server names, paths, arguments, or report locations. ]]>
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (1)

Vague Triggers

Medium
Confidence
95% confidence
Finding
The description says to use the skill whenever the user mentions broad conditions like a 'slow session start,' 'session feels bloated,' or 'startup got slow,' and even on mentions of generic commands like /doctor or /skill-doctor. These triggers overlap with ordinary troubleshooting language and do not provide exclusion conditions or negative examples, increasing the risk of unintended invocation.

Static analysis

No suspicious patterns detected.