T09 · Insecure Skill Coding Practices
- Location
scripts/kb-llm.py:137- Finding
LLM-Controlled Path Traversal Allows Writes Outside the Wiki Directory
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a plausible knowledge-base skill, but its LLM compile path can write files outside the intended wiki folder and it sends raw document prompts to configured LLM endpoints without strong safeguards.
Review this before installing. Use it only with non-sensitive documents or a trusted local/provider endpoint, avoid running compile or lint on untrusted ingested content, and do not use bulk all-agent activation unless you intend to create persistent knowledge-base directories for every agent. The LLM filename path traversal should be fixed before normal use.
scripts/kb-llm.py:137LLM-Controlled Path Traversal Allows Writes Outside the Wiki Directory
scripts/kb-llm.py:21Unrestricted LLM Endpoint Can Receive API Credentials and Knowledge-Base Content
scripts/compile.sh:54Untrusted Documents Are Mixed with LLM Control Instructions
声明描述的是一个较完整的知识库系统/技能,核心能力包括独立知识库创建与多种知识库操作;但提供的代码片段只是一个“生成 wiki 索引”的辅助脚本。它读取本地 markdown 文件,按 type: paper/article/note 分类生成索引页面,并更新主索引文件,没有显示任何 Agent 隔离逻辑、知识入库流程、查询接口、编译流程、同步机制、体检检查或激活操作。因此代码实际行为与声明用途存在明显的主功能不一致,属于描述与实现不匹配。
代码块的主要用途非常明确:解析 reStructuredText 文档并转换成 Markdown。它处理 RST 指令、表格、列表、标题、内联标记,并可读取相关子模块 rst 文件生成索引。整个实现中没有出现知识库目录创建、Agent 隔离、向量索引、检索、编译构建、同步、健康检查或激活等与声明描述核心能力相符的逻辑。因此这不是“描述涵盖实现细节”的情况,而是主功能层面的明显不一致,应判定为 mismatch。
The natural-language instructions and descriptions are effectively limited to Chinese, and the file does not offer an alternative language or indicate that the locale restriction is intentional. This can be a language-policy violation under SQP-3 when a skill forces a specific language without user opt-in.
The manifest documents capabilities that imply environment access, filesystem reads/writes, and network fetching, but it does not declare any tool scope restrictions such as permissions or allowed-tools. In an agent ecosystem, this creates an authorization ambiguity where the skill may be invoked with broader access than users or reviewers expect, increasing the chance of unintended file access, data persistence, or remote content ingestion.
Using a generic trigger like "知识库" makes accidental invocation likely during ordinary conversation about knowledge bases. In a skill that can ingest remote content, write local files, and sync memory references, an overbroad activation phrase raises the risk of unintended operations and silent data movement.
The skill claims per-agent isolation, yet its documented memory bridge imports shared reference memory into each agent-local knowledge base. That weakens the isolation boundary: sensitive or policy-bearing shared content may be replicated into agent-specific storage, where it can be surfaced in searches, recompiled, or retained longer than intended.
The documentation describes ingest and memory-sync behavior but does not warn users that external web content and shared memory references may be copied into the agent-local knowledge base. This omission can lead to unintentional retention of sensitive, copyrighted, or untrusted content, especially because the skill presents itself as isolated and convenient to use.
The listed activation triggers lack boundaries, scope constraints, or negative examples, so users and orchestration layers may not know when the skill should or should not activate. Ambiguous invocation rules are risky here because the documented commands include data ingestion, compilation, synchronization, and storage operations.
The prompt text explicitly states '使用中文撰写摘要和正文', requiring all generated summaries and body text to be in Chinese. This is a natural-language locale constraint, and the file does not offer a user choice or explain a region-specific reason for enforcing Chinese output.
This shell script includes its description, usage examples, and later runtime messages entirely in Chinese, which effectively forces a specific language for users. The policy allows locale constraints only when users are given a choice or when the restriction is clearly documented and justified, neither of which appears here.
This shell script contains natural-language comments and output strings entirely in Chinese, such as the title and usage note, with no indication that the skill is region-specific or that users may choose another language. The policy explicitly flags language/locale constraints when they are imposed without opt-in or justification.
The script writes files using filenames taken directly from LLM output via os.path.join(wiki_dir, filename) with no validation or normalization. Because the LLM output is fully attacker-influenced through prompt/raw document content, a crafted filename such as ../../sensitive or an absolute path could escape wiki_dir and overwrite arbitrary files on the host, making this more serious than a mere lack of confirmation.
The script reads the prompt file and sends its full contents to an external LLM provider over the network. In a knowledge-base compiler, prompts commonly embed raw documents, internal URLs, notes, or other sensitive enterprise content, so this can cause unintended data exfiltration if operators are not clearly informed or if provider trust boundaries are misunderstood.
This shell script includes its descriptive comments and all user-facing help/status text in Chinese, and it instructs the downstream LLM task in Chinese as well. That creates a language policy concern because the skill appears to require a specific language without documenting a user choice or a justified locale restriction.
The script builds a prompt explicitly instructing an LLM to directly modify wiki files, while only warning that 'LLM intervention' is needed. This is risky because wiki content is treated as input to the prompt, so prompt-injection embedded in wiki pages could influence the model into making unintended or destructive file edits, and the operator is not clearly warned about that write capability.
The document is entirely written in Chinese and does not offer any language or locale choice for users. Under the stated policy, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale constraint is documented and justified.
The README instructs users to ingest a remote URL directly, but provides no warning that this causes the skill to fetch and process untrusted external content. In a knowledge-base skill, that content may later influence indexing, compilation, or downstream LLM behavior, increasing the risk of prompt injection, malicious document ingestion, or unsafe handling of attacker-controlled data.
This shell script’s natural-language comments and echoed status messages are entirely in Chinese, which imposes a specific language on users without any opt-in or alternative. The policy explicitly calls for flagging language or locale constraints when the skill forces a specific language choice.
This code file contains user-facing comments and console output entirely in Chinese, including status messages and generated markdown headings. Under the language/locale policy, forcing a specific language without user opt-in or documented justification is a natural-language policy violation.
The operational status messages shown during execution are all Chinese, which means users interacting with the script are required to understand that language. Because the file does not justify a Chinese-only audience or provide an alternative locale, this is a natural-language policy concern.
The script reads provider configuration containing API keys from local files and then uses those credentials in outbound requests. While this is part of LLM access, the file does not include an explicit warning or comment highlighting that sensitive credentials are accessed and used.
This Python file contains natural-language descriptions entirely in Chinese, including the module docstring, and later exposes Chinese-only CLI messages. Under the policy, forcing a specific language without user opt-in can be a natural-language locale violation when no justification or language selection is provided.
The script prints usage and failure messages only in Chinese, with no fallback or opt-in for other languages. This creates a locale-specific experience that is not documented as region-specific or configurable.
This shell script includes its title, usage text, and runtime messages entirely in Chinese, such as the description on L02-L03 and prompts on L34, L42, and L53. Under the policy for natural-language violations, forcing a specific language without user opt-in is reportable because the skill does not offer any locale selection or justify a Chinese-only scope.
No suspicious patterns detected.