Back to skill

Security audit

合同审核 Skill

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent Chinese contract-review skill, but it needs Review because it can automatically install unpinned OCR dependencies and contains unsafe shell execution reachable through document-derived filenames.

Install only if you are comfortable running local document-processing code on contracts. Use copies of originals, review tracked changes before relying on clean versions, avoid attacker-controlled filenames or suffixes, and disable or review the PDF OCR auto-install path unless dependencies are pinned and installed in an isolated environment.

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

T09 · Insecure Skill Coding Practices

Error
Location
scripts/full_pipeline.py:264
Finding

Shell Command Injection Through Attacker-Controlled Document Names or Output Suffixes

Content
View full analysis
/dev/null' result = subprocess.run(cmd, shell=True, capture_output=True, text=True) ``` The affected filename is constructed from command-line-controlled values: ```python parser.add_argument('input', help='Input file (.doc or .docx)') parser.add_argument('--suffix', default='-修订痕迹版', help='Output filename suffix') ``` ```python stem = input_path.stem revised_path = output_dir / f"{stem}{args.suffix}.docx" clean_path = output_dir / f"{stem}{args.suffix}-清洁版.docx" if not generate_clean(revised_path, clean_path): log("Clean document generation failed; retaining revised document", "WARN") ``` ### Technical Analysis The input document stem and the optional `--suffix` value are incorporated into `revised_path.name`. That filename is copied into a temporary directory and interpolated directly into a command string passed to `subprocess.run()` with `shell=True`. Wrapping the path in double quotes does not neutralize shell metacharacters. POSIX shells still evaluate command substitution, parameter expansion, and certain other constructs inside double-quoted strings. Therefore, a filename or suffix containing shell substitution syntax can cause the shell to execute an additional command. The vulnerable fallback is reached when the primary clean-document implementation raises an exception. A malformed o ...[truncated 2042 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
scripts/pdf_ocr.py:54
Finding

Automatic Installation of Unpinned Runtime Dependencies

Content
View full analysis
Remediation
View remediation
PyMuPDF== pdf2image== Pillow== numpy== ``` 3. Generate and require cryptographic hashes for each accepted artifact, for example by using pip's `--require-hashes` mode. 4. Install dependencies only during an explicit setup phase and only after user approval. 5. Use a dedicated virtual environment with minimal permissions rather than modifying the interpreter environment that runs the Agent or other Skills. 6. Restrict installation to a trusted HTTPS package index and prevent unreviewed pip configuration or additional indexes from affecting resolution. 7. Prefer prebuilt, reviewed artifacts where possible, and maintain a dependency-update process that includes vulnerability scanning and manual review. 8. Add CI checks that reject unpinned dependencies and verify the lock file and hashes remain synchronized. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • 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
Findings (130)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description presents a comprehensive Chinese contract review skill centered on producing Word Track Changes, comments, clean versions, and iterative review management. The supplied code does not perform those functions. Instead, it narrowly inspects internal cross-references in a DOCX by reading Word XML, extracting clause numbers and cited clause references, and reporting missing/dangling references, numbering gaps, self-references, and appendix mentions. While this could be a supporting subcomponent of a larger contract-review system, the supplied chunk's actual behavior is materially narrower and different from the declared core purpose. No suspicious extra permissions or unrelated external access are present, but the main capability mismatch is substantial enough to flag.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared description presents a full Chinese contract review skill centered on producing Word revision traces, comments, clean copies, and iterative review management. However, the supplied code chunk only implements clause recommendation: it maps risks and contract types to clause categories, scores matching clause templates from a local JSON library, and outputs recommended clauses as terminal text or JSON. It does not parse or modify Word documents, create tracked changes, generate comment bubbles, produce a clean version, or manage iterative review state. While clause recommendation could be a supporting component of contract review, the primary behavior in this code chunk is materially narrower and different from the declared core purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

声明描述的是一个完整的合同审核与修订输出能力,尤其强调 Word 修订痕迹为核心输出。但该代码块并未修改 Word 文档、写入批注、生成 clean version,也没有任何法律规则匹配、风险审查或依据引用逻辑。其主要功能是离线解析 .docx 结构并输出 JSON,供后续 AI 审核定位使用;附带的合同类型检测也只是基于关键词配置的分类候选,不等同于合同审核。虽然这段代码可能是更大系统中的支撑组件,但就本代码块本身而言,与声明的核心能力和主要输出存在明显差异,因此应判定为描述与行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

描述与代码有部分重合:代码确实围绕 Word 修订痕迹、批注、清洁版生成展开,符合合同审核输出流水线的一部分。但存在明显偏差。首先,代码增加了未声明的重要能力:PDF 类型检测、扫描件 OCR、Markdown 审核报告和修订对比生成。其次,描述强调的是一个具备广泛合同审核知识覆盖和多轮迭代管理的“合同审核 Skill”,而该代码块的实际主功能更偏向文档格式转换与修订结果落盘的工程管道,并未体现 41 种合同类型、350+条款、229+风险、82个法律依据等审核智能能力。根据“描述是否准确代表代码实际行为”的标准,这属于能力范围与主功能表述不完全一致,故应判定为 mismatch。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

描述覆盖的是一个完整的中文合同审核能力集合,重点在于审核分析并输出带修订痕迹的 Word 文档。实际代码则是一个非常具体的文档后处理脚本,只负责对现有 DOCX 的修订和批注进行接受/清除,生成清洁版,不进行任何合同内容理解、审查、风险判断、法律依据匹配或迭代管理。从描述中提到的诸多能力里,代码只对应“清洁版生成”的一个子功能,而且其默认行为是去除修订痕迹,与“核心输出为 Word Track Changes”这一主能力方向相反。因此该代码块与声明用途存在明显的描述-行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

代码的实际功能是一个“对比视图生成器”,作用是把已有的 changes 数据渲染成 Markdown 摘要表。这与声明中的完整中文合同审核技能存在明显差距。声明强调的核心能力包括合同审核、风险识别、法律依据支撑、Word 修订痕迹输出、批注气泡、清洁版生成和多轮迭代管理;而该代码片段没有实现这些核心能力,仅是一个下游展示/导出辅助脚本。虽然它与“修订结果展示”相关,属于合同审核流程中的配套工具,但它无法支撑声明的主要目的,因此应判定为描述与实际行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared description presents a full Chinese contract auditing/revision skill with substantive legal coverage and Word-based outputs. The supplied code chunk does not perform contract analysis, clause/risk detection, legal basis application, or Word revision generation. Instead, it serves as a supporting preflight checker for pipeline inputs: validating changes.json structure, reading DOCX paragraph text from document.xml, checking paragraph indices, matching source text to document paragraphs, and optionally emitting a corrected JSON file. This is related to a contract-review pipeline, but its primary purpose is materially narrower and different from the declared end-user functionality. Therefore the description does not accurately represent what this code chunk actually does.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

声明描述的是合同审核/修订类能力,重点在法律条款分析、风险识别、Word 修订痕迹与批注管理;但代码并未实现任何合同审查、条款解析、风险判断、法律依据匹配、Word 文档修订或多轮迭代管理功能。相反,代码的主功能是 OCR:读取图片或 PDF,调用 macOS Vision 框架识别文字,并输出纯文本或 JSON。该行为与声明的核心用途存在明显且实质性的偏差,因此应判定为描述与实际行为不匹配。

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
99% confidence
Finding

This is a confirmed tool-parameter abuse risk because subprocess.run(..., shell=True) executes through a shell, allowing metacharacters, command chaining, and redirections if an attacker can influence the command string. In a skill that automates processing of user-provided files and may evolve to accept more dynamic commands, this helper creates a high-risk RCE primitive.

Content

Scanner excerpt · scripts/full_pipeline.py (reported line 48)May include surrounding context.

python
def run_cmd(cmd, cwd=None):
    """执行 shell 命令"""
    result = subprocess.run(
        cmd, shell=True, capture_output=True, text=True, cwd=cwd
    )
    if result.returncode != 0:

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

This command string is built with file-system values and launched with shell=True, which makes the fallback OCR/LibreOffice path an unnecessary command-execution surface. Because the pipeline handles attacker-controlled filenames and document paths, exploitation could lead to arbitrary command execution under the skill's privileges.

Content

Scanner excerpt · scripts/full_pipeline.py (reported line 270)May include surrounding context.

python
shutil.copy(revised_path, tmp_input)
                # 使用 LibreOffice 转换为 PDF 再转回 docx(会丢失修订痕迹)
                cmd = f'libreoffice --headless --convert-to docx --outdir "{tmpdir}" "{tmp_input}" 2>/dev/null'
                result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
                if result.returncode == 0:
                    converted = Path(tmpdir) / tmp_input.stem.replace('-审查版', '') / '.docx'
                    if converted.exists():

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This markdown file states that review output is written directly into Word documents via Track Changes, which is a file-modifying behavior affecting user data. The README presents this as a feature but does not include any caution about preserving originals, reviewing changes before saving, or possible document modification side effects.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

Generating a clean version by accepting all modifications can materially alter legal documents and remove visibility into prior edits. The README does not warn users to verify proposed revisions before producing or using the clean version.

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 capabilities such as file read/write, shell execution, and environment access, but it does not declare any explicit tool scope or permission boundaries. In a skill that processes user-supplied documents and may invoke OCR or office tooling, missing scope declarations increases the chance of over-privileged execution, unintended file access, or unsafe command use.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The description states the skill is a '中文合同审核 Skill', and the introduction repeats that it is for Chinese contract review, but the file does not present this as an optional language/locale setting or explain a narrow compliance-bound restriction. Under the policy, forcing a specific language without user opt-in is a natural-language policy issue.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

A skill that may directly modify uploaded legal documents and generate accepted-change clean copies should warn users clearly about destructive or integrity-affecting operations. Without a prominent warning, users may unintentionally overwrite originals, accept inaccurate edits, or circulate altered contracts believing they remain untouched.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill description and default workflow are broadly scoped to 'review input contracts' without clear trigger constraints, input boundaries, or conditions for when the skill should activate. In an agent environment, this can cause over-invocation on loosely related documents or user requests, increasing the chance of unintended handling of sensitive legal content and unauthorized modification/report generation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill metadata hardcodes Chinese-language operation in the display and short description without indicating that language selection depends on user preference. This can lead to responses, annotations, or legal-review outputs being produced in Chinese when the user or source contract expects another language, causing misunderstanding, review errors, and unsafe legal reliance.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
82% confidence
Finding

The skill content is entirely in Chinese, including the clause name, clause text, and guidance, with no indication that language selection is optional or that the skill is explicitly limited to Chinese-language users. Under the stated policy, forcing a specific language without user opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The clause hard-codes PRC mainland law as the governing law for all contracts and explicitly excludes Hong Kong, Macau, and Taiwan, without reflecting that governing-law selection depends on contract type, party location, and whether the transaction is domestic or cross-border. In a contract-review skill, this can mislead users into applying an inappropriate default, creating legal/compliance risk and producing invalid or commercially harmful contract language for deals that should allow user choice or jurisdiction-specific review.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The manifest values and clause text are entirely in Chinese, including the skill name, guidance, and legal references, with no indication that this file is intentionally limited to Chinese-language or China-jurisdiction use. Under the policy, a language or locale constraint should either offer user choice or be clearly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This manifest contains user-facing fields such as the clause name, clause text, and position tips entirely in Chinese. Under the policy, forcing a specific language without user opt-in or a documented justification is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This manifest-like JSON file contains all user-facing content exclusively in Chinese, including the skill name, clause text, negotiation tips, and legal reference context, with no indication that the skill is region-specific or that users can choose another language. Under the policy rule for natural-language constraints, this constitutes a locale/language restriction that is not explicitly justified or offered as an opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This JSON clause file presents all user-facing content exclusively in Chinese, including the clause name, clause text, position tips, and legal reference. Under the policy rule for natural-language violations, a skill that fixes a language/locale without user opt-in or explicit region-specific justification should be flagged.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This JSON file contains all user-facing content in Chinese, including the clause name, clause text, tips, and legal reference, without any indication that the skill is region-specific or that users can choose another language. Under the language/locale policy, forcing a specific language without opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The skill content, including the clause name, clause text, guidance, and legal reference, is entirely in Chinese and tied to Chinese law, but the file does not explicitly document that it is a China-specific or Chinese-language-only clause resource. This can violate language/locale policy because it imposes a specific language and jurisdiction without user opt-in or a stated scope constraint.

Content

No source excerpt is available for this finding.