Back to skill

Security audit

IPO Review

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent local IPO filing review tool, but users should treat generated CSV reports and unpinned dependency installs with normal caution.

Install only in an environment where local IPO materials may be processed. Review or pin dependencies before use, especially when handling third-party documents. Treat generated CSV files as containing untrusted source-document text and avoid opening them with spreadsheet formula execution enabled unless the CSV writer is hardened.

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
src/html_reporter.py:373
Finding

Spreadsheet Formula Injection in Generated CSV Reports

Content
View full analysis

Vulnerability Details

File Location: src/html_reporter.py:373-379; duplicate vulnerable writer at main.py:274-280
Vulnerability Type: CSV/spreadsheet formula injection
Risk Level: Medium

Vulnerable Code

src/html_reporter.py:373-379:

python
def _write_csv(path: Path, rows: list[dict]) -> None:
    import csv
    keys = sorted({k for row in rows for k in row}) if rows else ["empty"]
    with path.open("w", newline="", encoding="utf-8-sig") as f:
        writer = csv.DictWriter(f, fieldnames=keys)
        writer.writeheader()
        writer.writerows(rows)

main.py:274-280:

python
def _write_csv(path: Path, rows: list[dict]) -> None:
    import csv
    keys = sorted({k for row in rows for k in row}) if rows else ["empty"]
    with path.open("w", newline="", encoding="utf-8-sig") as f:
        writer = csv.DictWriter(f, fieldnames=keys, extrasaction="ignore")
        writer.writeheader()
        writer.writerows(rows)

Untrusted document-derived data enters exported records through code such as src/fact_extractor.py:95-128:

python
fact = FinancialFact(
    fact_id=f"F{len(facts)+1:06d}",
    metric=segment.metric_canonical_exact,
    raw_metric=segment.metric_alias,
    metric_canonical_exact=segment.metric_canonical_exact,
    metric_category=segment.metric_category,
    raw_value=raw,
    raw_value_text=raw,
    value=value,
    currency="人民币",
    raw_unit=raw_unit,
    unit_source=unit_source,
    unit_confidence=UNIT_CONFIDENCE.get(unit_source, 0.0),
    unit=raw_unit,
    period=period,
    period_exact=period_exact,
    period_type=period_type,
    scope=_scope(haystack, ev.filename),
    subject="发行人",
    category=_category(ev),
    value_type=value_type,
    is_percent=value_type in {"percent", "percentage_point"},
    is_calculated=segment.is_calculated,
    source_doc_id=ev.doc_id,
    filename=ev.filena
...[truncated 3181 chars]
Remediation
View remediation

Remediation Suggestions

Introduce a single centralized CSV-cell sanitizer and apply it to every value written by both CSV writer implementations.

  1. Treat any string beginning with =, +, -, or @ as potentially dangerous.
  2. Account for leading tabs, carriage returns, newlines, and other whitespace that spreadsheet applications may ignore before formula evaluation.
  3. Prefix dangerous values with an apostrophe or another spreadsheet-compatible text marker.
  4. Preserve numeric Python values as numbers; sanitize only string fields.
  5. Apply the protection consistently to financial_facts.csv, comparison_exclusions.csv, caliber_notes.csv, arithmetic_skips.csv, parse_errors.csv, and unparsed_items.csv.
  6. Add regression tests covering every formula prefix and leading-whitespace bypass.
  7. Document that CSV reports contain untrusted source-document content and should not be opened with formula execution enabled.

Example hardening implementation:

python
FORMULA_PREFIXES = ("=", "+", "-", "@")

def _safe_csv_cell(value):
    if not isinstance(value, str):
        return value

    candidate = value.lstrip(" \t\r\n")
    if candidate.startswith(FORMULA_PREFIXES):
        return "'" + value
    return value

def _sanitize_csv_rows(rows: list[dict]) -> list[dict]:
    return [
        {key: _safe_csv_cell(value) for key, value in row.items()}
        for row in rows
    ]

def _write_csv(path: Path, rows: list[dict]) -> None:
    import csv

    safe_rows = _sanitize_csv_rows(rows)
    keys = sorted({k for row in safe_rows for k in row}) if safe_rows else ["empty"]
    with path.open("w", newline="", encoding="utf-8-sig") as f:
        writer = csv.DictWriter(f, fieldnames=keys, extrasaction="ignore")
        writer.writeheader()
        writer.writerows(safe_rows)

The separate writer in src/document_parser.py should use the same sanitizer rather than maintaining an independen ...[truncated 23 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (21)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill instructs the agent to inspect local directories, read input materials, generate outputs, and potentially install dependencies and execute a local Python program, but it does not declare an explicit tool scope such as permissions or allowed-tools. This creates a mismatch between documented behavior and enforceable constraints, increasing the risk that an agent can access or modify files more broadly than intended during operation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This YAML file contains natural-language labels and terms only in Chinese, such as issue levels and stock review phrases, with no indication that the skill is intended solely for Chinese-speaking users or that users can opt into this locale. Under the policy, forcing a specific language without user choice or 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
97% confidence
Finding

The extractor relies on Chinese-specific date and reporting phrases such as "截至", "报告期", and later hard-codes Chinese outputs like currency and scope labels. This enforces a specific language/locale behavior in the skill logic with no indication that users can choose another language or that the tool is intentionally limited to a China-specific context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This file constructs multiple user-facing strings entirely in Chinese, including the analysis, category, conclusion, basis, and suggestion fields. Because the skill does not offer language selection or document that it is intentionally limited to a Chinese-language workflow, it risks violating language/locale policy requirements.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The role names are defined entirely in Chinese string literals such as '招股说明书' and '审计报告及财务报表', which creates a fixed locale assumption in the skill configuration. There is no indication that users can opt into this language or that the skill is explicitly limited to a Chinese-language regulatory context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

This manifest-style YAML file defines all metric names and aliases exclusively in Chinese, which can enforce a specific language/locale behavior if consumed directly by the skill. Under the policy, locale-specific behavior should either offer user choice or clearly document and justify the constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The rounding keys use Chinese currency/unit labels (元, 千元, 万元, 亿元), which imposes a specific language/locale in the skill configuration. For a rule that applies to all file types, this can be a natural-language locale policy issue when no user choice or justification is provided in the file.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

The dependency is specified with a lower bound only, which allows installation of different future releases and makes builds non-reproducible. In a skill that parses untrusted IPO source files locally, dependency drift can introduce vulnerable or breaking versions without review, increasing supply-chain risk.

Content

Scanner excerpt · requirements.txt (reported line 1)May include surrounding context.

text
pymupdf>=1.24.0
python-docx>=1.1.0
openpyxl>=3.1.0
pytest>=8.0.0

Unverifiable Dependency: pymupdf has 2 known advisory(ies) (CVE-2026-3029 (PyMuPDF has a path traversal in _main_.py); CVE-2026-3029 (PyMuPDF has a path traversal in _main_.py)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
88% confidence
Finding

PyMuPDF has referenced advisories, and because the manifest does not pin a version, it is impossible to verify whether the installed release is patched. In this skill's context, a document-processing library with unresolved version state is more concerning because it may be exposed to untrusted filing materials, potentially enabling file-handling or parser-related attacks.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

Using python-docx with only a minimum version permits unreviewed future versions to be installed, preventing reproducible environments and weakening dependency integrity. Because this skill processes document files, parser-library changes can materially affect security exposure if a bad release is pulled in.

Content

Scanner excerpt · requirements.txt (reported line 2)May include surrounding context.

text
pymupdf>=1.24.0
python-docx>=1.1.0
openpyxl>=3.1.0
pytest>=8.0.0

Unverifiable Dependency: python-docx has 2 known advisory(ies) (CVE-2016-5851 (Improper Restriction of XML External Entity Reference in python-docx); CVE-2016-5851 (python-docx before 0.8.6 allows context-dependent attackers to conduct XML Exter)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
87% confidence
Finding

python-docx has known historical XXE-related advisories, and without an exact version pin there is no assurance that deployments avoid affected releases. Since the skill reviews office-style documents locally, use of a possibly vulnerable XML-parsing library raises risk when processing externally supplied materials.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

The openpyxl requirement is not pinned, so deployments may resolve to different versions over time. For a tool handling spreadsheet inputs, this creates avoidable supply-chain and parser-surface risk because vulnerable or behavior-changing versions may be installed unexpectedly.

Content

Scanner excerpt · requirements.txt (reported line 3)May include surrounding context.

text
pymupdf>=1.24.0
python-docx>=1.1.0
openpyxl>=3.1.0
pytest>=8.0.0

Unverifiable Dependency: openpyxl has 2 known advisory(ies) (CVE-2017-5992 (Improper Restriction of XML External Entity Reference in Openpyxl); CVE-2017-5992 (Openpyxl 2.4.1 resolves external entities by default, which allows remote attack)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
87% confidence
Finding

openpyxl has known XXE-related advisories, but the unpinned requirement prevents verifying whether the resolved version is safe. Because this skill is intended to inspect spreadsheet-based filing data, feeding untrusted XLSX content into a potentially affected parser could increase the attack surface.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
90% confidence
Finding

pytest is also unpinned, which reduces reproducibility and may pull in unexpected versions during development or CI. While primarily a test dependency, compromised or vulnerable tooling can still affect developer environments and pipelines.

Content

Scanner excerpt · requirements.txt (reported line 4)May include surrounding context.

text
pymupdf>=1.24.0
python-docx>=1.1.0
openpyxl>=3.1.0
pytest>=8.0.0

Unverifiable Dependency: pytest has 2 known advisory(ies) (CVE-2025-71176 (pytest has vulnerable tmpdir handling); CVE-2025-71176 (pytest has vulnerable tmpdir handling)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
75% confidence
Finding

pytest has an advisory listed, and the lack of version pinning means the environment may resolve to an affected version. This is less dangerous than runtime parser dependencies because pytest is typically used in development, but it can still impact CI systems or developer workstations if vulnerable tooling is executed.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

This file embeds Chinese-only keywords for table classification and later emits Chinese-language conclusions, warnings, and suggestions. That creates a locale-specific behavior with no indication of user choice or documented justification in the file, which can violate the language/locale policy for skills expected to operate generally.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The warning messages appended by _skip and the issue content created later are all Chinese-language strings, but the file provides no mechanism for selecting or negotiating output language. If this skill is used in a broader multilingual environment, it would force a specific language without opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The file hardcodes metric names, categories, and document role labels entirely in Chinese string literals, which effectively constrains the skill's language/locale behavior. Under the policy, forcing a specific language without offering user choice or documenting a justified regional constraint can be a natural-language policy concern.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

The function writes a CSV file to the provided path, which is a filesystem-modifying operation. In this file there is no confirmation prompt, logging/print disclosure, or explanatory comment/docstring warning the caller that unparsed document details will be written to disk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The code contains hard-coded Chinese strings for default role names and version labels ("其他文件", "修订/更新版", "普通版") with no indication that the user can choose or opt into this locale. This can create a language policy issue if the skill is expected to be locale-neutral or user-selectable.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The comparable_key property hard-codes Chinese strings such as "发行人", "模糊期间", "未知属性", "未明口径", "未分类", and "人民币" as default values. This imposes a specific language/locale in user-visible or downstream text generation logic without offering a language choice or documenting a justified locale constraint.

Content

No source excerpt is available for this finding.