Back to skill

Security audit

Mineru Pdf Parser

Security checks for vulnerabilities and agentic risk

Overview

This PDF parser matches its stated MinerU purpose, but it needs review because it uploads local PDFs to a third-party service and downloads/extracts remote results with limited runtime safeguards.

Install only if you are comfortable sending PDFs and the MinerU API token to MinerU, and avoid processing confidential documents unless MinerU's privacy and retention terms are acceptable. Treat downloaded results as untrusted, and prefer a version that adds per-run upload confirmation plus safe ZIP validation and size/time limits.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
mineru_api.py:220
Finding

Unvalidated ZIP Extraction Allows Path Traversal and Arbitrary File Overwrite

Content
View full analysis
str: """Download results to the specified directory""" url = data.get("full_zip_url") if not url: return None # If no directory is specified, use the default result directory if out_dir is None: out_dir = "result" zip_path = os.path.join(out_dir, "result.zip") os.makedirs(out_dir, exist_ok=True) print(f"📥 Downloading...") r = requests.get(url, stream=True) with open(zip_path, "wb") as f: for c in r.iter_content(8192): f.write(c) with zipfile.ZipFile(zip_path, "r") as z: z.extractall(out_dir) os.remove(zip_path) return out_dir ``` ### Technical Analysis The `download()` function obtains an archive URL from the MinerU API response, downloads the content, and passes the resulting archive directly to `ZipFile.extractall()` without explicitly validating archive member paths. A malicious or compromised archive can contain absolute paths or traversal components such as `../../`. If these entries are not rejected by the deployed Python runtime or extraction environment, extraction can cause files to be written outside the intended `~/.openclaw/MinerU_Results/` directory. The download operation also lacks an HTTP timeout, response status validation, content-type validation, archive-size limit, and integrity verification. Consequently, an invalid or unbounded response could be stored and processed, increasing the potential for denial of service or processing of attacker-controlled content. ### Attack Path 1. An attacker compromises or impersonates the MinerU result service, its storage endpoint, or another component capable of influencing the `full_zip_url` response. 2. The attacker supplies a ZIP archive containing crafted entries such as ...[truncated 1410 chars]
Remediation
View remediation
> 16 if stat.S_ISLNK(mode): raise ValueError(f"Symbolic links are not allowed: {member.filename}" ...[truncated 339 chars]
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
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (14)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill requires access to an environment secret (MINERU_TOKEN) and sends data over the network to an external service, but it does not declare any explicit tool scope such as permissions or allowed-tools. This increases the chance that an agent framework will invoke it without clear capability boundaries or user awareness, especially because PDFs and API tokens are both sensitive inputs in this context.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger phrase '将 PDF 转为 Markdown' is broad enough to match many ordinary requests, which can cause the skill to auto-activate in situations where the user did not intend to upload a local file or send document contents to MinerU. In this skill's context, overbroad activation is more dangerous because execution may expose local document contents and use a credentialed external API.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The manifest describes a PDF parsing skill that handles local files and URLs via the MinerU API, but it does not mention reading credentials from the host environment. Accessing environment variables is a broader host-data capability than the user-facing document-conversion purpose itself and is not explicitly declared in the stated scope.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The default language is hard-coded to "ch", which imposes a specific locale unless the user overrides it manually. Under the language/locale policy, forcing a language by default without explicit user choice can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill stores parsed results persistently under the user’s home directory by default, which can leave sensitive document contents on disk longer than the user expects. In a PDF parsing context this is significant because documents may contain confidential research, contracts, or personal data.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · mineru_api.py (reported line 69)May include surrounding context.

python
if extra_formats: data["extra_formats"] = extra_formats
    if no_cache: data["no_cache"] = True
    
    res = requests.post("https://mineru.net/api/v4/extract/task", headers=get_header(), json=data)
    result = res.json()
    if result.get("code") == 0:
        return result["data"]["task_id"]

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · mineru_api.py (reported line 88)May include surrounding context.

python
if extra_formats: data["extra_formats"] = extra_formats
    if no_cache: data["no_cache"] = True
    
    res = requests.post("https://mineru.net/api/v4/extract/task", headers=get_header(), json=data)
    result = res.json()
    if result.get("code") == 0:
        return result["data"]["task_id"]

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Local PDF files are uploaded to a remote service without an explicit consent or warning step at the point of transmission. Because the skill is for document parsing, this can leak sensitive local content to a third party and is more dangerous in this context than generic telemetry.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
91% confidence
Finding

This outbound request initiates the process for uploading local files to a third-party service, and in context that means sensitive user documents may leave the machine. In a PDF parsing skill, undisclosed external transmission of local files is a real security/privacy issue, especially when the manifest does not prominently warn about it.

Content

Scanner excerpt · mineru_api.py (reported line 153)May include surrounding context.

python
data["extra_formats"] = extra_formats
    
    # 申请上传链接
    res = requests.post("https://mineru.net/api/v4/file-urls/batch", headers=get_header(), json=data)
    result = res.json()
    if result.get("code") != 0:
        print(f"❌ 申请链接失败: {result.get('msg')}")

Tainted flow: 'url' from requests.post (line 207, network input) → requests.get (network output)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · mineru_api.py (reported line 185)May include surrounding context.

python
start = time.time()
    
    while True:
        res = requests.get(url, headers=get_header())
        result = res.json()
        if result.get("code") != 0:
            return None

Tainted flow: 'url' from requests.post (line 207, network input) → requests.get (network output)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · mineru_api.py (reported line 212)May include surrounding context.

python
start = time.time()
    
    while True:
        res = requests.get(url, headers=get_header())
        result = res.json()
        if result.get("code") != 0:
            return None

Tainted flow: 'url' from requests.post (line 207, network input) → requests.get (network output)

Medium
Category
Data Flow
Confidence
96% confidence
Finding

The code downloads a ZIP from a URL returned by the remote MinerU service without validating the hostname, scheme, response size, or content type. If the upstream API is compromised or manipulated, this creates an SSRF-style trust boundary issue and enables retrieval of attacker-controlled content that is immediately processed locally.

Content

Scanner excerpt · mineru_api.py (reported line 256)May include surrounding context.

python
os.makedirs(out_dir, exist_ok=True)
    
    print(f"📥 下载...")
    r = requests.get(url, stream=True)
    with open(zip_path, "wb") as f:
        for c in r.iter_content(8192):
            f.write(c)

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The options table specifies '--lang' defaulting to 'ch', which imposes a specific language/locale by default in the skill's natural-language documentation. The file does not indicate that the user is asked to choose a language first or that the locale default is justified by a region-specific constraint.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The code downloads and extracts a remote ZIP archive without warning the user and without archive safety checks. This is dangerous because attacker-controlled or compromised upstream content could write unexpected files locally, including via ZIP slip path traversal during extraction.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.