Back to skill

Security audit

基金月报信息提取

Security checks for vulnerabilities and agentic risk

Overview

The skill appears to process fund PDFs into Excel locally, but it needs review because its instructions overstate what the scripts do and allow broad or automatic file processing without tight confirmation.

Install only if you are comfortable giving the skill access to the specific PDFs, Excel templates, ZIPs, or folders you choose. Use a copy of your workbook, avoid broad folders, do not rely on automatic timeout processing, verify the generated financial data manually, and install dependencies in an isolated environment with trusted, pinned packages and verified OCR/PDF tools.

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

Warning
Location
scripts/auto_update_final.py:38
Finding
Unbounded ZIP Extraction Enables Resource Exhaustion## Vulnerability Details **File Location**: `scripts/auto_update_final.py`, lines 38-55 **Vulnerability Type**: Unrestricted archive extraction and resource exhaustion **Risk Level**: Medium **Vulnerable Code:** ```python temp_dir = tempfile.mkdtemp() try: with zipfile.ZipFile(zip_path, 'r') as zip_ref: zip_ref.extractall(temp_dir) excel_files = [ f for f in Path(temp_dir).rglob('*.xlsx') if not f.name.startswith('._') ] if not excel_files: return None, "Excel file not found" excel_path = excel_files[0] pdf_files = [ f for f in Path(temp_dir).rglob('*.pdf') if not f.name.startswith('._') ] if not pdf_files: return None, "PDF file not found" ``` ### Technical Analysis The Skill extracts every member of a user-controlled ZIP archive before validating the archive's entry count, expanded size, compression ratio, member type, or available storage. The subsequent recursive scans also traverse the entire extracted directory. A highly compressed archive can contain a very large expanded payload while remaining small enough to upload. Extraction can consume all available disk space, and recursive scanning or later parsing can consume substantial CPU and memory. Temporary-directory cleanup in the `finally` block only occurs after extraction terminates or raises an exception; it does not prevent resource exhaustion while extraction is underway. This behavior is not necessary for the declared functionality. The Skill only needs an Excel workbook and PDF reports, so it should reject unrelated entries and enforce strict archive quotas before writing files. ### Attack Path 1. An attacker creates a ZIP archive containing a very large number of entries or files with an extreme compressed-to-uncompressed size ratio. 2. The attacker submits the archive through the Skill's supported ZIP-processing workflow. 3. `zip_ref.extrac ...[truncated 817 chars]
Remediation
## Remediation Suggestions 1. Inspect every `ZipInfo` member before extraction. 2. Reject archives exceeding a conservative maximum entry count, total declared uncompressed size, individual file size, or compression ratio. 3. Allow only the required `.xlsx` and `.pdf` file types and reject links, devices, encrypted entries, and unexpected archive members. 4. Resolve each destination path and verify that it remains inside the temporary extraction directory before writing. 5. Extract members incrementally while tracking the actual number of bytes written; stop immediately when a quota is exceeded. 6. Apply process-level limits for disk usage, memory, CPU time, file count, and execution time. 7. Parse PDFs and workbooks in an isolated, non-privileged worker or container. 8. Return a clear validation error when an archive violates any configured limit.

T08 · Insecure Dependencies

Warning
Location
references/ocr_rules.md:315
Finding
Mutable Dependencies and Third-Party Binary Download Guidance Create Supply-Chain Risk## Vulnerability Details **File Location**: `references/ocr_rules.md`, lines 315-334; related dependency declarations in `requirements.txt`, lines 1-7 **Vulnerability Type**: Unpinned dependencies and unsafe executable acquisition guidance **Risk Level**: Medium **Vulnerable Code and Instructions:** ```text # requirements.txt pdfplumber>=0.7.0 openpyxl>=3.0.0 pytesseract>=0.3.10 Pillow>=9.0.0 ``` ```bash pip install pdfplumber openpyxl pdf2image pytesseract Pillow # Ubuntu/Debian sudo apt-get install tesseract-ocr tesseract-ocr-chi-sim poppler-utils # macOS brew install tesseract tesseract-lang poppler # Windows # Download Tesseract: https://github.com/UB-Mannheim/tesseract/wiki # Download Poppler: https://blog.alivate.com.au/poppler-windows/ # Add the binaries to the system PATH ``` ### Technical Analysis The Python dependencies use open-ended minimum-version constraints and are installed without a lockfile or cryptographic hashes. Consequently, installations performed at different times can resolve to different package versions that were not part of this audit. The Windows instructions additionally direct users to obtain Poppler through a third-party blog. The documentation does not specify an exact release, expected checksum, signature, or trusted package-manager source. Tesseract and Poppler are executable components invoked during document processing, so replacing either binary can result in arbitrary code execution with the privileges of the user running the Skill. No evidence shows that the current named Python packages or linked resources are malicious. The vulnerability is the absence of version and artifact integrity controls, which leaves the effective executable supply chain mutable after review. ### Attack Path 1. A user follows the Skill's dependency-installation instructions. 2. The package resolver selects a future or otherwise unreviewed version because only minimum versions are ...[truncated 1306 chars]
Remediation
## Remediation Suggestions 1. Pin every Python dependency to an explicitly reviewed version. 2. Generate a lockfile and require cryptographic hashes, such as with `pip --require-hashes`. 3. Include `pdf2image` in the authoritative dependency file if it is genuinely required; otherwise remove instructions that claim it is mandatory. 4. Use isolated virtual environments rather than global Python installations. 5. Replace third-party binary download guidance with an official project release, signed operating-system repository, or reputable package-manager source. 6. Document the exact approved Tesseract and Poppler versions, download origins, SHA-256 checksums, and signature-verification procedure. 7. Avoid adding broadly writable directories ahead of trusted system locations in `PATH`. 8. Run OCR and PDF conversion under a non-privileged account in a sandbox with restricted file and network access. 9. Establish a dependency-update process that repeats security review and testing before changing pinned versions.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (34)

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding
声明的核心能力包括:自动学习Excel模板、从PDF月报提取数据、生成两份Excel,并支持单文件上传和批量处理文件夹。实际代码确实会从PDF中提取部分基金数据并写入Excel,也支持两种输入模式(ZIP包或Excel+PDF目录),与“从PDF提取数据”部分基本一致。但关键功能存在明显不符:第一,模板不是自动学习得到,而是从 references/extraction_templates.json 静态加载;第二,输出只有一个“已更新.xlsx”文件,没有生成两份Excel;第三,所谓批量处理更像是在一个ZIP或目录内扫描多个PDF并更新单个Excel,而不是声明中更通用的单文件上传/文件夹批量处理与双结果生成。因此描述与代码行为存在实质性不匹配。

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
声明描述的是一个较完整的月报提取与模板学习工具,包含文件夹批处理、自动学习Excel模板、从PDF提取数据并生成两份Excel结果。实际代码并未实现这些核心能力。它没有扫描文件夹或批量目录处理逻辑,只处理传入的文件路径列表;没有任何模板学习或动态识别Excel结构的机制,更新位置完全写死在特定行列;输出也只有一个复制并更新后的Excel文件,而非两份Excel。此外,PDF解析函数主要针对特定格式提取日期、久期和YTM,行业/区域/信用等数据并不能自动完整提取,还依赖manual_data。整体上,实际代码是“按固定模板更新基金月度Excel”的专用脚本,与声明中的通用自动提取/模板学习/双Excel生成存在明显不符。

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
| Risk | Level | Mitigation |
|------|-------|------------|
| pip install from PyPI | 🟡 Medium | All packages are well-known, official packages |
| System dependencies | 🟡 Medium | Requires sudo for apt-get install |
| Binary downloads | 🟡 Medium | tesseract and poppler are official packages |

### Recommendations
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
| Risk | Level | Mitigation |
|------|-------|------------|
| pip install from PyPI | 🟡 Medium | All packages are well-known, official packages |
| System dependencies | 🟡 Medium | Requires sudo for apt-get install |
| Binary downloads | 🟡 Medium | tesseract and poppler are official packages |

### Recommendations
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
| Risk | Level | Mitigation |
|------|-------|------------|
| pip install from PyPI | 🟡 Medium | All packages are well-known, official packages |
| System dependencies | 🟡 Medium | Requires sudo for apt-get install |
| Binary downloads | 🟡 Medium | tesseract and poppler are official packages |

### Recommendations
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
| Risk | Level | Mitigation |
|------|-------|------------|
| pip install from PyPI | 🟡 Medium | All packages are well-known, official packages |
| System dependencies | 🟡 Medium | Requires sudo for apt-get install |
| Binary downloads | 🟡 Medium | tesseract and poppler are official packages |

### Recommendations
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
- **Temporary files:** PDF to image conversions stored in `/tmp/` (auto-cleaned)
- **Output files:** Excel files in user-specified locations
- **No hidden files:** Does not create hidden files or modify system configs

### Privilege Requirements
Confidence
60% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Session Persistence

Medium
Category
Rogue Agent
Content
- **Temporary files:** PDF to image conversions stored in `/tmp/` (auto-cleaned)
- **Output files:** Excel files in user-specified locations
- **No hidden files:** Does not create hidden files or modify system configs

### Privilege Requirements
Confidence
65% 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.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
**System dependencies (manual install required):**
```bash
# Ubuntu/Debian
sudo apt-get install tesseract-ocr tesseract-ocr-chi-sim poppler-utils

# macOS
brew install tesseract tesseract-lang poppler
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
**System dependencies (manual install required):**
```bash
# Ubuntu/Debian
sudo apt-get install tesseract-ocr tesseract-ocr-chi-sim poppler-utils

# macOS
brew install tesseract tesseract-lang poppler
Confidence
70% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Lp3

Medium
Category
MCP Least Privilege
Confidence
85% confidence
Finding
The skill advertises capabilities that involve reading folders and generating Excel files, but it does not declare any explicit tool scope such as allowed-tools or permissions. This creates an authorization ambiguity where a host agent may permit broader file read/write behavior than users expect, especially because the skill explicitly supports local folder scanning and output generation.

Vague Triggers

Medium
Confidence
91% confidence
Finding
Using a common phrase like “好了” or “开始处理” as the trigger to begin processing is risky because such language can appear naturally in conversation or be embedded in uploaded content. In a skill that reads files and writes Excel outputs, ambiguous activation can cause unintended processing, including premature file access or file generation.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The skill description encourages users to provide a local folder path and implies automatic scanning and Excel generation, but it does not warn that this involves reading local files and writing new files. That omission weakens informed consent and increases the chance of overbroad filesystem access or unexpected modification of user data.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The skill description does not clearly warn users that providing a folder path causes bulk reading of all PDFs, possible reuse of an Excel file in that folder as a template, and creation of new Excel outputs in the source or remote output directory. This lack of transparency undermines informed consent and can lead to unexpected disclosure, modification workflows, or accidental use of sensitive Excel files as templates.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The trigger logic is broad enough to activate on generic mentions of folder paths or batch processing, which can cause the skill to read and process an entire directory when the user may not have intended that scope. In this skill, unintended activation is more dangerous because the documented workflow scans all PDFs, inspects Excel files as possible templates, and writes output files, increasing the risk of over-collection and unintended file handling.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The file is entirely written in Chinese and presents the mapping rules as mandatory instructions, with no indication 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 opt-in is a natural-language locale violation.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The trigger list includes overly broad phrases such as “处理”, which can easily appear in normal conversation and may cause the skill to start processing before the user intended. In a multi-file upload workflow, this creates a genuine risk of acting on incomplete inputs and producing incorrect or partial output files without explicit confirmation.

Vague Triggers

Medium
Confidence
96% confidence
Finding
Automatically starting processing after 30 seconds of inactivity is ambiguous because silence does not reliably indicate consent or completion. Users may pause while gathering files, experience network delay, or step away temporarily, causing the system to process an incomplete set of documents and generate inaccurate outputs.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The workflow permits automatic processing of uploaded files without a strong, explicit warning that processing may begin before all intended files are received. This can lead users to unknowingly trigger extraction on incomplete uploads, which is especially problematic for a batch document-processing skill where correctness depends on receiving the full set.

Natural-Language Policy Violations

Medium
Confidence
87% confidence
Finding
The example code hard-codes `lang='chi_sim+eng'`, and later the document defines OCR language as Simplified Chinese plus English. This imposes a specific language/locale configuration without any user opt-in or explanation that the skill is limited to Chinese/English documents only.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The documented behavior allows the system to automatically expand a user-provided Excel template by adding a new month column when more PDFs are supplied than the template anticipated. This changes the output structure without explicit user approval, which can silently break downstream workflows, invalidate expected formulas/references, or produce misleading reports that appear template-compliant when they are not.

Natural-Language Policy Violations

Medium
Confidence
92% confidence
Finding
The file's top-level docstring and user-facing CLI messages are written only in Chinese, which indicates a fixed language choice. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly justified.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The file’s natural-language interface and instructions are entirely in Chinese, including the top-level description and dependency guidance, with no indication that users may choose another language. Under the policy, forcing a specific language without opt-in is a natural-language policy violation unless the locale constraint is explicitly documented and justified.

Natural-Language Policy Violations

Low
Confidence
82% confidence
Finding
All natural-language instructions and examples in the skill are presented only in Chinese, with no indication that users may choose another language or that the skill is intentionally restricted to a Chinese-speaking context. Under the stated policy, forcing a specific language without opt-in can be a locale-policy issue.

Natural-Language Policy Violations

Low
Confidence
80% confidence
Finding
This JSON file uses Chinese-only natural-language labels and descriptions throughout, including the top-level description and extraction field names, with no indication that the skill is region-specific or that users can opt into another language. Under the language/locale policy, forcing a specific language without opt-in can be a natural-language policy concern.

Static analysis

No suspicious patterns detected.