Back to skill

Security audit

Product Doc Reader

Security checks for vulnerabilities and agentic risk

Overview

This is a real PDF extraction skill, but it can send complete engineering drawings to external AI services by default and includes unsafe credential and cleanup behavior.

Install only if you are comfortable with engineering PDFs and BOM data leaving the local machine for third-party Vision processing. Prefer using --text-only for confidential documents, remove and rotate the embedded OpenRouter key before use, avoid letting the skill read broad agent config files, and do not run the batch cleanup scripts with arbitrary temp directories.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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 (5)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/extract_hybrid.py:542
Finding

Default Hybrid Workflow Uploads Complete Engineering Drawings to a Third-Party API

Content
View full analysis
dict: """调用 OpenRouter (Gemini/Claude)""" import urllib.request api_key = os.environ.get("OPENROUTER_API_KEY", "") if not api_key: api_key = "[REDACTED HARDCODED OPENROUTER KEY]" content = [{"type": "text", "text": VISION_PROMPT}] for img_b64 in images_b64: content.append({ "type": "image_url", "image_url": {"url": f"data:image/png;base64,{img_b64}"}, }) payload = { "model": model, "messages": [{"role": "user", "content": content}], "temperature": 0.1, "max_tokens": 4096, } req = urllib.request.Request( "https://openrouter.ai/api/v1/chat/completions", data=json.dumps(payload).encode("utf-8"), headers={ "Content-Type": "application/json", "Authorization": f"Bearer {api_key}", }, ) with urllib.request.urlopen(req, timeout=120) as resp: result = json.loads(resp.read().decode("utf-8")) ``` ```python # Step 3: Vision API(仅兜底) if use_vision and images: print("[3/4] Vision API 提取(兜底)...", file=sys.stderr) try: images_b64 = [image_to_base64(img) for img in images] vision_data = call_vision_api(images_b64) if "error" in vision_data: print(f" Vision API 错误:{vision_data['error']}", file=sys.stderr) vision_data = {} else: print(f" Model No: {vision_data.get('model_no', '未识别')}", file=sys.stderr) print(f" BOM: {len(vision_data.get('bom', []))} 行", file=sys.stderr) except Exception as e: print(f" Vision API 失败:{e}", file=sys.stderr) ``` ### Technical A ...[truncated 2239 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/extract_hybrid.py:361
Finding

Exposed OpenRouter Bearer Credential Embedded in Source Code

Content
View full analysis
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/extract_vision.py:153
Finding

Undocumented Agent-Wide Configuration Scanning for DashScope Credentials

Content
View full analysis
dict: """调用百炼 Qwen-VL""" import urllib.request api_key = os.environ.get("DASHSCOPE_API_KEY", "") if not api_key: # Try reading from config config_path = os.path.expanduser("~/.openclaw/config.yaml") if os.path.exists(config_path): with open(config_path) as f: for line in f: if "DASHSCOPE_API_KEY" in line or "dashscope" in line.lower(): # Simple extraction if ":" in line: api_key = line.split(":", 1)[1].strip().strip("'\"") break if not api_key: raise RuntimeError("DASHSCOPE_API_KEY not found. Set env or pass --provider openrouter") ``` ### Technical Analysis When an explicit environment variable is unavailable, the Skill opens the Agent's general `~/.openclaw/config.yaml` file. This access is not listed as a required permission in the Skill metadata. The file is parsed using substring matching and splitting at the first colon rather than a YAML parser and an exact configuration key. Any line containing the case-insensitive string `dashscope` can be selected. The extracted text is subsequently used as an authorization bearer token in a request to DashScope. This violates least privilege because a document extraction script should not inspect an Agent-wide configuration file containing potentially unrelated provider credentials and settings. The loose parser also creates credential-confusion risk: an unrelated value on a matching line may be treated as an API key. ### Attack Path 1. A user selects the Bailian provider without defining `DASHSCOPE_API_KEY`. 2. The Skill accesses ...[truncated 1162 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/batch_process_drive.py:299
Finding

Unconditional Recursive Deletion of a User-Controlled Temporary Directory

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/extract_hybrid.py:33
Finding

Predictable Shared Temporary Files Enable Cross-Process Interference and Data Exposure

Content
View full analysis
list[str]: """PDF 转 PNG,返回图片路径列表(300 DPI 高分辨率)""" stem = Path(pdf_path).stem[:20] prefix = f"/tmp/hybrid_{stem}" for f in glob.glob(f"{prefix}*.png"): os.remove(f) subprocess.run( ["pdftoppm", "-r", str(dpi), "-png", pdf_path, prefix], check=True, capture_output=True, ) images = sorted(glob.glob(f"{prefix}*.png")) if not images: raise FileNotFoundError(f"PDF to image failed for {pdf_path}") return images ``` The Vision extractor uses the same pattern: ```python stem = Path(pdf_path).stem[:20] prefix = f"/tmp/vision_{stem}" import glob for f in glob.glob(f"{prefix}*.png"): os.remove(f) ``` The legacy drawing extractor also uses a fixed path: ```python tmp_path = "/tmp/ocr_region_crop.png" ``` ### Technical Analysis Temporary artifacts are placed directly in the shared `/tmp` namespace using predictable names derived from only the first 20 characters of the source filename. Different documents with matching truncated stems collide, and simultaneous runs processing the same filename use the same files. Before rendering, the extractors delete every PNG matching the predictable prefix. They later discover output files with another glob rather than tracking files created in a private directory. This permits concurrent processes to delete, replace, or consume each other's images. On a multi-user host, an attacker who can write to `/tmp` may anticipate the filenames and attempt to create colliding files or race the interval between image generation and reading. Exact exploitability against symbolic links depends on the behavior of `pdftoppm` and t ...[truncated 1435 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (99)

Tainted flow: 'req' from os.environ.get (line 381, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
99% confidence
Finding

The script sends base64-encoded images derived from the input PDF to an external OpenRouter Vision API, causing document contents to leave the local environment. Because the input is product drawings and BOM data, this can expose sensitive intellectual property or customer data; the use of an environment-sourced credential is not the main issue, but the silent outbound exfiltration is.

Content

Scanner excerpt · scripts/extract_hybrid.py (reported line 390)May include surrounding context.

python
},
    )

    with urllib.request.urlopen(req, timeout=120) as resp:
        result = json.loads(resp.read().decode("utf-8"))

    text = result["choices"][0]["message"]["content"]

Tainted flow: 'req' from os.environ.get (line 223, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/extract_vision.py (reported line 194)May include surrounding context.

python
},
    )

    with urllib.request.urlopen(req, timeout=120) as resp:
        result = json.loads(resp.read().decode("utf-8"))

    text = result["choices"][0]["message"]["content"]

Tainted flow: 'req' from os.environ.get (line 223, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
99% confidence
Finding

The script contains a hardcoded OpenRouter API key and uses it in outbound requests when OPENROUTER_API_KEY is not set. Hardcoded credentials are a real secret-management vulnerability because anyone with source access can reuse the key, incur costs, abuse the account, or access related service data.

Content

Scanner excerpt · scripts/extract_vision.py (reported line 232)May include surrounding context.

python
},
    )

    with urllib.request.urlopen(req, timeout=120) as resp:
        result = json.loads(resp.read().decode("utf-8"))

    text = result["choices"][0]["message"]["content"]

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Using external Vision APIs as the primary path while claiming a local pdftotext-first design is especially risky for engineering drawings, which may contain proprietary or customer-confidential data. The additional report of undeclared external API usage and a hardcoded fallback key means users may unknowingly exfiltrate documents and lose control over where sensitive content is processed.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Using external Vision APIs as the primary path while claiming a local pdftotext-first design is especially risky for engineering drawings, which may contain proprietary or customer-confidential data. The additional report of undeclared external API usage and a hardcoded fallback key means users may unknowingly exfiltrate documents and lose control over where sensitive content is processed.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Using external Vision APIs as the primary path while claiming a local pdftotext-first design is especially risky for engineering drawings, which may contain proprietary or customer-confidential data. The additional report of undeclared external API usage and a hardcoded fallback key means users may unknowingly exfiltrate documents and lose control over where sensitive content is processed.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Using external Vision APIs as the primary path while claiming a local pdftotext-first design is especially risky for engineering drawings, which may contain proprietary or customer-confidential data. The additional report of undeclared external API usage and a hardcoded fallback key means users may unknowingly exfiltrate documents and lose control over where sensitive content is processed.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Using external Vision APIs as the primary path while claiming a local pdftotext-first design is especially risky for engineering drawings, which may contain proprietary or customer-confidential data. The additional report of undeclared external API usage and a hardcoded fallback key means users may unknowingly exfiltrate documents and lose control over where sensitive content is processed.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

Using external Vision APIs as the primary path while claiming a local pdftotext-first design is especially risky for engineering drawings, which may contain proprietary or customer-confidential data. The additional report of undeclared external API usage and a hardcoded fallback key means users may unknowingly exfiltrate documents and lose control over where sensitive content is processed.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill does more than document extraction: it downloads 58 files from Google Drive and writes generated content into an Obsidian knowledge base. In an agent-skill context, this capability expansion is dangerous because it adds external data ingress and bulk local persistence beyond the declared extractor role.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
100% confidence
Finding

The file contains a hardcoded OpenRouter API key, which is a direct secret exposure and enables unauthorized use of the external account by anyone with code access. In addition, embedding the key facilitates unreviewed outbound data transfer and makes abuse, billing fraud, and confidential document exfiltration much easier.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

Falling back to a hardcoded API key means the script can access an external service and transmit data even when the operator has not configured credentials or consciously enabled such access. That bypasses normal administrative control and materially increases the likelihood of covert or accidental data disclosure.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The documentation describes capabilities beyond the stated extraction-focused purpose, including knowledge-base archiving and Excel updates. This scope expansion is dangerous because users and reviewers may grant the skill broader operational authority than expected, enabling unreviewed data modification and propagation into external systems.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The document explicitly references Google Drive search, download, and upload workflows that exceed a simple PDF extraction role. Hidden or undocumented remote file discovery and write-back behavior increases the risk of unauthorized data access, bulk data exposure, or unintended modification of files in shared cloud storage.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file structure and acceptance criteria show dedicated batch Drive processing and Excel-writing components that are not reflected in the advertised description. This mismatch can conceal write-capable automation and batch operations from reviewers, making overprivileged deployment and accidental mass changes more likely.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill advertises executable behavior and external integrations but does not declare any explicit tool scope or permission boundaries. In an agent environment, undeclared access to shell, files, environment variables, and network increases the chance of unintended or over-broad execution, making review and containment much harder.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The documentation describes Vision API processing without warning that document contents may be transmitted to an external service. For engineering drawings, this omission is material because users may assume local processing and inadvertently expose confidential product, customer, or design information.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Whitespace Padding

Medium
Category
Prompt Injection
Confidence
70% confidence
Finding

Large whitespace padding was detected (a block of blank lines or a long run of spaces). This can push injected instructions below or to the right of the visible area so a human reviewer never sees them while the agent still reads them. Manual review of the hidden content is recommended.

Content

Scanner excerpt · examples/hybrid/e8100bff-ebdf-46f7-8ba4-a2ccd4b2ae75.json (reported line 26)May include surrounding context.

json
{
      "no": "③",
      "part_name": "插头",
      "spec": " SKW                                                                                                    FINISHING                                                  2025/12/24           A0",
      "quantity": "1PCS"
    },
    {

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.