Back to skill

Security audit

Pdf Ocr Tool

Security checks for vulnerabilities and agentic risk

Overview

This OCR skill appears purpose-aligned, but its install and data-handling paths need review before use.

Review the install commands before running them. Prefer package-manager or verified installer paths instead of curl piped to sh, avoid running setup as root unless necessary, process sensitive documents only against a trusted local Ollama service, and avoid running the PDF converter in directories containing important PNG files whose names match the PDF page prefix.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
Findings (4)

T03 · Remote Payload Retrieval and Execution

Error
Location
SKILL.md:21
Finding

Unpinned Remote Installer Scripts Are Piped Directly to a Shell

Content
View full analysis
Remediation
View remediation
installer.sh" | sha256sum --check - sh installer.sh ``` The version and checksum must be obtained from an independently authenticated, reviewed release record rather than from the same mutable endpoint. ]]>

T08 · Insecure Dependencies

Warning
Location
hooks/install-deps.sh:7
Finding

Installation Hook Retrieves Mutable Dependency Metadata Without Integrity Verification

Content
View full analysis
=2.31.0", "pillow>=10.0.0", ] ``` ### Technical Analysis The audited project does not contain `uv.lock`. Consequently, running the installation hook attempts to download that file from the mutable `master` branch of a hard-coded GitHub repository. The download has no commit pin, checksum, or signature verification. There is also a provenance inconsistency: `_meta.json:2` identifies the package owner as `tsukisama9292`, while the installation hook trusts GitHub user `nala0222`. The available files do not e ...[truncated 2210 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
utils/ollama_client.py:21
Finding

Complete Document Images May Be Transmitted to Arbitrary Hosts Over Plaintext HTTP

Content
View full analysis
str: with open(image_path, "rb") as f: return base64.b64encode(f.read()).decode("utf-8") # If an image is present, add its complete encoded contents if image_path: try: image_base64 = self.encode_image_to_base64(image_path) payload["images"] = [image_base64] except Exception as e: return f"❌ 無法讀取圖片:{e}" resp = requests.post( f"{self.base_url}/api/generate", json=payload, timeout=self.timeout ) ``` The destination can be supplied through the CLI: ```python parser.add_argument( "--host", default="localhost", help=f"Ollama 主機位置 (預設:localhost)" ) parser.add_argument( "--port", default="11434", help=f"Ollama 端口 (預設:11434)" ) ``` ### Technical Analysis The client always constructs an `http://` URL and does not support authenticated HTTPS. OCR input images—including complete PDF page renders and cropped regions—are base64-encoded and included in the request body. The default destination is localhost, which limits exposure in the normal configuration. However, the public `--host` option accepts arbitrary remote destinations without requiring explicit confirmation or warning that document contents will leave the local system. Plain HTTP ...[truncated 1264 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
utils/pdf_utils.py:20
Finding

Broad Output Globbing Can Cause Deletion of Unrelated PNG Files

Content
View full analysis
List[str]: pdf_path = Path(pdf_path) if output_prefix is None: output_prefix = pdf_path.stem # Output is written beside the source PDF output_dir = pdf_path.parent output_base = str(output_dir / output_prefix) cmd = [ "pdftoppm", "-png", "-r", str(dpi), str(pdf_path), output_base ] subprocess.run( cmd, check=True, capture_output=True, text=True ) # Broadly includes every pre-existing matching PNG images = sorted(glob.glob(f"{output_base}*.png")) return images ``` The caller derives a predictable prefix and deletes every returned match: ```python images = pdf_to_images( pdf_path, output_prefix=Path(pdf_path).stem + "_page" ) for i, img_path in enumerate(images, 1): analysis = analyzer.analyze_page( img_path, page_number=i, auto_detect=auto_detect ) processor.process_page_analysis(analysis) analyses.append(analysis) try: os.remove(img_path) except: pass ``` ### Technical Analysis Generated page images are placed in the same directory as the source PDF with a predictable name. The conversion function then uses the pattern `*.png` rather than tracking files created by the current `pdftoppm` process. For an input named `report.pdf`, the caller uses `report_page` as the output prefix. Any pre-existing file such as `report_page_notes.png` or `report_page_backup.png` matches the glob, is returned as if it were a generated page, and is subsequently deleted by `ocr_tool.py`. The broad ex ...[truncated 1379 chars]
Remediation
View remediation
Vulnerability Patterns
  • 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
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
Findings (65)

External Script Fetching

High
Category
Supply Chain
Confidence
97% confidence
Finding

The README instructs users to execute a remote installation script directly with curl ... | sh, which grants immediate code execution from a network source without review or integrity verification. If the upstream site, transport path, or script content is compromised, users can suffer arbitrary code execution on their machine.

Content

Scanner excerpt · README.md (reported line 29)May include surrounding context.

bash
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
ollama pull glm-ocr:q8_0

# Install poppler-utils (for PDF to image conversion)

Chaining Abuse

High
Category
Tool Misuse
Confidence
96% confidence
Finding

The | sh chaining pattern is dangerous because it converts downloaded content directly into shell commands without an opportunity for inspection, sandboxing, or validation. In an installation context, this materially increases the likelihood and impact of supply-chain compromise or malicious script substitution.

Content

Scanner excerpt · README.md (reported line 29)May include surrounding context.

bash
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
ollama pull glm-ocr:q8_0

# Install poppler-utils (for PDF to image conversion)

Chaining Abuse

High
Category
Tool Misuse
Confidence
94% confidence
Finding

This second | sh pattern has the same issue: a remote network response is executed immediately as shell code. Even if the source is reputable, the practice is unsafe by default and especially problematic in third-party skill documentation that users may follow without scrutiny.

Content

Scanner excerpt · README.md (reported line 37)May include surrounding context.

brew install poppler # macOS

Install uv package manager

curl -LsSf https://astral.sh/uv/install.sh | sh

text

### Install via ClawHub (Recommended)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description describes a full OCR-based PDF/image-to-Markdown conversion skill with content classification capabilities. The actual code chunk is only a minimal tests package initializer and version declaration, which is unrelated to the declared functionality. This is a material mismatch in primary purpose, not merely an implementation detail.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description promises an intelligent PDF/image to Markdown converter with OCR-based content detection. The supplied code does not implement conversion, OCR, Markdown generation, or document structure detection. Instead, it only offers supporting image-processing helpers such as crop, resize, save, size detection, and base64 encoding. While such utilities could support a larger OCR pipeline, this chunk by itself does not match the declared primary purpose and exposes capabilities not mentioned in the description.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The supplied code chunk is limited to low-level PDF preprocessing and inspection utilities. It invokes external tools (pdftoppm, pdfinfo) to rasterize PDFs, count pages, extract metadata, and validate files. While PDF-to-image conversion could support a larger OCR pipeline, this code does not implement the declared primary functionality of converting PDFs or images into Markdown, nor does it perform intelligent content detection or use Ollama GLM-OCR. Therefore the description materially overstates and misrepresents what this code chunk actually does.

Content

No source excerpt is available for this finding.

External Script Fetching

High
Category
Supply Chain
Confidence
97% confidence
Finding

Piping a remote script directly into sh executes unreviewed code from the network with the user's privileges. If the hosting site, network path, or script content is compromised, this becomes an immediate arbitrary code execution and supply-chain compromise vector.

Content

Scanner excerpt · SKILL.md (reported line 27)May include surrounding context.

bash
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
ollama pull glm-ocr:q8_0

# Install poppler-utils (for PDF to image conversion)

Chaining Abuse

High
Category
Tool Misuse
Confidence
96% confidence
Finding

The | sh construct chains network retrieval directly into shell execution, removing any opportunity for user inspection or validation before running code. In a skill installation context, this is especially risky because users may copy-paste it verbatim and unknowingly execute attacker-controlled payloads.

Content

Scanner excerpt · SKILL.md (reported line 27)May include surrounding context.

bash
# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh
ollama pull glm-ocr:q8_0

# Install poppler-utils (for PDF to image conversion)

Chaining Abuse

High
Category
Tool Misuse
Confidence
95% confidence
Finding

This second | sh usage has the same unsafe pattern: direct execution of network-fetched code without validation. Even if common in developer tooling, it normalizes insecure installation behavior and increases exposure to supply-chain compromise.

Content

Scanner excerpt · SKILL.md (reported line 35)May include surrounding context.

brew install poppler # macOS

Install uv package manager

curl -LsSf https://astral.sh/uv/install.sh | sh

text

### 2. Install with uv (Recommended)

Unvalidated Output Injection

High
Category
Output Handling
Confidence
85% confidence
Finding

Model output is used without validation or sanitization. Unvalidated output injected into downstream contexts (SQL, shell, HTML) enables injection attacks and arbitrary code execution.

Content

Scanner excerpt · SKILL.md (reported line 221)May include surrounding context.

md
from pathlib import Path

# Process PDF (auto mode)
subprocess.run([
    "python", "skills/pdf-ocr-tool/ocr_tool.py",
    "--input", "/path/to/document.pdf",
    "--output", "/tmp/result.md",

External Script Fetching

High
Category
Supply Chain
Confidence
90% confidence
Finding

Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Content

Scanner excerpt · hooks/post-install.sh (reported line 13)May include surrounding context.

sh
# Check if Ollama is installed
if ! command -v ollama &> /dev/null; then
    echo "❌ ollama is not installed. Please install ollama first:"
    echo "   curl -fsSL https://ollama.com/install.sh | sh"
    exit 1
fi

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · processor.py (reported line 107)May include surrounding context.

python
RegionType.FIGURE: get_prompt("figure"),
            RegionType.MIXED: get_prompt("mixed"),
        }
        return prompt_map.get(region_type, get_prompt("mixed"))
    
    def _crop_region(
        self,

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · prompts.py (reported line 126)May include surrounding context.

python
RegionType.FIGURE: get_prompt("figure"),
            RegionType.MIXED: get_prompt("mixed"),
        }
        return prompt_map.get(region_type, get_prompt("mixed"))
    
    def _crop_region(
        self,

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README describes OCR processing via Ollama but does not clearly warn users that document contents are transmitted to a local or remote Ollama service endpoint during processing. This can cause unintended disclosure of sensitive PDFs or images, especially when --host is configured to point at a non-local service.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
70% confidence
Finding

npx commands without a version suffix (e.g. @1.0.0) create a rug-pull risk if the upstream server is compromised and publishes a malicious update.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · README.md (reported line 190)May include surrounding context.

Missing pdftoppm

bash
sudo apt install poppler-utils  # Debian/Ubuntu
brew install poppler            # macOS

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · SKILL.md (reported line 264)May include surrounding context.

Missing pdftoppm

bash
sudo apt install poppler-utils  # Debian/Ubuntu
brew install poppler            # macOS

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill advertises and demonstrates capabilities involving file access, network access, and shell execution, but does not declare any explicit tool scope or permissions boundary. This increases the risk of over-privileged execution because operators and agents cannot easily constrain what the skill is allowed to do before installation or use.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill documentation does not clearly warn that user-provided PDFs or images may be transmitted to an OCR service via Ollama for processing. This is a data-handling transparency issue that can lead users to expose sensitive local documents without understanding the privacy boundary.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
82% confidence
Finding

Using npx clawhub install pdf-ocr-tool without a pinned package version makes installation dependent on whatever package version is current at execution time. That creates a supply-chain risk where a compromised or maliciously updated package could be fetched and run unexpectedly.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 59)May include surrounding context.

md
# Clone or download skill
git clone <repo> ~/.openclaw/workspace/skills/pdf-ocr-tool

# Create virtual environment and install dependencies
cd ~/.openclaw/workspace/skills/pdf-ocr-tool
uv venv
source .venv/bin/activate

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Comments, docstrings, prompts, and printed messages in this file are written in Chinese only, with no indication that users can choose another language. This creates a locale/language policy concern because the skill effectively enforces one language without explicit user preference or justified regional scope.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This code sends the page image to self.ollama_client.generate(...) for analysis, which is a network/model call that may transmit user document data. While there is exception logging, there is no confirmation prompt, user-facing disclosure, or explanatory comment/docstring warning that page contents are being sent for external processing.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

After cropping, the code submits the temporary image file to self.ollama_client.generate(...), which may transmit sensitive page-region content for remote processing. The surrounding code lacks any confirmation prompt, disclosure comment, or documentation warning about this data transmission.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The install hook downloads dependency definition files from a remote GitHub URL when local files are absent, introducing a supply-chain risk during installation. Because those fetched files control what packages are installed, a compromised repository, branch, account, or network path could cause execution of attacker-chosen dependencies or build steps.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.