Back to skill

Security audit

read-gbk

Security checks for vulnerabilities and agentic risk

Overview

This local file-reading skill is mostly coherent, but it automatically installs unpinned Python packages at runtime when opening DOCX or PDF files.

Install only if you are comfortable running it in a controlled Python environment. Prefer a virtual environment or container, preinstall reviewed and pinned versions of python-docx and pypdf, and avoid using it on credentials, private records, or other sensitive files unless you are comfortable with their contents being printed into the agent transcript or logs.

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
scripts/read-file.py:55
Finding

Automatic Runtime Installation of Unpinned Third-Party Dependencies

Content
View full analysis

Vulnerability Details

File Location: scripts/read-file.py:55-69 and scripts/read-file.py:85-99
Vulnerability Type: Runtime installation of unpinned and unverified dependencies
Risk Level: Medium

Vulnerable Code

scripts/read-file.py:55-69:

python
try:
    from docx import Document
except ImportError:
    print(f"[自动安装] 检测到 python-docx 未安装,正在安装...", file=sys.stderr)
    import subprocess
    
    # 获取当前 Python 的 pip 路径
    pip_cmd = [sys.executable, '-m', 'pip', 'install', 'python-docx', '-q']
    
    try:
        subprocess.run(pip_cmd, check=True, capture_output=True)
        print(f"[自动安装] python-docx 安装成功", file=sys.stderr)
        from docx import Document
    except subprocess.CalledProcessError as e:
        raise ImportError(
            f"python-docx 安装失败:{e.stderr.decode('utf-8', errors='ignore') if e.stderr else str(e)}\n"
            f"请手动安装:{sys.executable} -m pip install python-docx"
        )

scripts/read-file.py:85-99:

python
try:
    from pypdf import PdfReader
except ImportError:
    print(f"[自动安装] 检测到 pypdf 未安装,正在安装...", file=sys.stderr)
    import subprocess
    
    # 获取当前 Python 的 pip 路径
    pip_cmd = [sys.executable, '-m', 'pip', 'install', 'pypdf', '-q']
    
    try:
        subprocess.run(pip_cmd, check=True, capture_output=True)
        print(f"[自动安装] pypdf 安装成功", file=sys.stderr)
        from pypdf import PdfReader
    except subprocess.CalledProcessError as e:
        raise ImportError(
            f"pypdf 安装失败:{e.stderr.decode('utf-8', errors='ignore') if e.stderr else str(e)}\n"
            f"请手动安装:{sys.executable} -m pip install pypdf"
        )

Technical Analysis

When a user opens a DOCX or PDF file and the corresponding parser is unavailable, the skill invokes pip automatically. The package names are not constrained to reviewed versions, and no package hashes or trusted repository URL ...[truncated 2066 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove automatic package installation from document-reading functions. If a parser is unavailable, fail safely and provide explicit setup instructions.
  2. Install dependencies during a controlled build or deployment phase rather than while processing user-selected files.
  3. Pin each dependency and relevant transitive dependencies to reviewed versions.
  4. Require hashes, for example through a locked requirements file installed with pip install --require-hashes.
  5. Configure pip to use an explicitly trusted package repository and prevent unreviewed alternate indexes.
  6. Install dependencies inside a dedicated virtual environment or container instead of modifying the caller's global Python environment.
  7. Run the skill under a least-privileged account with restricted filesystem and network access.
  8. Add automated dependency vulnerability scanning and a controlled process for reviewing and updating pinned versions.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (15)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared purpose says the skill reads local text files with GBK/UTF-8 detection, but the documented behavior expands to reading DOCX/PDF and automatically installing third-party packages via pip. This mismatch is dangerous because it hides environment modification and additional parsing capabilities from users and security reviewers, which can lead to unexpected code execution paths, dependency risk, and broader data exposure than advertised.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The implementation materially exceeds the declared capability: it processes DOCX/PDF files and can install software at runtime, while the metadata describes local text reading with encoding detection. This mismatch undermines operator trust and can bypass policy decisions that would have been different had the broader capabilities been disclosed.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

Spawning pip to auto-install python-docx is unjustified for a simple file-reading utility and introduces external package retrieval and code execution into the runtime path. In a skill context, this is more dangerous because users may expect only local file access, not environment mutation or network-backed dependency installation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

Auto-installing pypdf via pip adds a hidden capability that can modify the system and execute unreviewed third-party package code. This is especially risky because the skill's apparent role is local document reading, so the extra behavior is likely to be unexpected by reviewers and operators.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding

The skill exposes file reading, shell execution, and environment-dependent behavior but does not declare any explicit tool scope or permissions boundary. This is dangerous because a caller or reviewer cannot easily tell that the skill may execute commands and access local files, increasing the risk of over-broad use and accidental access to sensitive data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill reads arbitrary local files and prints their contents to stdout, but it does not clearly warn that sensitive information may be exposed in terminal logs, agent transcripts, or downstream consumers. In an agent context, stdout is often captured and propagated, so reading local documents, configs, logs, or medical/project files can unintentionally leak confidential data.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This code's natural-language content, including the header comment, usage text, and error/help output, is entirely in Chinese. Under the stated policy, forcing a specific language without user opt-in or a documented regional justification is a language/locale policy violation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The function documentation says it reads DOCX files, but the actual behavior also installs python-docx if it is missing. This omission hides a side effect that changes the environment and may lead users to execute the skill under false assumptions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script installs python-docx automatically without prior user confirmation. Automatic package installation can fetch and run dependency code unexpectedly, modify the host environment, and violate least surprise and change-control expectations.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
95% confidence
Finding

The script invokes pip at runtime to install a package automatically when reading a DOCX file. Even though the command is not shell-injected, it introduces unexpected code execution and network/package-supply-chain risk for a skill whose stated purpose is local file reading.

Content

Scanner excerpt · scripts/read-file.py (reported line 65)May include surrounding context.

python
pip_cmd = [sys.executable, '-m', 'pip', 'install', 'python-docx', '-q']
        
        try:
            subprocess.run(pip_cmd, check=True, capture_output=True)
            print(f"[自动安装] python-docx 安装成功", file=sys.stderr)
            from docx import Document
        except subprocess.CalledProcessError as e:

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The function claims to read PDFs but also performs package installation when pypdf is unavailable. Hidden side effects reduce transparency and can cause operators to permit a skill that is more privileged and invasive than documented.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script installs pypdf automatically and silently as part of processing a file. This is dangerous because it couples user input handling with package acquisition and execution, increasing supply-chain exposure and making behavior harder to audit.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
95% confidence
Finding

The script invokes pip at runtime to install pypdf automatically when reading a PDF file. This expands the skill from passive file access to fetching and executing third-party code, creating supply-chain and unauthorized-environment-modification risk.

Content

Scanner excerpt · scripts/read-file.py (reported line 95)May include surrounding context.

python
pip_cmd = [sys.executable, '-m', 'pip', 'install', 'pypdf', '-q']
        
        try:
            subprocess.run(pip_cmd, check=True, capture_output=True)
            print(f"[自动安装] pypdf 安装成功", file=sys.stderr)
            from pypdf import PdfReader
        except subprocess.CalledProcessError as e:

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The manifest describes a local text-file reader with encoding detection, but this wrapper also inspects environment variables and enumerates likely Python installation locations. That host-environment discovery capability is not directly part of reading a text file and expands the skill's behavior beyond its stated purpose.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The script's docstring, usage text, and runtime messages are presented only in Chinese, which imposes a specific language on all users. There is no opt-in, locale detection, or alternative language path documented in the file.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.dangerous_exec

Shell command execution detected (child_process).

Critical
Code
suspicious.dangerous_exec
Location
scripts/read-file.js:27