Back to skill

Security audit

PDF压缩工具(免费版)

Security checks for vulnerabilities and agentic risk

Overview

This PDF compression skill does what it advertises, but it can upload sensitive PDFs and an API key to an arbitrary configured endpoint without strong destination limits or clear privacy warnings.

Review this skill carefully before installing. Only use it with PDFs you are comfortable sending to an external service, set COMPRESS_PDF_API_URL only to a trusted HTTPS endpoint, avoid confidential documents unless you understand the provider's retention and privacy terms, and install dependencies in an isolated environment.

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

Error
Location
SKILL.md:144
Finding

Arbitrary API endpoint can receive sensitive PDF contents and bearer credentials

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 144-162
Vulnerability Type: Insufficient endpoint validation, plaintext transmission, and potential server-side request forgery
Risk Level: High

Vulnerable Code

python
def _validate_url(url):
    parsed = urlparse(url)
    if parsed.scheme not in ('http', 'https'):
        raise ValueError(...)
    if parsed.hostname in ('localhost', '127.0.0.1', '0.0.0.0'):
        raise ValueError(...)
    return url
python
def compress_pdf(file_path, api_key=None, quality=75, dpi=144):
    api_url = os.getenv("COMPRESS_PDF_API_URL", "")
    if not api_url:
        raise ValueError(...)
    _validate_url(api_url)
    api_key = api_key or os.getenv("COMPRESS_PDF_API_KEY", "")
    headers = {"Authorization": f"Bearer {api_key}"}
    files = {"file": open(file_path, "rb")}
    data = {"imageQuality": quality, "dpi": dpi}
    resp = requests.post(api_url, headers=headers, files=files, data=data)
    return resp.json()

Technical Analysis

The Skill reads a local PDF and sends its contents, compression parameters, and a bearer API credential to an endpoint controlled through COMPRESS_PDF_API_URL. Uploading a document is necessary for the declared remote compression service, but accepting an arbitrary destination is broader than the minimum privilege required.

The endpoint validation only checks the URL scheme and rejects three literal hostnames. It still permits:

  • Plaintext HTTP endpoints, allowing network interception or modification.
  • RFC1918 private network addresses.
  • IPv6 loopback and private addresses.
  • Link-local addresses and cloud metadata services such as 169.254.169.254.
  • Reserved or alternative IP representations.
  • Hostnames that resolve to internal addresses.
  • DNS rebinding scenarios.
  • Untrusted public domains unrelated to the intended compression provider.

Because the bearer token and ...[truncated 1791 chars]

Remediation
View remediation

Remediation Suggestions

  1. Require HTTPS and reject plaintext HTTP without an override.
  2. Replace the arbitrary endpoint setting with an allowlist containing the official compression-service hostname and expected port.
  3. Resolve the hostname before connecting and reject loopback, private, link-local, multicast, reserved, unspecified, and metadata-network addresses for both IPv4 and IPv6.
  4. Protect against DNS rebinding by ensuring the validated address is the address used for the connection.
  5. Disable redirects, or validate every redirect destination using the same hostname and IP controls.
  6. Display the exact destination and obtain explicit user consent before uploading a document.
  7. Apply connection and read timeouts, maximum file-size limits, and response-size limits.
  8. Open the PDF through a context manager so the file descriptor is closed reliably.
  9. Avoid sending an empty Authorization header and scope API credentials to the minimum service permissions.
  10. Document the external data-processing destination and warn users that their PDF leaves the local environment.

T08 · Insecure Dependencies

Warning
Location
SKILL.md:133
Finding

Unpinned third-party dependency installation creates supply-chain exposure

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, line 133; repeated at line 233
Vulnerability Type: Unpinned dependency installation without integrity verification
Risk Level: Medium

Vulnerable Code

bash
pip install requests

The same installation instruction is listed again in the dependency table:

text
requests | Python package | Required | pip install requests

Technical Analysis

The Skill instructs the Agent to install requests without selecting an audited version or verifying package hashes. Dependency resolution therefore depends on mutable repository state, the user's pip configuration, configured mirrors, and any additional package indexes.

Although requests is a legitimate and widely used package, this command does not guarantee which version or package artifact will be installed. A compromised repository account, malicious configured mirror, altered package index, or future incompatible release could cause unreviewed code to enter the Agent environment. Package installation and subsequent import can execute dependency code with the privileges of the Agent process.

Attack Path

  1. The Agent follows the documented environment-preparation instruction.
  2. Pip resolves requests and its transitive dependencies using the environment's configured indexes and mirrors.
  3. One of those sources or package artifacts is compromised, substituted, or otherwise untrusted.
  4. Pip installs the resolved package without checking a project-supplied expected version and cryptographic hash.
  5. Malicious package code executes during installation or when the Skill imports the package.
  6. The code gains the same filesystem, environment-variable, and network access available to the Agent process.

This exploitation path is conditional on compromise or manipulation of the dependency source; the audited file does not itself include a malicious package.

Impact Assessment

A comp ...[truncated 468 chars]

Remediation
View remediation

Remediation Suggestions

  1. Pin requests and every transitive dependency to reviewed versions in a lock file.
  2. Require cryptographic hashes, for example through a hash-locked requirements file and pip install --require-hashes.
  3. Use a trusted, explicitly configured package index rather than inheriting arbitrary index settings.
  4. Install dependencies in an isolated virtual environment with no unnecessary system privileges.
  5. Scan pinned dependencies for known vulnerabilities and update them through a controlled review process.
  6. Prefer a prebuilt, reviewed runtime image when the platform supports one, avoiding runtime package installation.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (8)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill instructs users to upload PDF documents to an external API without clearly warning that document contents will leave the local environment and be processed by a third party. In a document-processing skill, this is especially dangerous because PDFs often contain sensitive business, financial, legal, or personal data, so users may unknowingly exfiltrate confidential information.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
72% confidence
Finding

The display name, description, examples, and user-facing guidance are entirely in Chinese, and the skill does not indicate that other languages are supported or that the language is optional. Under the policy, forcing a specific language without opt-in can be a natural-language policy violation unless the locale constraint is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest description says the skill uploads a PDF, polls job status, and returns a download URL after completion. However, the only concrete implementation shown in the code sample performs a single POST request and directly returns resp.json(), with no polling loop, status retrieval, or download-link handling.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

These documentation lines claim the capability supports generic '创建/查询/导出' operations, and later even '创建/查询/修改/删除' modes. The concrete code only validates a URL, reads a local PDF, sends it to a compression API, and returns the API response; it does not implement CRUD-style resource operations.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The trigger phrases are broad enough to overlap with ordinary user requests such as compressing a PDF, which can cause the skill to activate unexpectedly and send files to an external API. In this skill context, unintended activation is more dangerous because the core action involves document upload, creating a privacy and data-handling risk rather than just a harmless local transformation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Documenting a callback_url parameter without warning that job metadata or results may be sent to a user-specified endpoint creates a risk of unintended data disclosure or misuse. In this skill context, callback delivery could expose filenames, job identifiers, result URLs, or other processing metadata to external infrastructure the user may not fully control.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The core capability list includes '批量压缩', and later usage scenarios describe compressing multiple PDFs at once. The provided implementation accepts a single file_path, opens one file, and submits one request, so the documented batch capability is not reflected in the actual code behavior.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The input format documents a callback_url for async completion notifications, implying the skill can notify an external endpoint when processing finishes. The only implementation shown neither accepts callback_url in compress_pdf nor sends any callback, so the documentation describes behavior the code does not perform.

Content

No source excerpt is available for this finding.