Back to skill

Security audit

快速笔记

Security checks for vulnerabilities and agentic risk

Overview

This note-taking skill is mostly coherent, but it can delete all stored notes without confirmation and its search command can be steered to read outside the notes folder.

Install only if you are comfortable with notes being stored persistently in ~/.quick-notes. Avoid storing secrets, prefer explicit note commands, and be aware that note clear will delete all saved notes without asking; the search implementation should be fixed before use in environments with sensitive readable files.

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/note.sh:21
Finding

Unrestricted grep arguments allow access outside the notes directory

Content
View full analysis

Vulnerability Details

File Location: scripts/note.sh, lines 21–23
Vulnerability Type: Improper argument handling and missing option termination
Risk Level: Medium

Vulnerable Code

bash
search)
    shift
    grep -r "$@" "$NOTES_DIR" 2>/dev/null || echo "未找到相关笔记"
    ;;

Technical Analysis

The script expands "$@" into multiple independent arguments and passes them directly to grep. Consequently, user-supplied arguments are not constrained to a single search pattern. Additional arguments can be interpreted as file or directory operands, while arguments beginning with - can be interpreted as grep options.

Although shell metacharacters inside the arguments are not re-evaluated as shell syntax, this argument-injection flaw permits the caller to change the intended scope and behavior of grep. The command also omits the -- option terminator needed to ensure that an option-like pattern is handled as data.

Attack Path

  1. An attacker supplies or induces a search request containing a search term followed by a local path, such as note search keyword /path/to/readable/file.
  2. The search branch removes only the subcommand with shift.
  3. "$@" expands the search term and attacker-selected path into separate grep arguments.
  4. grep treats the additional path as another input operand and searches it alongside ~/.quick-notes.
  5. Any matching lines from the readable external file are emitted to standard output and may be returned to the caller.

Option-like arguments may similarly modify grep behavior because option parsing is not explicitly terminated.

Impact Assessment

A caller can cause the Skill to inspect files and directories outside its documented ~/.quick-notes storage scope. The accessible scope is limited to files readable by the operating-system account running the Skill; this issue does not itself grant elevated privileges. Nevertheless, matching con ...[truncated 120 chars]

Remediation
View remediation

Remediation Suggestions

Enforce the expected argument count, terminate option parsing, and pass exactly one search pattern to grep:

bash
search)
    shift
    if [ "$#" -ne 1 ]; then
        echo "Usage: note search <keyword>" >&2
        exit 1
    fi
    grep -r -- "$1" "$NOTES_DIR" 2>/dev/null || echo "No matching notes found"
    ;;

If multi-word searches must be accepted as separate command-line arguments, deliberately combine them into one pattern before invoking grep, then pass only that pattern after --. Also reject unexpected extra path operands and consider using grep -rF -- when literal rather than regular-expression matching is intended.

Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (10)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The skill is presented as a simple note-taking tool, but it also exposes a destructive note clear capability that can remove the entire notes directory. Undeclared or under-emphasized destructive behavior increases the chance of users invoking data loss operations without understanding the consequence, especially in an agent setting where natural-language triggers may be activated unintentionally.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

Documenting a note clear command without any warning about irreversible deletion makes accidental destructive use much more likely. In the stated context of quick note-taking, users may not expect a single command to wipe all persisted notes, causing significant data loss.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill persists notes to local disk but does not prominently warn users before collecting and storing content. This creates privacy and retention risks because users may assume the interaction is transient when it actually writes potentially sensitive data into ~/.quick-notes/.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The example trigger 记一条笔记:今天学了新东西 is broad natural language that can overlap with ordinary conversation. In an agent environment, ambiguous triggers can cause accidental invocation and unintended persistence of user content to disk, including potentially sensitive information.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The viewing example 查看所有笔记 is highly generic and may be uttered in normal conversation or testing, which can trigger unintended disclosure of locally stored notes. Since notes are persistent and may contain sensitive material, accidental listing creates a confidentiality risk in shared or logged contexts.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The search example 搜索笔记 关键词 is another generic phrase with weak activation control. Ambiguous activation can lead to unintended querying and exposure of stored note contents, particularly if search terms are spoken casually in unrelated discussion.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill description says it supports adding, viewing, and searching notes, but the script also implements a clear command that irreversibly deletes the entire notes directory. Hidden destructive functionality is dangerous because users or higher-level agents may invoke the skill based on the description and be unaware that it can wipe local data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The clear action runs rm -rf "$NOTES_DIR" immediately with no confirmation, dry-run, or recovery mechanism. A mistaken invocation can permanently erase all locally stored notes, which is especially risky for a utility whose primary purpose is data retention.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
75% confidence
Finding

All visible descriptions and examples are in Chinese, and the file does not indicate that the skill supports other languages or that Chinese is a justified region-specific requirement. This can be a language/locale policy concern when users are not given an opt-in or alternative.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

Multiple comments and user-facing messages are written only in Chinese, including status text and usage output. This imposes a specific language on all users without any opt-in, which matches the policy concern for language or locale restrictions.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.