Back to skill

Security audit

PDF Processor

Security checks for vulnerabilities and agentic risk

Overview

This PDF skill matches its stated purpose, but it needs review because it can automatically start a local Ollama service and move or store document contents during processing.

Install only if you are comfortable with local PDF contents being sent to Ollama on localhost, temporary/progress files containing document text, and the original PDF being moved into the completed folder. Run it in a dedicated processing directory, avoid sensitive PDFs on shared machines, stop Ollama if the skill starts it unexpectedly, and prefer pinned dependencies or a locked environment.

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
package.json:16
Finding
Unpinned Python Dependencies Permit Mutable Supply-Chain Artifacts<![CDATA[ ## Vulnerability Details **File Location**: `package.json:16-21` **Vulnerability Type**: `T08: Insecure Dependencies` **Risk Level**: Medium ### Vulnerable Code ```json { "id": "python-deps", "kind": "python", "packages": ["pdfplumber", "requests"], "label": "Install Python dependencies" } ``` ### Technical Analysis The installation configuration specifies `pdfplumber` and `requests` without exact versions, package hashes, or a dependency lockfile. Consequently, installation resolves whichever compatible releases are available from the configured Python package source at installation time. This makes the installed code mutable after the Skill has been reviewed. A compromised package registry account, malicious replacement release, dependency-confusion condition in the installation environment, or compromised transitive dependency could introduce attacker-controlled code. Python packages may execute code during installation and are subsequently imported by `scripts/process_pdf.py`, providing another execution opportunity. The audit also found a mutable Ollama model tag in the manual installation instructions, but the pinpointed vulnerability here concerns the unpinned Python dependencies declared on lines 16-21. ### Attack Path 1. An attacker compromises a declared package, one of its transitive dependencies, or the package source used by the installation environment. 2. The attacker publishes a malicious version that satisfies the unversioned package request. 3. A user installs the Skill dependencies after that version becomes available. 4. The installer retrieves the malicious or compromised artifact because no exact version or hash is enforced. 5. Attacker-controlled code executes during package installation or when `process_pdf.py` imports the package. 6. The code runs with the privileges of the user installing or invoking the Skill. This path depends on compromise or manipulation of the dependency supply chain; the repository itsel ...[truncated 671 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin every direct Python dependency to a reviewed, exact version, for example: ```text pdfplumber==<reviewed-version> requests==<reviewed-version> ``` 2. Generate a lockfile that includes all transitive dependencies. 3. Require cryptographic hashes during installation, such as a hash-locked requirements file used with: ```bash python3 -m pip install --require-hashes -r requirements.txt ``` 4. Configure installation to use an explicitly trusted package index and disable unintended fallback indexes. 5. Run dependency vulnerability and provenance checks in CI before publishing updates. 6. Review dependency changes explicitly rather than accepting automatic floating-version upgrades. 7. Where Ollama supports immutable model digests or artifact verification, pin and verify the required model instead of relying only on the mutable `qwen2.5:7b` tag. 8. Install and run the Skill as an unprivileged user with access restricted to the intended PDF-processing directories. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (32)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding
The skill claims to process PDFs locally, but the documented behavior also includes starting external services, moving original PDFs, deleting intermediate files, translating titles, and persisting progress state. These side effects are security-relevant because they introduce command execution, destructive file operations, and hidden state changes beyond a user's likely expectation for a simple document-processing skill.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding
The skill claims to process PDFs locally, but the documented behavior also includes starting external services, moving original PDFs, deleting intermediate files, translating titles, and persisting progress state. These side effects are security-relevant because they introduce command execution, destructive file operations, and hidden state changes beyond a user's likely expectation for a simple document-processing skill.

Ae1

High
Category
analysis-evasion
Content
python3 scripts/process_pdf.py <pdf_path> <output_base_dir>
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
python3 scripts/process_pdf.py <pdf_path> <output_base_dir>
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
python3 scripts/process_pdf.py <pdf_path> <output_base_dir>
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Context-Inappropriate Capability

High
Confidence
95% confidence
Finding
Starting a local background service is a significant side effect for a PDF-processing skill, especially because it alters system runtime state and may expose a local API endpoint. In constrained or multi-user environments, this can unintentionally open access to document-processing capabilities or conflict with existing services.

Lp3

Medium
Category
MCP Least Privilege
Confidence
85% confidence
Finding
The skill describes capabilities that include file reads/writes, local network access to Ollama, and shell execution, but it does not declare any explicit tool scope or permission boundaries. This is dangerous because an agent may grant or infer broader access than users expect, increasing the risk of unintended file modification, command execution, or service interaction during routine PDF processing.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The trigger phrases such as '处理PDF', '翻译论文', and '生成论文概述' are broad enough to match common user intents, and the skill also auto-triggers when files are placed in a directory. Overbroad triggers are dangerous because they can cause the skill to activate unexpectedly, leading to unintended file processing, content translation, or document movement without sufficiently explicit user intent.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The skill mandates Chinese-only output and does not indicate any user choice for output language. While not inherently malicious, this can create unsafe or misleading behavior in multilingual workflows by overriding user expectations and potentially obscuring important details during translation or summarization.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
The description mandates Chinese-language output and translation behavior without indicating user consent or preference handling. In an agent setting, forcing a language transformation can alter meaning, reduce user comprehension, and cause unintended disclosure or misprocessing of sensitive academic content when the user expected extraction only or a different output language.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This markdown file contains natural-language requirements that the summary output be '200字纯中文概述', and the same Chinese-only constraint is repeated later for all PDFs. For a general PDF-processing skill, forcing a specific output language without user choice is a language/locale policy concern.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
The file explicitly says the summary output for all PDFs is a '200字纯中文概述'. This is a natural-language policy violation because it imposes a fixed language requirement rather than offering a user-selectable locale.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The workflow requires summaries to be generated in 'pure Chinese,' which imposes a language constraint on output. The policy allows locale constraints only when the user is given a choice or when the restriction is clearly justified as region-specific; neither is present here.

Natural-Language Policy Violations

Medium
Confidence
97% confidence
Finding
These lines require summaries to be in Chinese only and instruct the system to strip all English, numbers, and symbols. This is a natural-language policy issue because it forces a specific language/locale behavior without presenting a user choice or a documented justification.

Internal Network Request

Medium
Category
Server-Side Request Forgery
Content
print(f"\n🔍 检查Ollama模型: {model_name}")

    try:
        response = requests.get("http://localhost:11434/api/tags", timeout=5)
        models = response.json()

        model_exists = False
Confidence
70% confidence
Finding
Code issues a request to a loopback, link-local, or private-range host. This can reach internal services not meant to be exposed and is a common SSRF pivot.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
print("\n🚀 正在启动Ollama服务...")

    try:
        subprocess.Popen(['ollama', 'serve'],
                     stdout=subprocess.DEVNULL,
                     stderr=subprocess.DEVNULL)
        time.sleep(5)
Confidence
88% confidence
Finding
The script launches a background local service with subprocess without explicit user consent or validation of whether that side effect is acceptable in the current environment. Even though the command is fixed and not shell-injected, spawning a persistent service expands the skill's privileges and can change host state beyond simple PDF processing.

Ssd 3

Medium
Confidence
94% confidence
Finding
The progress file persistently stores translated text and workflow state in plain JSON under the processing directory. If the PDF contains sensitive research, personal data, or proprietary content, these artifacts extend data retention and increase exposure to other local users, backups, or later compromise.

External Transmission

Medium
Category
Data Exfiltration
Content
}

    try:
        response = requests.post(url, headers=headers, json=data, timeout=600)
        result = response.json()

        if result.get("done", False):
Confidence
80% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
}

    try:
        response = requests.post(url, headers=headers, json=data, timeout=600)
        result = response.json()

        if result.get("done", False):
Confidence
80% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
}

    try:
        response = requests.post(url, headers=headers, json=data, timeout=600)
        result = response.json()

        if result.get("done", False):
Confidence
80% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The script sends extracted PDF content to a local HTTP API without an explicit disclosure or consent step. While the destination is localhost rather than a remote host, this still transmits potentially sensitive document contents to another process and trust boundary, which matters on shared or compromised systems.

Natural-Language Policy Violations

Medium
Confidence
97% confidence
Finding
The prompt explicitly requires the summary to be '纯中文' and forbids any English, numbers, or symbols, enforcing a specific language/locale choice in the skill behavior. The file does not indicate any user opt-in or configurable language selection, so this is a natural-language locale policy concern.

Ssd 3

Medium
Confidence
95% confidence
Finding
Writing the full extracted PDF text to a plaintext file creates an additional copy of the entire document outside the original PDF. This increases the risk of unauthorized access, accidental sharing, indexing by other software, and long-term retention of sensitive contents.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The skill performs a filesystem side effect not clearly implied by the core processing description: it moves the user's original PDF into another directory. This can surprise users, break downstream workflows that expect the file to remain in place, and effectively acts as a destructive operation if other tools rely on the original path.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
Moving the original PDF without clear up-front notice is a harmful hidden side effect. Users may lose track of files, automation may fail due to path changes, and rollback is not guaranteed if the operation occurs unexpectedly.

Static analysis

No suspicious patterns detected.