Back to skill

Security audit

Grammar Check

Security checks for vulnerabilities and agentic risk

Overview

This skill mostly looks like a grammar helper, but it also ships an unrelated command script that can silently store user-provided text locally.

Install only if you are comfortable with a grammar skill that includes an extra local utility script. Avoid passing private drafts, business text, credentials, or sensitive search terms to the grammar-check command unless the publisher clarifies or removes the local data/history storage 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

Warning
Location
scripts/script.sh:6
Finding
Undisclosed Plaintext Persistence of User-Supplied Data<![CDATA[ ## Vulnerability Details **File Location**: `scripts/script.sh:6-8, 29, 32-40, 52-76` **Vulnerability Type**: Plaintext storage of potentially sensitive user input **Risk Level**: Medium ### Vulnerable Code ```bash DATA_DIR="${GRAMMAR_CHECK_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/grammar-check}" DB="$DATA_DIR/data.log" mkdir -p "$DATA_DIR" ``` ```bash _log() { echo "$(date '+%m-%d %H:%M') $1: $2" >> "$DATA_DIR/history.log"; } cmd_run() { echo " Running: $1" _log "run" "${1:-}" } cmd_config() { echo " Config: $DATA_DIR/config.json" _log "config" "${1:-}" } cmd_status() { echo " Status: ready" _log "status" "${1:-}" } ``` ```bash cmd_add() { echo "$(date +%Y-%m-%d) $*" >> "$DB"; echo " Added: $*" _log "add" "${1:-}" } cmd_remove() { echo " Removed: $1" _log "remove" "${1:-}" } cmd_search() { grep -i "$1" "$DB" 2>/dev/null || echo " Not found: $1" _log "search" "${1:-}" } cmd_export() { [ -f "$DB" ] && cat "$DB" || echo "No data" _log "export" "${1:-}" } cmd_info() { echo " Version: $VERSION | Data: $DATA_DIR" _log "info" "${1:-}" } ``` ### Technical Analysis The script persistently records raw command arguments in `data.log` and `history.log`. Arguments supplied to commands such as `run`, `add`, and `search` may contain private text, search terms, or other sensitive information. The declared grammar-checking documentation does not disclose this persistence or define retention and deletion behavior. The script creates the data directory and files without explicitly applying restrictive permissions. Their effective permissions therefore depend on the invoking user's `umask`. With a commonly used `022` umask, the directory can be traversable and the files can be readable by other local users. The `_log` function also writes raw arguments with `echo`. An argument containing newline characters can create forged or misleading log entries because no escaping or structured ...[truncated 1253 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove persistent logging unless it is necessary for the documented grammar-checking functionality. 2. Obtain explicit user consent before retaining command arguments and clearly document the purpose, storage location, retention period, export behavior, and deletion procedure. 3. Never log raw user text by default. Record only non-sensitive operational metadata or redact argument values. 4. Create the storage directory and files with restrictive permissions: ```bash umask 077 mkdir -p -m 700 -- "$DATA_DIR" touch "$DB" "$DATA_DIR/history.log" chmod 600 -- "$DB" "$DATA_DIR/history.log" ``` 5. Normalize or escape carriage returns and newline characters before writing any user-controlled value to a line-oriented log. 6. Prefer a structured logging format with safe serialization rather than constructing records with `echo`. 7. Add a command that securely clears retained data, and consider automatic expiration for historical records. 8. Align `scripts/script.sh` with the behavior documented in `SKILL.md`, or remove the unrelated generic datastore functionality from the package. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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
Findings (11)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The skill is presented as a grammar-checking assistant, but the analysis indicates it also performs local storage, record management, and logging behaviors unrelated to that stated purpose. That mismatch is dangerous because users may invoke a seemingly harmless language tool without understanding it persists data or performs broader utility actions, creating hidden data-handling and trust-boundary risks.

Description-Behavior Mismatch

High
Confidence
98% confidence
Finding
The script’s implemented behavior is materially inconsistent with the declared skill purpose. Instead of performing grammar checking, it exposes a generic local data-management interface, which creates hidden capability and undermines user trust, review assumptions, and least-privilege expectations for a language-assistance skill.

Vague Triggers

Medium
Confidence
90% confidence
Finding
The statement that the tool is suitable for essentially anyone needing grammar checking creates an overly broad activation scope with weak boundaries. In agent environments, broad scope increases the chance the skill is selected in unintended contexts, which can expose user text or trigger hidden side effects when a narrower skill should have been used.

Vague Triggers

Medium
Confidence
98% confidence
Finding
The command triggers 'check', 'correct', 'explain', 'level', 'practice', and 'compare' are highly generic and likely to overlap with normal conversation. In an agent system, this can cause accidental invocation or command confusion, especially if the skill has hidden non-grammar capabilities, expanding the blast radius of unintended activation.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This shell script embeds user-facing help and instruction text entirely in Chinese, including usage guidance and command descriptions. Under the policy for natural-language violations, forcing a specific language without user opt-in is reportable unless the locale restriction is explicitly justified, which is not present here.

Intent-Code Divergence

Medium
Confidence
96% confidence
Finding
Branding the script as a 'Multi-purpose utility tool' directly contradicts the declared grammar-checking identity, signaling capability mismatch and possible deceptive packaging. In a skill ecosystem, this weakens security review because operators and users may grant trust based on the manifest while the code behaves as a broader utility.

Description-Behavior Mismatch

Medium
Confidence
93% confidence
Finding
The code persists arbitrary user-provided entries and supports listing, searching, exporting, and logging them, none of which are described by the grammar-checker context. This hidden persistence expands the attack and privacy surface by storing user content locally without clear purpose limitation or transparency.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The logging function persistently records user-supplied arguments to a history file, potentially capturing sensitive text users submit for grammar review. In the context of a language tool, user inputs may include emails, drafts, or confidential material, so undisclosed retention increases privacy risk.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
The heading '中国学生常见语法错误 Top 10' explicitly targets Chinese students, which imposes a specific locale/audience in the skill content without offering any user choice or opt-in. Under the policy, language or locale constraints should be optional or clearly justified as region-specific.

Missing User Warnings

Low
Confidence
89% confidence
Finding
The script creates and uses a local application data directory automatically without a user-facing warning or meaningful disclosure. While not inherently code-execution dangerous, silent local writes are a privacy and transparency issue, especially for a skill presented as a simple grammar assistant.

Missing User Warnings

Low
Confidence
88% confidence
Finding
The add command writes arbitrary user-provided content to a persistent local file without clear disclosure in the tool description. This is dangerous mainly from a privacy and expectation-management perspective, because users of a grammar assistant would not reasonably expect hidden note-taking or retention behavior.

Static analysis

No suspicious patterns detected.