Back to skill

Security audit

Official doc generator

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a disclosed document-generation tool, but its template manager can overwrite or delete Word documents outside the intended template folder if given unsafe names.

Install only if you are comfortable with local document file operations. Use a dedicated working folder, avoid template names containing path separators, absolute paths, or `..`, and manually review compliance suggestions because they may change factual meaning.

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
scripts/template_manager.py:275
Finding

Template Name Path Traversal Enables Arbitrary DOCX File Overwrite and Deletion

Content
View full analysis
bool: """Delete a template.""" # Check whether the template exists template_path = self.templates_dir / f"{template_name}.docx" if not template_path.exists(): print(f"Template does not exist: {template_name}") return False try: # Delete the file template_path.unlink() # Delete its configuration templates = self.templates_config.get('templates', {}) if template_name in templates: del templates[template_name] self.templates_config['templates'] = templates self._save_config() print(f"Template deleted successfully: {template_name}") return True except Exception as e: print(f"Failed to delete template: {e}") return False ``` Template creation and update use the same unvalidated path as a copy destination: ```python template_path = self.templates_dir / f"{template_name}.docx" # Copy a file into the template directory shutil.copy2(source_file, template_path) ``` Template export also uses the constructed path as a copy source: ```python template_path = self.templates_dir / f"{template_name}.docx" if not template_path.exists(): print(f"Template does not exist: {template_name}") return False try: shutil.copy2(template_path, output_path) ``` ### Technical Analysis The `template_name` argument is supplied through the command-line interface and is interpolated direct ...[truncated 3212 chars]
Remediation
View remediation
str: if not TEMPLATE_NAME_PATTERN.fullmatch(template_name): raise ValueError("Invalid template name") return template_name ``` 2. **Enforce resolved-path containment** Centralize target-path construction and verify that the resolved target remains under the resolved template directory: ```python def get_safe_template_path(self, template_name: str) -> Path: validate_template_name(template_name) base = self.templates_dir.resolve() target = (base / f"{template_name}.docx").resolve() try: target.relative_to(base) except ValueError: raise ValueError("Template path escapes the template directory") if target.parent != base: raise ValueError("Nested template paths are not allowed") return target ``` 3. **Use the centralized helper everywhere** Replace every direct construction of: ```python self.templates_dir / f"{template_name}.docx" ``` in `get_template`, `create_template`, `update_template`, `delete_template`, and `export_template`. 4. **Defend against symbolic-link attacks** Before destructive or overwrite operations, reject symbolic-link targets and ensure the parent directory has not changed: ```python if target.is_symlink(): raise ValueError("Symbolic-link templates are not allowed") ``` Where concurrent untrusted users can modify the directory, use descriptor-relative or other race-resistant filesystem operations supported by the deployment platform. 5. **Validate source and destination files** Confirm that imported and copied source files are regular files with the expected `.docx` extension. A ...[truncated 520 chars]
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (54)

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

声明的核心用途是“自动生成”和“自动排版”公文材料,并包含内容风格与敏感词/合规检查;但该代码块的核心行为是对已有 .docx 文件进行格式验证并输出报告。虽然它确实涉及 GB/T 9704-2012、党政机关和企业公文规范,这与声明中的‘格式相关’部分部分一致,但只属于其中的一个子能力,而且还是校验而非生成/排版。由于主功能发生明显偏移,且多个关键声明能力完全未出现,应判定为描述与实际行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

描述将该技能表述为一个通用的体制内公文生成与排版工具,覆盖多种文档类型、标准规范和合规检查能力。但代码仅实现了一个专用脚本:生成固定内容结构的“学习讨论材料”docx文档,用户只能改变标题、署名和输出目录,正文主体内容基本写死。虽然代码确实包含较完整的公文排版逻辑,并符合描述中“按标准公文格式自动排版”的一部分,但其核心能力远窄于声明:没有多类型文档生成、没有敏感词/合规检查、没有可见的企业公文规范处理。因此描述对能力范围有明显夸大,属于实质性不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

描述与代码部分匹配:代码确实用于生成若干正式文档类型,并进行一定格式化处理。但存在重要能力夸大。尤其“敏感词和合规性检查”完全未实现,这是实质性未声明/错声明行为差异。另外,对‘遵循GB/T 9704-2012标准、党政机关公文格式和企业公文规范’的表述也明显超出代码实际实现深度,代码仅做了基础样式和结构模板设置,缺乏完整规范支持与校验。因此应判定为描述与实际行为不完全一致,属于 mismatch。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
88% confidence
Finding

整体上,代码与“公文/正式文档自动生成和排版”这一核心用途大体一致,确实会生成多类正式 Word 文档,并按较具体的公文版式设置页面边距、页码、标题与正文样式,因此主目的基本匹配。但存在若干明显偏差:第一,声明强调“敏感词和合规性检查”,而代码中没有任何相关检测逻辑;第二,代码引入并使用修订历史管理器,创建和保存时会跟踪文档修订并输出摘要,这是声明中未提及的实质能力;第三,代码支持“通知、请示报告”等额外文种,而声明示例只提到会议纪要、发言稿、讨论提纲、工作汇报。以上说明描述并不准确完整,属于描述与行为存在不小偏差的情况。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

代码的核心功能与描述存在明显范围不一致。实际代码确实实现了“按照公文格式自动排版”的一部分能力,并且明确参考了GB/T 9704-2012的页面、字体、行距、缩进等格式要求;这一点与声明部分一致。但其内容生成能力非常狭窄:文档主体内容完全由硬编码常量组成,围绕“组织生活会个人对照检查材料”及后勤领域专项整肃治理展开,只允许用户修改标题、署名、输出目录和文件名。因此,它不是一个通用的体制内讨论材料生成技能,而是一个特定文种、特定主题的模板导出脚本。此外,声明中的“支持会议纪要、发言稿、讨论提纲、工作汇报等多种文档类型”以及“敏感词和合规性检查”在代码中都没有实现,属于重要能力宣称与实际行为不符。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

声明描述的是一个覆盖多类体制内公文的通用生成与自动排版工具,还声称具备语言风格适配、标准公文规范支持以及敏感词/合规性检查等能力。实际代码只做一件事:使用 python-docx 生成一份固定标题、固定段落内容的“组织生活会个人对照检查材料”Word 文档,并应用若干字体、缩进、页边距等格式。它没有接收正文生成参数,没有文档类型切换,没有检查逻辑,也没有体现广泛的公文标准处理能力。因此其主要用途明显比声明更窄,且缺失多项核心宣称能力,属于明显描述与行为不符。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

声明的核心用途是“生成和排版正式公文类文档”,而代码的核心功能是“记录与管理文档修订历史”。该代码不会生成会议纪要、发言稿、讨论提纲或工作汇报内容,也没有任何版式处理、模板套用、语言风格控制、合规审查逻辑。相反,它会读取本地文档、计算SHA-256哈希、将修订信息写入本地历史目录,并支持加载、列举和比较历史文件。这属于与声明主用途明显不同的功能方向,因此构成显著不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

声明描述的是一个以“公文生成+标准排版”为核心的综合写作技能,敏感词检查只是其中附带能力之一。但提供的代码仅包含敏感词/合规检查相关逻辑:读取文本或文件、根据文档类型选择检查级别、匹配本地敏感词库、输出检查报告,以及导入导出词库。没有任何文本生成、模板渲染、公文结构组织、版式设置、标题编号、落款、页边距、字体字号等排版实现。因此代码只覆盖了声明中的一小部分(敏感词和合规性检查),而缺失了声明中最核心、最主要的能力,属于明显的描述与行为不一致。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

声明的核心能力是“生成并排版正式公文材料”,而该代码块的核心用途是管理 .docx 模板及其元数据。虽然默认模板名称与会议纪要、发言稿等场景相关,但代码只是在模板目录中复制、保存、列出和初始化模板文件,并通过命令行提供 CRUD、导入导出操作。没有看到任何文本生成、内容填充、格式套用、规范校验、敏感词扫描或合规审查逻辑。因此该代码与声明用途存在明显且实质性的功能不匹配。

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- `scripts/sensitive_words_check.py` - 敏感词检查脚本

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- `scripts/sensitive_words_check.py` - 敏感词检查脚本

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger conditions are broad enough to overlap with ordinary writing and formatting requests, which can cause the skill to activate when a narrower, less-privileged capability would be more appropriate. In a document-generation skill that also performs compliance-style analysis, overbroad triggering can unnecessarily pull general user content into this workflow and increase the chance of unintended policy shaping or user-data processing.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill advertises and documents file creation/writing behavior, including automatic directory creation and output/history file generation, but does not declare an explicit tool scope such as permissions or allowed-tools. That creates a least-privilege gap: a host may expose broader filesystem capabilities than users expect, increasing the chance of unintended writes or abuse via crafted output paths.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The invocation description is broad enough to catch many generic document-writing requests, increasing the chance of accidental activation. In this context, unintended activation matters because the skill can write files, create directories, and apply specialized formatting/workflows that may not match user intent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill is framed to impose a specific official/organizational language style by default, without clear user opt-in. In a document-generation context, that can steer ordinary user requests into politically or institutionally constrained output unexpectedly, which is risky because it changes content semantics and may produce authoritative-looking material the user did not intend.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill advertises network-based sensitive-word list updates but does not clearly warn users that content-related processing may involve online retrieval or remote dependency refresh. In a document workflow that may handle internal or sensitive organizational material, undeclared network behavior raises confidentiality, integrity, and supply-chain concerns.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file title and overview establish the specification entirely in Chinese and frame it as the required standard for document generation. Because the guidance does not offer any language or locale choice, it effectively enforces a specific language policy without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The document presents a single mandated '体制内' language and style regime from the outset without indicating that this tone should be selected only when the user explicitly wants that format. In a document-generation skill, this can cause the model to steer outputs toward politically or institutionally aligned phrasing by default, reducing user autonomy and increasing the risk of inappropriate or context-misaligned content generation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

This markdown file is entirely written as a China-specific policy document and directs users to conform document content to unspecified 'relevant policies and regulations' without stating that the skill is limited to a China-specific compliance context. Under the policy rule, forcing one language/locale or policy regime without opt-in or explicit justification is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This section instructs the skill to rewrite politically, socially, and organizationally sensitive content into euphemistic or sanitized language, which goes beyond formatting or compliance checking and into substantive censorship of user meaning. In a document-generation skill for official materials, this can suppress accurate reporting of risks, incidents, losses, or public concerns and facilitate misleading documents that conceal material facts.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This code file contains natural-language descriptions and user-facing output that assume a single language/locale context. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script presents installation guidance, argument descriptions, validation messages, and status output only in Chinese. Because the file does not offer a locale choice or clearly justify a mandatory Chinese-only experience, this conflicts with the language/locale policy.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring, CLI description, and generated document content are all fixed in Chinese, and the script is specifically designed around Chinese document standards and wording. There is no indication that users can opt into another language or locale, which is a natural-language locale policy concern under the stated rule.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The module docstring states the tool is an official document generator following the Chinese GB/T 9704-2012 standard, and the rest of the script consistently hardcodes Chinese text for generated content and CLI messages. This enforces a specific language/locale without any user opt-in or configurable alternative, which matches the policy-violation criteria for language/locale constraints.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The module description and generated content are written as a Chinese official-document generator with fixed Chinese document conventions, titles, dates, and phrasing. There is no indication that users can choose another language or locale, which makes the skill behavior language-specific without explicit opt-in or justification in this file.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.