Back to skill

Security audit

PaddleOCR

Security checks for vulnerabilities and agentic risk

Overview

The skill appears purpose-built for OCR, but it uploads sensitive documents to a configured OCR service, keeps local archives by default, and has unsafe file/network handling that users should review before installing.

Review this skill carefully before installation, especially if you handle privileged legal, medical, financial, or evidence files. Use only a trusted PaddleOCR endpoint, understand that document contents may leave the machine, prefer limited page ranges, consider --no-archive for sensitive files, and avoid output paths where an existing *_images directory contains important data.

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 (3)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/convert.py:133
Finding

Response-Controlled Image URLs Enable Blind SSRF and Unbounded Downloads

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/convert.py:113
Finding

Derived Image Output Directory Is Recursively Deleted Without Confirmation

Content
View full analysis
list[dict[str, str]]: saved: list[dict[str, str]] = [] if images_dir.exists(): shutil.rmtree(images_dir) if not any(batch["images"] for batch in batch_outputs): return saved ``` The deleted path is derived from the selected Markdown output path: ```python def resolve_images_dir(markdown_path: Path) -> Path: return markdown_path.with_name(f"{markdown_path.stem}_images") ``` ### Technical Analysis Before checking whether the OCR response contains any images, `save_images()` recursively deletes the existing `images_dir`. The directory is derived from the user-controlled `--output` argument by appending `_images` to the Markdown file stem. There is no ownership marker, path-safety check, confirmation prompt, backup, or explicit overwrite option. The code cannot distinguish a directory previously created by this Skill from an unrelated directory that happens to have the derived name. The deletion occurs even when `batch_outputs` contains no images because the image-presence check follows `shutil.rmtree()`. It also occurs before replacement image writes complete, so a subsequent decoding or download failure can leave the previous directory permanently removed. ### Attack Path 1. A directory containing valuable files already exists at a path such as `/work/report_images`. 2. The Skill is invoked with `--output /work/report.md`, either intentionally or through an automated workflow. 3. `resolve_images_dir()` derives `/work/report_images`. 4. `save_images()` sees that the directory exists and recursively removes it with `shutil.rmtree()`. 5. The prior contents are lost, even if the OCR response contains no images or a later image ...[truncated 760 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
scripts/convert.py:1
Finding

Runtime Dependencies Are Loosely Constrained and Not Integrity-Locked

Content
View full analysis
=3.9" # dependencies = [ # "httpx>=0.27.0", # "pypdfium2>=4.30.0", # ] # /// ``` Other scripts similarly specify dependencies such as: ```python # dependencies = [ # "Pillow>=10.0.0", # ] ``` ### Technical Analysis The scripts are designed to run through `uv run`, which may resolve and install dependencies before executing the application. The dependency declarations use only lower version bounds, such as `httpx>=0.27.0`, and the project does not provide a reviewed lockfile or package hashes in the audited directory. As a result, the exact code executed by a future invocation may differ from the code used during this audit. Any later package version satisfying the lower bound may be selected. This introduces supply-chain and reproducibility risk, particularly because imported Python packages execute initialization code with the same privileges as the Skill process. No evidence was found that the named packages are currently malicious, misspelled, or sourced from an unauthorized registry. The finding concerns unsafe dependency governance rather than a confirmed malicious package. ### Attack Path 1. A future compatible release of one of the declared packages is compromised, malicious, or otherwise unsafe. 2. A user invokes a script through `uv run` in an environment that does not already have a locked cached resolution. 3. The dependency resolver selects and downloads the future release because it satisfies the declared lower bound. 4. Python imports the downloaded package. 5. Package initialization or later library execution ...[truncated 730 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (34)

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

The documented behavior expands beyond the stated purpose by supporting remote file URLs and sending document contents to an external API using configured credentials, while the high-level description frames the skill as local OCR-to-Markdown processing. That mismatch can mislead users into exposing confidential legal or medical documents to third parties without informed consent.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented behavior expands beyond the stated purpose by supporting remote file URLs and sending document contents to an external API using configured credentials, while the high-level description frames the skill as local OCR-to-Markdown processing. That mismatch can mislead users into exposing confidential legal or medical documents to third parties without informed consent.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The documented behavior expands beyond the stated purpose by supporting remote file URLs and sending document contents to an external API using configured credentials, while the high-level description frames the skill as local OCR-to-Markdown processing. That mismatch can mislead users into exposing confidential legal or medical documents to third parties without informed consent.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
2. 进入对应模型的 API 页面
3. 在示例代码中复制:
   - `API_URL`
   - `Access Token`

### 配置方式

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
2. 进入对应模型的 API 页面
3. 在示例代码中复制:
   - `API_URL`
   - `Access Token`

### 配置方式

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

bash
cd paddle-ocr/config
cp .env.example .env
nano .env

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

bash
cd paddle-ocr/config
cp .env.example .env
nano .env

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
/usr/bin/osascript -l JavaScript scripts/convert.js "/path/to/legal-document.pdf"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/lib.py (reported line 34)May include surrounding context.

python
def get_config_path() -> Path:
    return get_skill_root() / "config" / ".env"


def read_env_file(path: Path) -> dict[str, str]:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/smoke_test.py (reported line 47)May include surrounding context.

python
def get_config_path() -> Path:
    return get_skill_root() / "config" / ".env"


def read_env_file(path: Path) -> dict[str, str]:

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/lib.py (reported line 123)May include surrounding context.

python
def get_runtime_config() -> dict[str, Any]:
    file_env = read_env_file(get_config_path())
    merged_env = {**file_env, **os.environ}

    api_url = first_non_empty(merged_env, "PADDLEOCR_DOC_PARSING_API_URL")
    access_token = first_non_empty(merged_env, "PADDLEOCR_ACCESS_TOKEN")

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
86% confidence
Finding

The skill documents capabilities that imply reading files, writing archives, using environment-based credentials, and making network calls, but it does not declare any explicit tool scope or permission boundaries. In an agent setting, missing scope declarations can cause overbroad access and make it harder for users or the runtime to understand that sensitive legal documents and tokens may be accessed and transmitted.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill description emphasizes OCR and archiving benefits but does not prominently warn that sensitive documents may be transmitted to an external OCR provider and retained locally by default. For legal, medical, and evidence materials, this omission materially increases the chance of inadvertent privacy, confidentiality, or compliance violations.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

The documented workflow allows submitting document URLs to a remote parsing API, which broadens the trust boundary from local document conversion to externally fetched or relayed content. In the context of legal and medical records, this creates additional confidentiality, provenance, and SSRF-style risk surfaces if URLs are accepted without strong restrictions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The documentation explicitly describes persistent archiving of the original input, extracted full text, images, batch artifacts, metadata, source path, and file hash, but provides no warning, consent flow, retention control, or privacy safeguards. In this skill’s context—legal PDFs, medical records, and evidence scans—the archived data is likely to contain highly sensitive personal, legal, or regulated information, so silent retention materially increases confidentiality and compliance risk.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The manifest describes a PaddleOCR skill for converting local PDFs/images to Markdown, but this wrapper implements that by constructing and executing shell commands via doShellScript, invoking /bin/zsh, dirname, uv, and Python. Spawning general shell commands is a broader capability than the stated OCR/Markdown conversion purpose and is not explicitly justified by the manifest text.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script is presented as operating on local PDFs/images, but during image output handling it will fetch arbitrary remote URLs returned in OCR results via urllib.request.urlretrieve. This creates an unexpected outbound network path and can expose the host to SSRF-style access to internal resources or silent downloads from untrusted locations.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Remote download capability is not necessary for the stated local OCR conversion purpose and expands the attack surface. If the upstream parser or a crafted document can influence image references, the script may retrieve attacker-controlled content or access internal endpoints without the user's awareness.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The conversion flow sends document-derived content to an external OCR/parsing API through parse_document, yet the CLI does not provide an explicit warning or consent mechanism. In this skill's context—legal PDFs, medical records, and evidence scans—the transmitted data is likely highly sensitive, making undisclosed network exfiltration a significant privacy and compliance risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script archives the original input, extracted markdown, images, and metadata by default unless --no-archive is supplied. For a skill intended for legal case files, medical records, and evidence documents, silent retention of sensitive materials on disk materially increases confidentiality, forensic, and compliance exposure if the machine is shared or later compromised.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

Manifest 说明技能“默认将本地 PDF 或图片转换为 Markdown”,但该调用脚本的稳定输出是 JSON envelope,并且默认写入 .json 文件。虽然底层解析结果可能间接包含 Markdown,但从该文件可见的实际接口行为与“默认输出 Markdown”不一致。

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Manifest 描述强调默认处理本地 PDF 或图片,并未说明该技能还可接收远程文件 URL。此脚本通过 --file-url 暴露远程输入能力,属于对外部资源访问的额外行为,与面向本地文档 OCR 的描述存在语义偏差。

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script writes OCR results by default into a predictable temp-directory subtree without explicit user acknowledgement, which can persist sensitive legal, medical, or evidentiary data on disk. In the context of this skill, the extracted content is likely highly sensitive, so silent persistence increases the risk of local disclosure, retention beyond user intent, and accidental exposure to other processes or operators with filesystem access.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file contains multiple natural-language strings presented to users exclusively in Chinese, such as configuration and runtime error messages. Because no language selection, opt-in, or documented region-specific justification is provided, this creates a language/locale policy issue.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This code sends the assembled payload to a remote API, and that payload can include either a base64-encoded local document or a user-supplied file URL. The file contains no confirmation prompt, print/log disclosure, or comment/docstring warning that document data will be transmitted to an external service.

Content

No source excerpt is available for this finding.