Back to skill

Security audit

PDF阅读服务

Security checks for vulnerabilities and agentic risk

Overview

This PDF skill is a third-party API client that stores an API key locally and sends PDF-related inputs to a remote service, with enough documentation mismatch and data-flow ambiguity to require review.

Install only if you are comfortable using XiaoBenYang as a remote backend for PDF tasks. Do not use it for confidential PDFs, private URLs, or sensitive search terms unless you trust that service and its data handling. Treat the stored API key as a plaintext local secret and avoid committing or sharing the .env file.

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

Lp3

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding
The skill advertises capabilities that imply environment access, file read/write, and network use, yet it declares no permissions or user-facing notice about those behaviors. This creates a transparency and consent gap: users and hosting platforms may not realize the skill can store secrets, read local files, fetch remote URLs, or make outbound requests.

Description-Behavior Mismatch

High
Confidence
97% confidence
Finding
The skill is presented as a PDF reader, but the mandatory workflow instead requires collecting an unrelated API key and calling a different service. This mismatch is dangerous because it can trick users into disclosing credentials under false pretenses and can route data to an unexpected backend unrelated to PDF processing.

Description-Behavior Mismatch

High
Confidence
96% confidence
Finding
The invocation guidance includes an unrelated school-search example and return-value handling centered on generic API JSON rather than PDF processing. This inconsistency increases the chance of wrong-tool invocation, user deception, and accidental disclosure of unrelated data flows hidden behind a benign PDF-reading description.

Intent-Code Divergence

Medium
Confidence
91% confidence
Finding
The documentation claims a simple PDF-reading skill, but the workflow text frames the model as a router to an API client and references a different service/project. That architectural mismatch obscures the actual data path and makes it harder for users to understand when files, URLs, or secrets may be transmitted externally.

Description-Behavior Mismatch

Medium
Confidence
94% confidence
Finding
The file advertises a PDF-reading capability, but this implementation is a generic proxy to an external MCP API selected by headers and caller-supplied parameters. In a skill context, this creates a capability mismatch and hidden data egress path: PDF contents, metadata, or user-supplied data could be sent off-platform to a third-party service without clear disclosure or scope limitation.

Context-Inappropriate Capability

Medium
Confidence
92% confidence
Finding
The client exposes a broadly reusable external tool invocation primitive via caller-controlled `tool_name`, `mcp_id`, and arbitrary `params`, rather than a narrowly scoped PDF operation. In an agent environment, such generic dispatch can be repurposed for unintended external actions or covert exfiltration, exceeding the trust users place in a PDF analysis skill.

Description-Behavior Mismatch

High
Confidence
94% confidence
Finding
The code adds credential persistence and mutation behavior that is unrelated to the stated PDF-reading purpose. It writes an API key into a local .env file and updates process environment state, creating unnecessary secret-handling capability that broadens the attack surface and can expose credentials through local file access, source packaging mistakes, or downstream tooling.

Context-Inappropriate Capability

High
Confidence
93% confidence
Finding
This section implements local secret storage and environment mutation despite the manifest describing a PDF reader/analyzer. Such capability is risky because it enables credential retention on disk and in process state without clear necessity, increasing the chance of unintended disclosure or misuse by other components running in the same environment.

Intent-Code Divergence

Medium
Confidence
77% confidence
Finding
The docstring identifies the code as a different '高考' skill, which conflicts with the declared PDF-reading identity. This mismatch is a supply-chain and trust concern because repurposed or transplanted configuration code can conceal unrelated capabilities and makes it harder for reviewers to validate that the file belongs to the advertised functionality.

Description-Behavior Mismatch

Medium
Confidence
92% confidence
Finding
The tool documentation and skill description present this as a PDF-reading service, but the function explicitly accepts HTTP/HTTPS URLs, which broadens the trust boundary from local file processing to remote network retrieval. This can enable unexpected outbound requests, remote content fetching, and possible access to sensitive internal resources if the backend follows attacker-controlled URLs.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
All PDF operations are forwarded to an external API via call_api, but the skill description frames the capability as a local PDF-reading service. This mismatch hides that local file paths, document contents, metadata, and search queries may leave the host environment, creating a significant confidentiality and trust-boundary issue.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The tool parameters allow PDF paths to be remote URLs, but the skill does not warn users that supplying a URL may trigger outbound network requests and send user-provided targets/data to external systems. This can expose sensitive document locations or internal URLs and may enable unintended remote fetching behavior.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The instruction to directly display raw API response data omits any warning that metadata and extracted text may contain confidential document contents, embedded personal data, or hidden fields. Presenting raw output without review or minimization can cause unnecessary disclosure of sensitive information.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The function persists the supplied API key to .env automatically and silently. This is dangerous because users may not realize their secret is being written to disk in plaintext, where it can later be exposed through backups, logs, accidental commits, or local compromise.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The read_pdf function sends the provided path to a backend API without warning the user that local file references or URL-based documents may be processed remotely. This can expose sensitive file locations or document contents to an external service contrary to user expectations.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The page-reading function appears narrow in scope, but it still routes selected PDF content through the external API without clear notice. Users may assume only local parsing occurs, while excerpts from potentially sensitive documents are actually sent off-box.

Missing User Warnings

Low
Confidence
88% confidence
Finding
Even metadata-only extraction can reveal sensitive information such as file names, authorship, creation dates, software versions, and local path context when sent to a backend service. The absence of disclosure makes this a real but lower-severity data exposure issue.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The search_pdf function can cause both document content and the user's search terms to be processed remotely, yet this is not clearly disclosed. Search terms themselves may be sensitive, and combining them with document data increases the privacy and confidentiality risk.

Ssd 3

Medium
Confidence
95% confidence
Finding
The skill instructs the model to collect a user API key and persist it, then later directly expose raw returned data, but it provides no safeguards for secure secret handling, storage scope, masking, or output filtering. In a skill that already shows identity mismatch, this significantly raises the risk of credential harvesting and sensitive-data leakage.

Ssd 3

Medium
Confidence
94% confidence
Finding
Directly presenting raw API response data can semantically disclose full PDF text, metadata, or backend-returned fields that the user did not intend to expose in full. This is especially risky for document-processing skills, where raw outputs often contain sensitive or proprietary content.

Credential Access

High
Category
Privilege Escalation
Content
default_year: int = 2025

    def model_post_init(self, __context):
        # 强制从 .env 文件读取 XBY_APIKEY
        env_path = Path(".env")
        if env_path.exists():
            content = env_path.read_text(encoding="utf-8")
Confidence
89% confidence
Finding
The code explicitly reads .env and extracts XBY_APIKEY in custom logic, bypassing normal settings handling and forcing credential ingestion. In the context of a PDF-reading skill, this is suspicious and unnecessarily expands secret access beyond what should be required for the advertised functionality.

Credential Access

High
Category
Privilege Escalation
Content
def model_post_init(self, __context):
        # 强制从 .env 文件读取 XBY_APIKEY
        env_path = Path(".env")
        if env_path.exists():
            content = env_path.read_text(encoding="utf-8")
            for line in content.splitlines():
Confidence
89% confidence
Finding
This line opens and reads the local .env file to access stored secrets. Direct secret-file reads increase the chance of unauthorized credential exposure, especially when the component's stated role is unrelated to credential management and when safer configuration abstractions already exist.

Credential Access

High
Category
Privilege Escalation
Content
def save_api_key_to_env(api_key: str) -> bool:
    """将API key保存到.env文件"""
    try:
        env_path = Path(".env")
        lines = []
        if env_path.exists():
            lines = env_path.read_text(encoding="utf-8").splitlines()
Confidence
92% confidence
Finding
This function is dedicated to saving an API key into a plaintext .env file, introducing local credential storage capability. Plaintext secret persistence is dangerous because it enables accidental disclosure through filesystem access, source-control mistakes, backups, or packaging artifacts.

Credential Access

High
Category
Privilege Escalation
Content
def set_api_key(api_key: str) -> bool:
    """设置API key并持久化到.env"""
    if not api_key or not api_key.strip():
        return False
    api_key = api_key.strip()
Confidence
90% confidence
Finding
This function formalizes secret setting and persistence behavior as part of the skill API, despite that behavior being outside the declared PDF analysis scope. Embedding credential-management features in an unrelated skill increases the chance of misuse and weakens the user's ability to reason about what the component is allowed to do.

Unpinned Dependencies

Low
Category
Supply Chain
Content
requests>=2.31.0
pydantic>=2.7.0
pydantic-settings>=2.2.0
python-dotenv>=1.0.1
Confidence
97% confidence
Finding
The dependency is specified with a lower bound only (`requests>=2.31.0`), which allows future installs to resolve to different versions over time. This weakens build reproducibility and can inadvertently introduce vulnerable or breaking releases through the supply chain.

Static analysis

No suspicious patterns detected.