Back to skill

Security audit

doc-search

Security checks for vulnerabilities and agentic risk

Overview

This local document search skill is not overtly malicious, but it needs review because it recursively indexes local files, writes persistent index data, and uses unsafe command/path handling.

Install only if you are comfortable letting the agent recursively scan a chosen local document folder and store a persistent local index. Use it on trusted directories, avoid shared or attacker-writable indexes, and prefer a revised version that quotes or avoids shell commands, validates returned paths stay under the docs directory, and clearly documents one index location.

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

Shell Command Injection Through Untrusted Workflow Parameters

Content
View full analysis
/.cache/index.json ``` ```bash python3 ~/.claude/skills/doc-search/scripts/build_index.py ``` ```bash python3 ~/.claude/skills/doc-search/scripts/search.py "" \ --docs-dir --topk 5 ``` ```bash grep -ni -e "keyword1" -e "keyword2" /path/to/doc.md ``` ### Technical Analysis The Skill instructs the Agent to construct shell commands by substituting document directories, expanded queries, original keywords, and result paths directly into command templates. The directory and result-path placeholders are unquoted. Consequently, whitespace, command separators, redirection operators, pipelines, and other shell metacharacters in these values can alter the command's structure. Although the expanded query and grep patterns are shown inside double quotes, double quotes do not neutralize shell command substitution. Constructs such as `$(command)` and backtick substitution can still be evaluated by a shell when the Agent builds and executes a command string. Embedded quotation marks may also terminate the intended quoting context if values are interpolated without robust argument-level escaping. The risk applies both to explicitly supplied user input and to filenames originating from a document collection that may not be fully trusted. The Python scripts themselves do not invoke a shell, but the Skill workflow directs the Agent to do so. ### Attack Path 1. An attacker supplies a document directory, search query, keyword, or indexed filename containing shell syntax. 2. The Agent replaces a placeholder in one of the documented Bash templates with that value. 3. The resulting command is passed to a shell rather than executed as a fixed argument array. 4. The shell interprets command substituti ...[truncated 956 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/search.py:100
Finding

Untrusted Index Metadata Can Redirect File Reads Outside the Document Root

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

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Claiming LLM query expansion and grep-based precise matching when the skill actually searches only a prebuilt index creates deceptive expectations about accuracy, privacy, and execution flow. Users may believe the agent is only performing transient search when it may depend on stale indexed data and previous disk writes.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

Claiming LLM query expansion and grep-based precise matching when the skill actually searches only a prebuilt index creates deceptive expectations about accuracy, privacy, and execution flow. Users may believe the agent is only performing transient search when it may depend on stale indexed data and previous disk writes.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill documentation is written in Chinese and does not indicate that users may choose another language or that the skill is intended only for a Chinese-speaking or region-specific audience. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
83% confidence
Finding

The skill instructs the agent to read from arbitrary user-specified directories and to write an index file into that directory, but it declares no explicit tool scope or permissions boundary. In an agent environment, missing scope declarations increases the chance of unintended file-system access beyond what users expect, especially because the workflow includes both recursive reads and persistent writes.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrases are broad enough to activate on ordinary requests about finding information, which can cause the skill to run in situations where the user did not clearly intend recursive local document scanning. Because this skill can read large directory trees and write an index, overbroad activation increases the risk of unintended privacy exposure and unexpected filesystem modification.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The documentation says Step 2 checks for an index in .cache/index.json, while Step 3 says the index is saved to .doc-search/index.json. This inconsistency can cause the agent to rebuild indexes unnecessarily or write data to an unexpected location, which is risky when operating on user directories.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The workflow omits a clear warning that running the skill builds and stores a persistent local search index inside the chosen document directory. This reduces transparency and informed consent, which matters because the skill is not purely read-only and may leave artifacts in sensitive note or wiki repositories.

Content

No source excerpt is available for this finding.