Back to skill

Security audit

Finder

Security checks for vulnerabilities and agentic risk

Overview

This file-search skill is mostly aligned with its purpose, but its shell script can be abused to execute arbitrary local commands through unsafe argument handling.

Review this skill before installing. Its purpose is understandable, but the current script should not be used with untrusted patterns, paths, sizes, extensions, day values, or counts because crafted input can be interpreted as find syntax and execute local commands. It should be fixed by correcting argument indexing, quoting all expansions, validating inputs, and documenting the recursive filesystem scan behavior.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/script.sh:70
Finding

Arbitrary Command Execution Through Unquoted find Arguments

Content
View full analysis
" find ${3:-.} -name $2 2>/dev/null | head -20 } ``` The same unsafe expansion pattern occurs in the other command handlers: ```bash find ${3:-.} -type f -size +${2:-1M} 2>/dev/null | head -20 find ${2:-.} -type f -mtime -${3:-7} 2>/dev/null | head -20 find ${3:-.} -name '*.$2' 2>/dev/null | head -20 find ${2:-.} -empty 2>/dev/null | head -20 find ${2:-.} -type f -printf '%s %p ' 2>/dev/null | sort -rn | head -${3:-10} ``` ### Technical Analysis `main` removes the command name with `shift` before invoking each handler: ```bash name) shift; cmd_name "$@" ;; ``` After that operation, the first documented command argument is `$1` and the second is `$2`. However, the handlers incorrectly read arguments from `$2` and `$3`. This off-by-one error causes the documented directory argument to be interpreted as another parameter while the intended first argument is ignored. More importantly, positional parameters are expanded without double quotes in calls to `find`. Bash consequently performs word splitting and pathname expansion. An attacker-controlled argument can therefore become multiple `find` expression tokens rather than one filename pattern or path. GNU `find` supports action predicates such as `-exec`. Injecting these tokens allows a search command to execute an arbitrary local program. This is expression injection into `find`, not merely malformed search input. Although the `type` handler single-quotes its name expression, its path expansion remains unsafe if a third handler argument is supplied. The other handlers simila ...[truncated 1907 chars]
Remediation
View remediation
[dir]" [ "$#" -le 2 ] || die "Usage: $SCRIPT_NAME name [dir]" find "$dir" -name "$pattern" 2>/dev/null | head -n 20 } ``` Apply the same indexing, quoting, argument-count checks, and type validation to every other handler. For example: ```bash cmd_recent() { local dir="${1:-}" local days="${2:-7}" [ -z "$dir" ] && die "Usage: $SCRIPT_NAME recent [days]" [[ "$days" =~ ^[0-9]+$ ]] || die "Days must be a non-negative integer" find "$dir" -type f -mtime "-$days" 2>/dev/null | head -n 20 } ``` ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • 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 (5)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The code generally matches the core purpose of searching the filesystem by name, size, date/recentness, and type. However, the description explicitly claims deduplication, and the script contains no deduplication logic at all. It simply runs various find commands and truncates output with head. Additionally, the script exposes extra capabilities (empty and large) not mentioned in the description. These additions are related to filesystem searching, so they are less significant than the missing deduplication feature, but the absent declared capability is a material description-behavior mismatch.

Content

No source excerpt is available for this finding.

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
80% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · scripts/script.sh (reported line 9)May include surrounding context.

sh
DATA_DIR="$HOME/.local/share/finder"
mkdir -p "$DATA_DIR"

#
#
#
#

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

The manifest description says the skill finds files by name, size, date, and type with deduplication. The implemented commands cover name, size, recent/date, type, empty, and large-file listing, but there is no logic for hashing, comparing, grouping, or otherwise deduplicating files.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

This code performs broad filesystem reads using multiple find commands over caller-provided paths, which can expose directory contents and metadata from sensitive locations. Aside from terse usage strings, there is no comment, banner, or user-facing notice explaining that the skill will scan the filesystem recursively.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The manifest broadly claims searching by date, which implies date-oriented file filtering more generally. The code only supports recent <dir days> using find -mtime -N, which is narrower than general date search and limited to recently modified files.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.