Back to skill

Security audit

每日笔记深度解读

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent note-summary helper, but it requires broad, mandatory reading of historical notes without clear user opt-in or limits.

Install only if you are comfortable letting the skill search across your configured notes directory, including older notes, and analyze matched note contents. Before use, limit NOTES_DIR to a folder you are willing to expose and avoid running the sample grep pattern with unescaped generated keywords.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:126
Finding
Model-Derived Keywords Are Unsafely Interpolated into a Shell Command## Vulnerability Details **File Location**: `SKILL.md`, lines 126–136 **Vulnerability Type**: Command injection through unsafe shell-command construction **Risk Level**: Medium ### Vulnerable Code Snippet ```bash grep -l "word1\|word2\|word3" *.md ``` The surrounding instructions require the model to derive keywords from note content and substitute those keywords into this command. ### Technical Analysis The search terms originate indirectly from untrusted note content. The skill provides a shell-command template but does not require escaping, validation, fixed-string matching, safe argument passing, or an option terminator. If an agent constructs and executes the command literally, a generated keyword containing quotation marks, command substitutions, shell metacharacters, or control operators could escape the quoted search expression and change the command's behavior. Regular-expression metacharacters can also alter matching semantics even when they do not achieve command execution. The unguarded `*.md` expansion presents an additional argument-handling weakness. A matching filename beginning with a hyphen may be interpreted by `grep` as an option because the command does not use `--`. Exploitation is conditional on the executing agent converting model output into shell source without applying its own escaping. Nevertheless, the skill explicitly recommends this construction and supplies no required safeguards. ### Attack Path 1. An attacker places crafted text in a note located under the configured notes directory. 2. The daily-note workflow reads the attacker-controlled note. 3. The model extracts a crafted value as one of the search keywords. 4. The agent inserts that value into the documented `grep` command without shell-safe encoding. 5. The shell interprets injected syntax rather than treating the entire value as inert search data. 6. Commands may execute with the permissions of the agent process, or the search may be manipulated to include u ...[truncated 677 chars]
Remediation
## Remediation Suggestions - Prefer a structured file-search API that accepts search terms and paths as separate values without invoking a shell. - If `grep` must be used, pass each keyword as a separate argument and use fixed-string matching: ```bash grep -F -l -- \ -e "$keyword1" \ -e "$keyword2" \ -e "$keyword3" \ ./*.md ``` - Do not generate a shell command by concatenating model output. - Validate extracted keywords against a restrictive allowlist and reject quotation marks, control characters, shell metacharacters, and leading hyphens. - Use an API such as Python's `subprocess.run` with `shell=False` and a list of arguments. - Add `--` before file operands to prevent filenames from being interpreted as options. - Resolve and validate all candidate file paths against the configured notes root before reading them. - Document that note content is untrusted data and must never be interpreted as executable instructions.

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
SKILL.md:128
Finding
Mandatory Full-History Note Ingestion Exceeds the Scope of a Daily Summary## Vulnerability Details **File Location**: `SKILL.md`, lines 128–138 **Vulnerability Type**: Excessive access to and ingestion of private historical notes **Risk Level**: Medium ### Vulnerable Instruction Snippet The relevant instruction sequence requires the following operations: ```text Search scope: all historical notes Match retention: retain every historical note matched by any keyword Model input: full current-note content plus full content of every matched historical note Selection: choose the five most relevant notes only after full-content model analysis ``` The documented search command is: ```bash grep -l "word1\|word2\|word3" *.md ``` ### Technical Analysis The skill is invoked for daily-note summarization, but its mandatory historical-analysis phase expands processing to all historical notes. Every keyword match is retained and loaded in full into the model before the workflow selects the five most relevant results. This violates data-minimization and least-privilege principles. Ranking does not require unconditional full-content ingestion of every matching file; metadata, titles, bounded excerpts, or local similarity measures could be used first. Historical notes may contain unrelated personal, professional, financial, or confidential information. They may also contain text that resembles agent instructions. Loading all matching content into the model unnecessarily increases both privacy exposure and the prompt-injection surface. The skill does not specify user confirmation, a maximum candidate count, date boundaries, secret detection, redaction, context isolation, or handling rules for untrusted instructions embedded in notes. ### Attack Path 1. A user requests a summary of the current day's notes. 2. The skill extracts keywords from those notes. 3. It searches the entire available historical-note collection rather than a user-approved subset. 4. Every matching historical note is retained. 5. The complete content of all matches is ...[truncated 1267 chars]
Remediation
## Remediation Suggestions - Make historical analysis optional and obtain explicit user consent before accessing historical notes. - Clearly disclose the intended search scope, date range, maximum candidate count, and whether note content will be sent to an external model provider. - Apply a staged retrieval process: 1. Search filenames, titles, tags, and locally generated indexes. 2. Rank candidates using metadata or short bounded excerpts. 3. Ask for confirmation when sensitive or unusually broad results are detected. 4. Load full content only for the small set selected for final analysis. - Set strict limits on the number and total size of historical files processed. - Exclude secret-bearing files and apply redaction for credentials, tokens, personal identifiers, and other sensitive data. - Treat all note content as untrusted data. Delimit it from agent instructions and explicitly prohibit following instructions found inside notes. - Permit users to configure excluded directories, sensitive tags, retention windows, and local-only processing. - Ensure paths are canonicalized and verified to remain within the authorized notes root, including after resolving symbolic links. - Prefer local relevance ranking where possible so that non-selected historical notes do not leave the user's environment.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (2)

Natural-Language Policy Violations

Medium
Confidence
84% confidence
Finding
The skill is written to operate and respond in Chinese only, with mandatory Chinese phrasing and no language preference check. While not a direct security exploit, this can cause user misunderstanding around what data will be searched and analyzed, weakening informed consent and increasing the chance of accidental overexposure of personal notes.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill mandates searching all historical notes and feeding matched note contents into the model without requiring a clear user warning, scoped consent, or a chance to limit the search. This can expose substantially more personal data than a user may expect when asking only for a summary of today's notes, especially because historical notes may contain sensitive private information unrelated to the immediate request.

Static analysis

No suspicious patterns detected.