Back to skill

Security audit

Parser

Security checks for vulnerabilities and agentic risk

Overview

This skill is a local file parser with some minor documentation and hardening issues, but no evidence of hidden, destructive, or data-stealing behavior.

Install only if you are comfortable with a local parser reading files you explicitly pass to it. The maintainer should tighten the description, remove or document the unused data directory, and add '--' before grep patterns to avoid option-injection edge cases.

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

Warning
Location
scripts/script.sh:372
Finding
Option Injection Through User-Controlled grep Patterns<![CDATA[ ## Vulnerability Details **File Location**: `scripts/script.sh`, lines 372–422 **Vulnerability Type**: Argument/option injection **Risk Level**: Medium ### Vulnerable Code ```bash count=$(grep -c "$pattern" "$file" 2>/dev/null || echo 0) if [[ "$count" -gt 0 ]]; then grep -n --color=never -C 2 "$pattern" "$file" || true fi ``` ```bash matches=$(grep -oP "$regex" "$file" 2>/dev/null || grep -oE "$regex" "$file" 2>/dev/null || true) ``` ### Technical Analysis The `lines` and `extract` commands pass attacker-controlled `$pattern` and `$regex` values to `grep` without placing the `--` end-of-options delimiter before them. Quoting prevents shell expansion and shell-command injection, but it does not stop `grep` from interpreting an argument beginning with `-` as an option. An attacker can therefore supply values such as `--file=/path/to/file`, causing `grep` to treat the value as an option rather than as the intended regular expression. Depending on the injected option, this can cause `grep` to read patterns from another local file, change matching behavior, manipulate output, or consume excessive resources. This issue does not directly permit arbitrary shell-command execution because the variables are correctly quoted and are not passed to `eval` or a shell interpreter. ### Attack Path 1. An attacker gains control over the pattern or regular-expression argument supplied to the parser, for example: ```bash scripts/script.sh lines target.txt '--file=/etc/passwd' ``` or: ```bash scripts/script.sh extract target.txt '--file=/path/to/attacker-selected-file' ``` 2. The script forwards the argument to `grep` before any `--` delimiter. 3. GNU `grep` interprets the supplied value as a command-line option. 4. `grep` reads the selected file as a pattern source or otherwise changes its execution behavior. 5. The attacker may use resulting matches, errors, timing, or resource consumption to affect availability or infer limited inform ...[truncated 659 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Insert the `--` end-of-options delimiter before every user-controlled pattern: ```bash count=$(grep -c -- "$pattern" "$file" 2>/dev/null || echo 0) if [[ "$count" -gt 0 ]]; then grep -n --color=never -C 2 -- "$pattern" "$file" || true fi ``` For extraction: ```bash matches=$( grep -oP -- "$regex" "$file" 2>/dev/null || grep -oE -- "$regex" "$file" 2>/dev/null || true ) ``` Additional hardening measures should include: 1. Apply limits to input-file size and execution time to reduce regular-expression denial-of-service risk. 2. Validate patterns where only a restricted matching syntax is required. 3. Run the parser with least privilege so it cannot access unrelated sensitive files. 4. Add regression tests using patterns such as `-n`, `--help`, and `--file=/etc/passwd` to confirm that they are treated strictly as patterns. ]]>
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The code largely matches the declared parsing/extraction purpose for JSON, CSV, XML, and logs/lines. However, it materially exceeds the description in several ways: it adds YAML parsing, generic text processing commands (split, extract, grep-like line filtering), and a stats command that reports file type, MIME, encoding, size, and line metrics. These are not merely implementation details; they are user-facing capabilities outside the declared description. There is no evidence of unrelated network access or dangerous hidden behavior, but the declared description is incomplete relative to the actual feature set.

Lp3

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding
Without declared permissions the skill's intent is opaque and cannot be validated.

Description-Behavior Mismatch

Medium
Confidence
93% confidence
Finding
The manifest description at L09 limits the skill to parsing JSON, CSV, XML, and logs into structured output, but the documentation also advertises YAML parsing, generic line filtering, delimiter-based splitting, regex extraction, and file statistics. Those operations go beyond the declared parser scope and include text-processing and analysis capabilities not reflected in the manifest.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The manifest describes a parser for JSON, CSV, XML, and logs used for converting formats, validating structure, extracting fields, and analyzing nested data. However, the CLI help and dispatch implement additional capabilities such as YAML parsing, generic line filtering, arbitrary splitting, regex extraction, and file statistics, which broaden the behavior beyond the declared scope.

Vague Triggers

Low
Confidence
85% confidence
Finding
The manifest description says to use the skill when 'converting formats, validating structure, extracting fields, analyzing nested data,' which is a wide set of common requests and does not define when the skill should not be used. In a skill-routing context, this broad wording may overlap with many ordinary parsing or analysis tasks and cause unintended invocation.

Intent-Code Divergence

Low
Confidence
84% confidence
Finding
The summary line says the skill parses and extracts data from various file formats, while the manifest description specifically names JSON, CSV, XML, and logs, yet later sections document YAML support and several non-format-specific text utilities. This is not just incomplete wording; the documentation presents a narrower stated intent up front than the capabilities later advertised.

Context-Inappropriate Capability

Low
Confidence
86% confidence
Finding
The script defines a data directory under the user's home directory and creates it on startup, but no later code uses that directory for parsing operations. For a parser skill whose stated purpose is format parsing and field extraction, creating persistent local state is not justified by the manifest and appears unrelated to the implemented functionality.

Static analysis

No suspicious patterns detected.