Back to skill

Security audit

Notes Skill / 笔记技能

Security checks for vulnerabilities and agentic risk

Overview

This notes skill is mostly purpose-aligned, but it uses broad triggers, persistent local storage, automatic backups, and unreviewed script references in ways users should review before installing.

Review this before installing if you may store sensitive notes. Use explicit note commands, confirm before archiving or backing up, avoid storing secrets, and prefer an implementation that includes reviewed scripts plus parameterized database operations and clear deletion/purge controls.

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
SKILL.md:63
Finding
Unsafe SQL Construction with User-Controlled Note Content and Search Terms## Vulnerability Details **File Location**: `SKILL.md`, lines 63 and 68 **Vulnerability Type**: SQL injection through direct interpolation of user-controlled values **Risk Level**: High ### Vulnerable Code ```sql INSERT INTO notes (content) VALUES ('优化后的笔记内容'); ``` ```sql SELECT * FROM notes WHERE content LIKE '%关键词%'; ``` ### Technical Analysis The skill documentation instructs the agent to embed optimized note content and search keywords directly into SQL string literals. Both values originate from user input, but the documented queries do not use parameter binding or define an escaping procedure. A single quote in ordinary note content can cause a syntax error. More deliberately crafted input could terminate the original string literal and append attacker-selected SQL. Whether stacked statements can execute depends on the SQLite interface used by the host agent, which is not included in the audited project. Even when stacked statements are rejected, unsafe interpolation can still permit query manipulation or denial of service. ### Attack Path 1. An attacker asks the agent to create a note or search for a keyword containing a quote and malicious SQL syntax. 2. The agent follows `SKILL.md` and places that value directly inside the documented SQL literal. 3. The resulting SQL changes structure rather than treating the complete value as data. 4. The SQLite execution layer evaluates the modified query. 5. Depending on the database API and permissions, the attacker may manipulate query results, corrupt or delete notes, modify archive state, or disrupt note operations. Example malicious note content, assuming the execution interface permits multiple statements: ```text '); DELETE FROM notes; -- ``` This could produce: ```sql INSERT INTO notes (content) VALUES (''); DELETE FROM notes; --'); ``` ### Impact Assessment Exploitation is limited to the permissions of the process executing SQLite operat ...[truncated 705 chars]
Remediation
## Remediation Suggestions Use parameterized statements for every user-controlled value. Do not ask the agent to generate SQL by concatenating or interpolating note content or search terms. For example, with Python's `sqlite3` API: ```python connection.execute( "INSERT INTO notes (content) VALUES (?)", (optimized_content,), ) connection.execute( "SELECT * FROM notes WHERE content LIKE ?", (f"%{keyword}%",), ) ``` Additional hardening measures should include: 1. Encapsulate all database operations in reviewed scripts rather than having the agent construct arbitrary SQL. 2. Expose narrowly scoped operations such as `add`, `search`, `list`, and `archive`. 3. Validate note IDs as integers before using them in archive or lookup operations. 4. Reject operation types outside an explicit allowlist. 5. Execute only one prepared statement per operation. 6. Run database operations with the minimum filesystem permissions required. 7. Maintain protected backups and test restoration procedures. 8. Add tests using quotes, SQL metacharacters, comment sequences, and attempted stacked statements.
Vulnerability Patterns
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • 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 (8)

Vague Triggers

High
Confidence
97% confidence
Finding
The skill explicitly states that any note-related scenario should trigger this skill, which creates an overly broad activation surface. That can cause unintended invocation during ordinary conversation, leading to accidental storage, retrieval, archiving, or backup actions involving user data without sufficiently specific intent.

Session Persistence

Medium
Category
Rogue Agent
Content
### Features

- **Create notes** — Quick note-taking with automatic timestamp
- **Search notes** — Full-text search across all notes
- **List notes** — View all notes with archiving status
- **Archive notes** — Mark notes as organized/archived
Confidence
88% confidence
Finding
The skill is explicitly designed for session persistence by storing user-provided content with timestamps and later retrieval. While persistence is the core feature, it becomes security-relevant because the surrounding documentation does not indicate safeguards, consent, access controls, or retention boundaries for potentially sensitive note content.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
The README states that notes are stored persistently on disk and backed up automatically, but it does not prominently warn users that their content will be retained locally and copied into backups. This creates a privacy and data-retention risk because users may disclose sensitive information under the assumption of ephemeral assistant behavior.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The note creation and search triggers are broad conversational phrases like '记一下' and '找一下', which can easily appear in normal dialogue unrelated to note operations. In an agentic system, this can cause unintended note creation or retrieval, leading to privacy issues, accidental persistence of sensitive content, or disclosure of previously stored notes.

Vague Triggers

Medium
Confidence
96% confidence
Finding
The single-word archive trigger '归档' is ambiguous and may match common requests outside the notes context. This can cause accidental state-changing actions on stored notes, such as archiving records the user did not intend to modify, reducing data visibility and integrity.

Vague Triggers

Medium
Confidence
92% confidence
Finding
Several trigger phrases are common conversational language and are not tightly scoped to an intentional note-management command. In an agent setting, that increases the risk of accidental skill activation and unrequested handling of persistent user data.

Session Persistence

Medium
Category
Rogue Agent
Content
## 表结构

```sql
CREATE TABLE notes (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    content TEXT NOT NULL,
    archived INTEGER DEFAULT 0,
Confidence
88% confidence
Finding
The skill stores free-form note content in a persistent SQLite database under the user's home workspace, which creates session persistence of potentially sensitive information. While persistence is core to the feature, the documentation does not mention safeguards such as data classification, access controls, encryption, retention limits, or warnings about storing secrets.

Missing User Warnings

Medium
Confidence
84% confidence
Finding
The documentation describes automatic daily backups and manual retention settings, but does not warn users about duplication of potentially sensitive note contents, storage growth, or backup lifecycle expectations. Because notes are persistent personal data, silent backup behavior increases privacy and operational risk if users are unaware of how many copies are kept and where.

Static analysis

No suspicious patterns detected.