Back to skill

Security audit

math-docx-typeset

Security checks for vulnerabilities and agentic risk

Overview

This is mostly a coherent math-to-Word conversion skill, but it needs review because it can route manuscript screenshots or formulas to external services without clear consent controls and installs unpinned Python dependencies.

Install only if you are comfortable with a Chinese-focused academic DOCX workflow. For confidential papers or unpublished research, avoid the screenshot OCR and public KaTeX paths unless you explicitly approve sending that content to external services. Use a pinned requirements file or sandboxed environment before running the dependency install.

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

T08 · Insecure Dependencies

Warning
Location
SKILL.md:91
Finding

Unpinned Third-Party Dependencies Permit Supply-Chain Substitution

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:91 and README.md:61
Vulnerability Type: Unpinned dependency installation
Risk Level: Medium

Vulnerable Code

SKILL.md:91:

bash
pip install latex2mathml mathml2omml python-docx matplotlib

README.md:61:

bash
pip install latex2mathml mathml2omml python-docx matplotlib

Technical Analysis

The documented installation command retrieves four Python packages without exact version constraints or cryptographic hashes. Although THIRD_PARTY.md identifies expected version families, those declarations are not enforced by the installation command.

Consequently, package resolution depends on the mutable state of the configured Python package index at installation time. A compromised upstream release, compromised package index, or malicious package served through an incorrectly configured index could be installed without a reproducible integrity check. Python packages may execute build backend or installation logic during installation, and their code is subsequently imported by scripts/latex2docx.py.

No evidence indicates that the currently named dependencies are malicious. The vulnerability is the absence of controls ensuring that users receive the reviewed dependency versions.

Attack Path

  1. An attacker compromises an upstream dependency release or a package index configured in the victim's pip environment.
  2. The victim or Agent follows the documented unpinned pip install command.
  3. Pip resolves the attacker-controlled package version because no exact version or hash is required.
  4. Malicious code executes through package build or installation behavior, or later when latex2docx.py imports the installed package.
  5. The malicious dependency operates with the privileges of the user running pip or the conversion script.

Impact Assessment

Successful exploitation could permit arbitrary code execution under the install ...[truncated 484 chars]

Remediation
View remediation

Remediation Suggestions

  1. Create a reviewed lock file or requirements file containing exact versions, for example:

    text
    latex2mathml==<reviewed-version>
    mathml2omml==<reviewed-version>
    python-docx==<reviewed-version>
    matplotlib==<reviewed-version>
    
  2. Generate and record SHA-256 hashes for every package and transitive dependency, then require them during installation:

    bash
    python -m pip install --require-hashes -r requirements.txt
    
  3. Pin transitive dependencies as well as direct dependencies so that the complete environment is reproducible.

  4. Use an explicitly trusted package index or an internally controlled artifact repository rather than inheriting an unknown pip configuration.

  5. Review dependency updates before changing pins, including package ownership, release history, source changes, and published artifacts.

  6. Run installation and conversion with a non-privileged account in a sandbox with restricted filesystem and network access.

  7. Update both SKILL.md and README.md to reference the secured requirements or lock file instead of installing unconstrained package names.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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 (13)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The entire skill documentation, invocation prompts, and command examples are presented only in Chinese, including the recommended trigger phrases and usage instructions. Under the policy, a skill that effectively requires a specific language without offering an opt-in or alternative can constitute a language/locale policy violation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README says the skill can take screenshots, perform "OCR + 视觉 read", consult a symbol table, and then generate a docx. However, the same file's installation and CLI sections list only latex2mathml, mathml2omml, python-docx, and matplotlib, with no OCR or vision component documented, indicating the claimed behavior exceeds the described code path for this skill.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger phrases are broad enough to match common requests like '生成 docx' or '写论文 docx', which could cause the skill to activate outside its intended narrow use case. Over-broad activation can route unrelated user content into a transformation workflow that reads local references and applies strong formatting rules, increasing the chance of unintended file handling or inappropriate task capture.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file is written entirely in Chinese and presents the skill guidance as mandatory instructions for use, without offering any language or locale choice. That can violate language/locale policy when users have not explicitly opted into Chinese-only behavior.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The documentation instructs the agent to use external OCR services for formula extraction from screenshots, which can transmit user-provided images and document content to third-party network services. For a skill focused on converting academic formulas into editable DOCX, this expands data exposure beyond the core local transformation purpose and may leak sensitive manuscript, research, or unpublished content.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The docstring states mandatory Chinese-specific preprocessing and uses Chinese font defaults, which imposes a locale/language convention rather than presenting it as optional behavior. Under the policy, forcing a specific language or locale 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
91% confidence
Finding

The argument definitions set the default font to 宋体 and describe sizing in Chinese typographic terms, which bakes in a Chinese locale preference. The policy allows locale constraints only when justified or user-selectable; here the natural-language interface does not present that as an opt-in choice.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

The manifest describes a skill whose purpose is converting LaTeX-containing academic text into editable OMML-based docx, optionally with an image-variant attachment. The README's table brings in a separate "Markdown→PDF(reportlab)" path, which is outside the stated scope of this skill and suggests broader document-generation behavior than the manifest claims.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The workflow mandates “GB/T 15834 引号预处理,” a Chinese typographic standard, as a required step. This is a locale-specific formatting policy, and the document does not indicate user choice or that it applies only when the user wants Chinese typesetting conventions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

This file contains user-facing natural-language content exclusively in Chinese, including the title and all explanatory text. Under the language/locale policy, forcing a specific language without opt-in or a documented justification can be a policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The document title and instruction text specify the skill guidance entirely in Chinese, and L003 says generated LaTeX must strictly follow this specification. This can be read as forcing a specific language/locale behavior without offering the user any language choice or opt-in.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
96% confidence
Finding

The guidance recommends validating formulas through the public KaTeX online website, which encourages copying potentially sensitive mathematical or manuscript content into an external internet service. This is not necessary for the stated DOCX conversion workflow because equivalent validation can be performed locally through the existing latex2docx chain or sandboxed renderers.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.