Back to skill

Security audit

Corpus Builder

Security checks for vulnerabilities and agentic risk

Overview

This skill coherently builds a local text corpus and vector store, with optional DashScope cloud annotation, and I found no hidden exfiltration, backdoor, or destructive automatic behavior.

Install this in a virtual environment and only set DASHSCOPE_API_KEY when you intentionally want text sent to DashScope for cloud annotation. Avoid putting real API keys in ~/.bashrc or printing them in terminals, and verify or back up the exact corpus path before using any rm -rf troubleshooting command. For production use, pin dependencies and the embedding model revision.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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)

T08 · Insecure Dependencies

Warning
Location
requirements.txt:4
Finding

Unpinned Dependencies and Mutable Remote Model Artifact

Content
View full analysis
=0.5.0 sentence-transformers>=2.2.2 pyyaml>=6.0.1 rich>=13.7.0 psutil>=5.9.8 pysqlite3-binary>=0.5.2 openai>=1.0.0 ``` From `pyproject.toml:3-5` and `pyproject.toml:37-52`: ```toml requires = ["setuptools>=61.0", "wheel"] build-backend = "setuptools.build_meta" dependencies = [ "chromadb>=0.4.0", "sentence-transformers>=2.2.0", "pyyaml>=6.0.1", "rich>=13.7.0", "psutil>=5.9.0", ] [project.optional-dependencies] dev = [ "ruff>=0.1.0", "pytest>=7.0.0", ] sqlite-compat = [ "pysqlite3-binary>=0.5.0; python_version < '3.12'" ] ``` From `scripts/embedder.py:31-34`: ```python from sentence_transformers import SentenceTransformer self._model = SentenceTransformer(self.model_name) self._dimension = self._model.get_sentence_embedding_dimension() ``` The configured model name is the mutable repository identifier `BAAI/bge-small-zh-v1.5`, rather than an immutable revision or locally verified artifact. ### Technical Analysis All third-party packages are constrained only by minimum versions. Consequently, an installation may select any later release accepted by the dependency resolver. There is no lockfile, exact version pinning, package hash verification, or recorded transitive dependency set. The embedding implementation also passes a model repository identifier directly to `SentenceTransformer`. If the model is not already cached, the library may retrieve model files from an external model registry. No immutable model revision or expected artifact checksum is supplied. These practices weaken build reproducibility and create a supply-chain trust boundary outside the ...[truncated 1933 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (63)

Tainted flow: 'headers' from os.environ.get (line 355, credential/environment) → httpx.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/annotator.py (reported line 366)May include surrounding context.

python
"temperature": 0.7,
        }

        response = httpx.post(url, headers=headers, json=data, timeout=60)
        response.raise_for_status()

        result = response.json()

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

The README instructs users to run a recursive force-delete command against a path containing a placeholder variable. In agent or copy-paste driven workflows, users may substitute the placeholder incorrectly or execute from an unexpected directory, causing unintended data loss beyond the intended collection.

Content

Scanner excerpt · README.md (reported line 228)May include surrounding context.

bash
# 删除向量库重新构建
rm -rf corpus/chroma/{collection_name}
python3 scripts/build_corpus.py --source ./novels --name test

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

该代码片段的实际功能与声明中的“语料库构建工具”只部分一致。它确实实现了“智能分块”这一部分,但没有看到任何调用 LLM、DashScope API、规则标注流程、embedding 生成或存储逻辑。虽然数据结构中预留了 annotation 和 embedding 字段,但这只是占位,并不构成实际能力实现。因此,就该代码片段而言,描述显著高于实际行为,存在描述与行为不一致。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

声明描述的是一个较完整的语料库构建工具,核心能力包括智能分块、AI 标注和向量化存储。实际提供的代码块仅是 tests/test_chunker.py,用于测试 TextChunker 和 Chunk 的分块与数据结构行为。它确实与“智能分块”中的分块部分相关,但没有展示语料库构建流水线,也没有任何 AI 标注、嵌入生成、向量数据库存储、API 调用或降级逻辑。因此,这段代码与声明用途仅部分吻合,整体上属于能力范围明显缩水且主用途不同(测试分块器)的不匹配。

Content

No source excerpt is available for this finding.

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · README.md (reported line 52)May include surrounding context.

��文件

  • ❌ 不存储 API Key 到 skill 目录或本地文件
  • ❌ 不使用 subprocess 调用外部 CLI 工具
  • ❌ 不访问 其他 provider 的凭证

环境配置

LLM 模式(需要 API Key)

设置环境变量(唯一支持的方式):

bash
# 临时设置(当前终端有效)
export DASHSCOPE_API_KEY="sk-xxx"

# 永久设置(添加到 ~/.bashrc)
echo 'export DASHSCOPE_API_KEY="sk-xxx"' >> ~/.bashrc
source ~/.bashrc

⚠️ 注意: 不要将 API Key 提交到 Git 或分享给他人。

规则模式(完全离线)

无需 API Key,自动使用规则引擎进行标注:

  • 不设置 DASHSCOPE_API_KEY 环境变量
  • 技能自动降级到规则标注模式
  • 质量较低但完全离线运行

可选:SQLite3 兼容性

如果运行时报错 sqlite3 version < 3.35.0:

bash
# 安装 pysqlite3-binary(仅旧系统需要)
pip3 install pysqlite3-binary --user

现代系统(Ubuntu 20.04+, macOS 12+, Pyt

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · SKILL.md (reported line 40)May include surrounding context.

��文件

  • ❌ 不存储 API Key 到 skill 目录或本地文件
  • ❌ 不使用 subprocess 调用外部 CLI 工具
  • ❌ 不访问 其他 provider 的凭证

环境配置

LLM 模式(需要 API Key)

设置环境变量(唯一支持的方式):

bash
# 临时设置(当前终端有效)
export DASHSCOPE_API_KEY="sk-xxx"

# 永久设置(添加到 ~/.bashrc)
echo 'export DASHSCOPE_API_KEY="sk-xxx"' >> ~/.bashrc
source ~/.bashrc

⚠️ 注意: 不要将 API Key 提交到 Git 或分享给他人。

规则模式(完全离线)

无需 API Key,自动使用规则引擎进行标注:

  • 不设置 DASHSCOPE_API_KEY 环境变量
  • 技能自动降级到规则标注模式
  • 质量较低但完全离线运行

可选:SQLite3 兼容性

如果运行时报错 sqlite3 version < 3.35.0:

bash
# 安装 pysqlite3-binary(仅旧系统需要)
pip3 install pysqlite3-binary --user

现代系统(Ubuntu 20.04+, macOS 12+, Pyt

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

Scanner excerpt · references/troubleshooting.md (reported line 83)May include surrounding context.

��文件

  • ❌ 不存储 API Key 到 skill 目录或本地文件
  • ❌ 不使用 subprocess 调用外部 CLI 工具
  • ❌ 不访问 其他 provider 的凭证

环境配置

LLM 模式(需要 API Key)

设置环境变量(唯一支持的方式):

bash
# 临时设置(当前终端有效)
export DASHSCOPE_API_KEY="sk-xxx"

# 永久设置(添加到 ~/.bashrc)
echo 'export DASHSCOPE_API_KEY="sk-xxx"' >> ~/.bashrc
source ~/.bashrc

⚠️ 注意: 不要将 API Key 提交到 Git 或分享给他人。

规则模式(完全离线)

无需 API Key,自动使用规则引擎进行标注:

  • 不设置 DASHSCOPE_API_KEY 环境变量
  • 技能自动降级到规则标注模式
  • 质量较低但完全离线运行

可选:SQLite3 兼容性

如果运行时报错 sqlite3 version < 3.35.0:

bash
# 安装 pysqlite3-binary(仅旧系统需要)
pip3 install pysqlite3-binary --user

现代系统(Ubuntu 20.04+, macOS 12+, Pyt

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

The documentation instructs users to run a recursive deletion command using rm -rf with a variable-like placeholder path. Even though the target is intended to be a local ChromaDB collection directory, such commands are dangerous because placeholder substitution mistakes, empty values, shell expansion issues, or path manipulation can delete unintended data irreversibly.

Content

Scanner excerpt · SKILL.md (reported line 154)May include surrounding context.

ChromaDB 错误

删除向量库重新构建:

bash
rm -rf corpus/chroma/{collection_name}
python3 scripts/build_corpus.py --source ./novels --name test

相关脚本

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
98% confidence
Finding

The documented use of rm -rf corpus/chroma/{collection_name} is a high-risk destructive shell pattern because it bypasses confirmation and relies on manual placeholder substitution. If copied incorrectly, expanded unexpectedly, or run from the wrong directory, it can delete unintended files; in this skill context, users are troubleshooting storage issues and are likely to copy-paste commands directly.

Content

Scanner excerpt · examples/USAGE_EXAMPLES.md (reported line 175)May include surrounding context.

bash
# 删除向量库重新构建
rm -rf corpus/chroma/{collection_name}
python3 scripts/build_corpus.py --source ~/novels/reference --name test

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

The guide instructs users to run rm -rf corpus/chroma/xxx to rebuild a collection, which permanently deletes stored corpus/vector data. In a corpus-building skill, that data is likely user-created and potentially costly to regenerate, making this more dangerous in context than a generic temp-file cleanup.

Content

Scanner excerpt · references/troubleshooting.md (reported line 136)May include surrounding context.

解决方案:

bash
# 删除语料库重新构建(使用正确的模型)
rm -rf corpus/chroma/xxx
python3 scripts/build_corpus.py --source ./novels --name xxx

# 检查模型配置

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

The skill description and all user-facing instructions are presented only in Chinese and describe the tool as optimized for Chinese novels, but the README does not explicitly state that the skill is intentionally Chinese-only or offer a language/locale choice. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale constraint is clearly documented and justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The troubleshooting section instructs users to run rm -rf corpus/chroma/{collection_name} to rebuild the vector database, which is a destructive file deletion. The README does not warn that this permanently removes the existing collection data or advise backing it up first.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest description, title, usage instructions, and operational guidance are all presented in Chinese, and the file does not state that the skill is region- or language-specific or provide an opt-in language choice. This can violate a language/locale policy when users are not given a choice of language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The file uses Chinese-only labels and selects a Chinese embedding model (bge-small-zh-v1.5), which indicates a language-specific default. There is no accompanying note that this is optional, user-selectable, or justified as a region-specific skill, so it may violate the language/locale policy requiring opt-in or documented rationale.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The entire skill documentation is presented only in Chinese, including headings, field descriptions, and usage guidance. For a general-purpose example README, this imposes a language requirement on users without any opt-in or explanation that the skill is region- or locale-specific.

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 · examples/USAGE_EXAMPLES.md (reported line 9)May include surrounding context.

bash
# 1. 准备源文件(TXT 格式)
mkdir -p ~/novels/reference
cp /path/to/your/novels/*.txt ~/novels/reference/

# 2. 构建语料库

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The example explicitly instructs users to run a recursive force-delete command against a corpus directory, but does not warn that this permanently removes the local vector store and may destroy indexed data. Even though it is framed as troubleshooting, documentation snippets are often copied verbatim, so an unsafe deletion example can cause accidental data loss or encourage unsafe command habits.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The troubleshooting guide forces a specific language/locale for all instructions and headings, with no indication that users may choose another language or that the skill is intentionally region-specific. Under the stated policy, fixed language behavior without opt-in or justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/troubleshooting.md (reported line 19)May include surrounding context.

md
pip3 install pysqlite3-binary --user

# 方案 2: 升级系统 sqlite3
sudo apt-get install sqlite3  # Ubuntu/Debian
sudo yum install sqlite3      # CentOS/RHEL

# 验证版本

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · references/troubleshooting.md (reported line 20)May include surrounding context.

md
pip3 install pysqlite3-binary --user

# 方案 2: 升级系统 sqlite3
sudo apt-get install sqlite3  # Ubuntu/Debian
sudo yum install sqlite3      # CentOS/RHEL

# 验证版本

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The document shows users how to export and persist an API key and then print it back with echo $DASHSCOPE_API_KEY, but it does not warn that shell history, shared terminals, screenshots, and dotfiles can expose secrets. This is a real credential-handling weakness in documentation because it normalizes insecure secret management practices.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The troubleshooting guide instructs users to run destructive deletion commands to clear caches and remove a corpus directory, but it does not warn about data loss, path verification, or backups. In a documentation context, this can lead to accidental destruction of user data if paths are mistyped, expanded unexpectedly, or copied without understanding the consequences.

Content

No source excerpt is available for this finding.

File System Enumeration

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.

Content

Scanner excerpt · references/troubleshooting.md (reported line 155)May include surrounding context.

解决方案:

bash
# 检查目录是否存在
ls -la ~/workspace/novels/

# 检查文件扩展名
find ~/workspace/novels/ -name "*.txt"

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

User-facing descriptions, prompts, labels, and outputs are written entirely in Chinese, and the annotation prompt instructs the model to analyze and return results in that language without offering any language or locale choice. This can violate language/locale policy when no user opt-in or explicit region-specific justification is provided.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.