Back to skill

Security audit

中文公文写作

Security checks for vulnerabilities and agentic risk

Overview

This is a disclosed Chinese official-document writing and review skill with local linting helpers; the main caution is handling very large or crafted document files.

Install this only if you want a Chinese official/workplace document assistant. Avoid running its bundled scripts on untrusted or very large DOCX/TXT/MD files unless the host environment has memory and CPU limits, because crafted documents could cause the checker to hang or exhaust resources.

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

Warning
Location
scripts/prose_lint.py:404
Finding
Unbounded Input and DOCX Decompression Can Cause Resource Exhaustion## Vulnerability Details **File Location**: `scripts/prose_lint.py:404-421` and `scripts/prose_lint.py:458-462` **Vulnerability Type**: Unbounded file loading, archive decompression, and XML parsing **Risk Level**: Medium ### Vulnerable Code ```python with zipfile.ZipFile(path) as zf: part_names = set(zf.namelist()) if "word/document.xml" not in part_names: raise InputReadError(f"DOCX missing main document content: {path}") xml_names = ["word/document.xml"] if scope == "all": for kind in ("header", "footer"): xml_names.extend(sorted( name for name in part_names if re.fullmatch(rf"word/{kind}[^/]*\.xml", name) )) xml_names.extend(( "word/footnotes.xml", "word/endnotes.xml", "word/comments.xml", )) for name in xml_names: if name not in part_names: continue root = ElementTree.fromstring(zf.read(name)) ``` The same input path also permits unbounded loading of plain-text and Markdown files: ```python path = Path(path_arg) try: if path.suffix.lower() == ".docx": return str(path), read_docx(path, scope=docx_scope, format_findings=docx_format_findings) raw = path.read_bytes() ``` ### Technical Analysis The Skill explicitly supports user-provided DOCX, TXT, and Markdown documents. The linter loads plain-text files entirely into memory through `Path.read_bytes()`. For DOCX files, which are ZIP archives, selected XML members are read and decompressed entirely through `zf.read(name)` before being parsed with `ElementTree.fromstring()`. No controls are applied to: - The original input-file size. - The number of ZIP members. - Individual or aggregate uncompressed member sizes. - Compression ratios. - XML document size, depth, or element count. - Memory consumption or processing time. An attacker can therefore provide an oversized text file, an XML-heavy DOCX, or a highly compressed ZIP-bomb-style DOCX. Pr ...[truncated 1604 chars]
Remediation
## Remediation Suggestions 1. **Enforce input-size limits before reading** - Check `Path.stat().st_size` against a documented maximum. - Reject oversized TXT, Markdown, and DOCX inputs before calling `read_bytes()` or opening the archive. - Use bounded, incremental reads instead of loading complete plain-text files into memory. 2. **Validate DOCX archive metadata** - Inspect every relevant `ZipInfo` entry before decompression. - Enforce limits on individual and aggregate `file_size` values. - Reject suspicious compression ratios, such as very small `compress_size` values paired with very large `file_size` values. - Limit the total number of archive entries. - Reject encrypted, malformed, duplicated, or unexpected members where they are not required for supported DOCX processing. 3. **Bound decompression** - Read archive members through a streaming interface with a strict byte counter. - Abort processing immediately when an individual or aggregate decompression limit is exceeded. - Do not rely exclusively on ZIP metadata because malicious or malformed archives may contain misleading metadata. 4. **Harden XML parsing** - Enforce maximum XML sizes before parsing. - Apply depth, node-count, and text-size limits. - Use a hardened XML parser or a parser configuration designed for untrusted documents. - Stop parsing when configured complexity thresholds are exceeded. 5. **Isolate execution** - Run document-processing utilities with memory, CPU, and wall-clock time limits. - Execute them in a restricted worker process or sandbox so resource exhaustion cannot destabilize the main Agent process. - Return a controlled input-validation error when a limit is reached. 6. **Add security tests** - Test oversized plain-text inputs. - Test DOCX archives with extreme compression ratios and large aggregate expanded sizes. - Test deeply nested and high-node-count XML documents. - Verify that each case is rejected be ...[truncated 43 chars]
Vulnerability Patterns
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (50)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
声明描述的是一个广泛的中文公文与新闻写作/编辑处理技能集合,核心应包括内容生成、修改、审校和格式处理。实际代码并不执行任何文本起草、改写、润色、审校或格式调整,只是读取输入文本并统计正文长度,附带最小/最大字数边界判断。这属于与声明主目的明显不同的单一实用工具。虽然字数统计可被视为写作流程中的辅助功能,但它不足以支撑所宣称的大量核心能力,因此存在明显描述与行为不符。

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding
代码的核心目的与声明存在明显偏差。声明描述的是一个综合性中文公文/新闻写作与编辑助手,强调起草、改写、压缩、润色、审校和 Word 格式处理;而代码实际上是一个静态检查器,重点在‘发现风险并报告’,且文件头明确写明‘只报告风险,不自动改写正文’。它确实与声明中的部分‘审校、去口语化、降 AI 痕迹、部分格式检查’方向相关,但只覆盖其中的审查子集,缺少最关键的生成与编辑能力,因此属于描述显著高于实际行为的情况。资源访问方面,代码只读取本地文本/STDIN/DOCX并输出结果,没有额外越权行为;不匹配主要来自主要用途和能力范围的差异。

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The title and description explicitly position the skill for Chinese official-document writing, but the README does not state that this is an opt-in language mode or explain a justified regional/organizational limitation. Under the language/locale policy, forcing a specific language without user choice can be a natural-language policy violation.

Vague Triggers

Medium
Confidence
85% confidence
Finding
The usage section says that a few ideas, chat records, or half-finished drafts can be sent directly, then gives broad example requests like '帮我写个通知' and '帮我看看这份...'. This describes activation in very general natural language without clear constraints, negative examples, or boundaries, which increases the risk of unintended invocation overlap with ordinary writing-assistance requests.

Lp3

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding
Without declared permissions the skill's intent is opaque and cannot be validated.

Natural-Language Policy Violations

Medium
Confidence
88% confidence
Finding
The file states that Chinese official-document tasks are handled here and that English and other writing types should use other paths, which functions as a language restriction. Under the policy rule, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale constraint is explicitly justified; this file does not clearly present it as a user choice or compliance-bound regional limitation.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The display name, short description, and default prompt all prescribe Chinese official writing as the required language, but the file does not state that users may choose another language or explicitly opt into this locale constraint. This creates a natural-language policy issue because the skill appears to enforce a specific language by default.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The title explicitly frames the skill as a language/style check in Chinese ("语言与抗 AI 味检查"), and the document consistently instructs rewriting and checking text in Chinese without offering any user language selection. This is a natural-language policy concern because it imposes a specific language/locale by default rather than making it optional or clearly documenting a justified region-specific constraint.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
This markdown file contains user-facing routing instructions only in Chinese and does not indicate that users may choose another language or locale. Under the policy rule for natural-language violations, forcing a specific language without user opt-in is a reportable issue.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The file's instructional content is fully presented in Chinese and does not indicate that users may choose another language or opt in to this locale. Under the stated policy, forcing a specific language without user choice is a natural-language policy violation unless clearly justified.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
This markdown file presents all instructions and examples exclusively in Chinese, with no indication that the user can choose another language or that the locale restriction is optional. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless clearly documented as a justified region-specific constraint.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
This markdown file contains natural-language instructions entirely in Chinese and presents them as the operative behavior for the skill. Under the policy, forcing a specific language without user opt-in or an explicit justified locale constraint is a reportable language/locale policy violation.

Natural-Language Policy Violations

Medium
Confidence
79% confidence
Finding
The entire skill file is written as a Chinese-only checklist and does not indicate that users may choose another language or locale. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale constraint is explicitly justified.

Natural-Language Policy Violations

Medium
Confidence
88% confidence
Finding
The entire skill guidance is written as mandatory Chinese drafting and review instructions, including fixed Chinese phrases users should use in outputs such as `妥否,请批示` and `尊敬的领导:`. There is no indication that the user may choose another language or that the skill is explicitly limited to a China-specific or Chinese-only workflow, creating a locale-policy concern.

Natural-Language Policy Violations

Medium
Confidence
87% confidence
Finding
This markdown file contains only Chinese-language instructions and does not indicate that users may choose another language or locale. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The document's natural-language instructions are entirely in Chinese and do not indicate that users may choose another language or that the skill is intentionally limited to a Chinese-speaking or region-specific context. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The entire playbook is written as prescriptive guidance in Chinese and does not indicate that the user may choose another language or locale. Under the policy for natural-language violations, a skill that effectively mandates a specific language without opt-in should be flagged unless the locale restriction is explicitly justified.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The entire skill file is written as a Chinese-only playbook and provides no indication that language selection is optional or limited to a justified region-specific context. Under the policy for natural-language violations, forcing a specific language without user opt-in is in scope.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
This markdown file contains user-facing instructions exclusively in Chinese, and there is no indication that users may choose another language or that the skill is intentionally restricted to a Chinese-language context. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The entire skill guidance is written in Chinese and provides no indication that users may choose another language or locale. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The entire skill description is written as prescriptive guidance for producing meeting host scripts in Chinese, with no indication that users may request another language or that the skill is limited to a Chinese-only context. This can violate language/locale policy when a skill implicitly enforces a specific language without user opt-in.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
This markdown file contains user-facing natural-language instructions exclusively in Chinese, and nowhere indicates that the skill is optional, locale-specific, or that users may choose another language. Under the policy scope for natural-language violations, forcing a specific language without opt-in is a reportable issue.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The file is entirely written as a Chinese-only writing playbook for news commentary, with no indication that users may choose another language or locale. Under the policy rule, a skill that imposes a specific language without user opt-in is a natural-language policy violation.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The entire skill file is written as a prescriptive genre playbook in Chinese and provides no indication that language selection is optional. Under the policy, forcing a specific language or locale without user opt-in can be a natural-language policy violation unless the constraint is clearly documented and justified.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The entire skill file is written as a prescriptive template in Chinese and provides no indication that users may choose another language or locale. Under the policy rule for natural-language constraints, this creates a language-specific behavior without explicit opt-in or documented justification.

Static analysis

No suspicious patterns detected.