Back to skill

Security audit

御知库

Security checks for vulnerabilities and agentic risk

Overview

This is a local personal knowledge-base skill, but it can ingest broad local files into a persistent plaintext database and may be triggered too broadly.

Install only if you are comfortable with a Chinese-language local knowledge-base tool that stores full imported document text under ~/.yuzhi. Avoid adding secrets, credentials, agent configuration, logs, or broad workspace files, and prefer explicit knowledge-base lookup commands rather than automatic use for general questions.

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)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/kb.py:49
Finding

Overbroad File Access Allows Ingestion of Sensitive Agent Data

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/kb.py:15
Finding

Knowledge-Base Contents Are Created Without Explicitly Restrictive Permissions

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (10)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

代码整体上确实属于个人知识库系统,且实现了文档存储、PDF/TXT/Markdown 文本提取、关键词搜索,以及一种简单的基于词集合重叠的搜索,因此大方向与声明基本一致。但存在两处实质性描述不符:第一,声明中的“自动分类”未实现,代码没有基于内容推断标签的能力,只是提供固定标签并在 add 时由用户传入;第二,声明描述的是在用户提问时优先从知识库检索答案的技能行为,而代码只是一个命令行工具,没有任何聊天触发器、问题路由或回答生成逻辑。因此应判定为存在描述与实际行为的不匹配。

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding

The skill advertises and appears to rely on file access and shell-driven CLI operations, but it does not declare any explicit tool scope or permission boundaries. In an agent environment, missing scope declarations can cause overbroad or ambiguous access, making it easier for the skill to read unintended local files or invoke shell commands without clear containment.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The activation language is broad enough to trigger on ordinary knowledge questions, which can cause the agent to invoke this skill unexpectedly and consult local knowledge sources when not necessary. In a knowledge-base skill with file and shell capabilities, over-triggering increases the chance of unnecessary exposure of local content, privacy leakage, or unintended tool use.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The workflow says user questions automatically cause recall from the knowledge base, but it does not define clear trigger constraints, consent checks, or data-scope limits. This can lead to routine prompts causing automatic local searches and surfacing snippets from personal documents, which is especially risky in a personal knowledge-base context.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · scripts/kb.py (reported line 26)May include surrounding context.

python
def init_db():
    conn = get_db()
    conn.execute("""CREATE TABLE IF NOT EXISTS kb (
        id INTEGER PRIMARY KEY AUTOINCREMENT,
        path TEXT UNIQUE NOT NULL,
        tag TEXT DEFAULT '其他',

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill's purpose is document indexing/search, yet PDF handling launches a fresh Python interpreter to execute dynamically constructed code. Even without obvious command injection, this introduces an unnecessary code-execution primitive and extra attack surface when processing untrusted PDFs, making the skill more dangerous than its stated function requires.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/kb.py (reported line 73)May include surrounding context.

python
elif path.suffix == ".pdf":
            import subprocess
            script = f"import pdfplumber; p=pdfplumber.open({str(path)!r}); print('\\n'.join([x.extract_text() or '' for x in p.pages]))"
            result = subprocess.run(
                ["python3", "-c", script],
                capture_output=True, text=True, timeout=30
            )

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

When a file is added, the full extracted content is copied into a persistent SQLite database under ~/.yuzhi without any prominent warning, consent prompt, or data-minimization option. This can silently duplicate sensitive material from user documents, increasing exposure if the local profile, backups, or the database itself are later accessed by other software or users.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The delete command performs a destructive database delete immediately after locating the record. While it prints a success message afterward, there is no confirmation prompt, cautionary comment/docstring, or other user disclosure before the irreversible removal occurs.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill's docstring, argparse description, help text, and runtime messages are all presented only in Chinese. This imposes a specific language on all users without any visible opt-in, selection mechanism, or documented locale limitation.

Content

No source excerpt is available for this finding.