Back to skill

Security audit

rapid ocr

Security checks for vulnerabilities and agentic risk

Overview

This OCR skill is purpose-aligned and transparent about its first-run model download, but users should be aware of sensitive document output and dependency supply-chain limits.

Install this only if you are comfortable with a PyPI OCR dependency and a first-run model download. Use a sandbox or pinned dependency set for sensitive invoices or travel records, and avoid sending OCR output to shared logs or terminals unless that is intended.

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
requirements.txt:1
Finding

Unpinned Third-Party Dependency and Unverified Runtime Model Retrieval

Content
View full analysis

Vulnerability Details

File Location: requirements.txt:1
Related Locations: rapidocr_minimal.py:9, 18; models/README.md:45-47; README.md:9
Vulnerability Type: Supply-chain exposure through an unpinned dependency and unverified runtime artifacts
Risk Level: Medium

Vulnerable Code

text
rapidocr-onnxruntime>=1.2.3

The dependency is imported and initialized as follows:

python
from rapidocr_onnxruntime import RapidOCR

class RapidOCRSkill:
    def __init__(self):
        # Use the default configuration. Models are downloaded on first use.
        self.ocr = RapidOCR()

The documented pre-download procedure invokes the same dependency directly:

bash
python -c "from rapidocr_onnxruntime import RapidOCR; RapidOCR()"

Technical Analysis

The version constraint >=1.2.3 permits installation of any future release of rapidocr-onnxruntime. The project includes neither a lockfile nor package hashes, so installations are not reproducible and cannot ensure that the audited dependency version is the one ultimately executed.

The package is imported at module load time and initialized through RapidOCR(). Consequently, code supplied by the installed package executes within the Python process and inherits the process's privileges and access to OCR input files.

The project documentation further states that the dependency obtains OCR models automatically on first invocation. However, the project does not pin exact model revisions or provide expected cryptographic checksums or signatures. Although no malicious behavior was found in the Skill's own source code, trust is delegated to mutable external package and model distribution channels.

This finding does not establish that the current dependency or models are malicious. It identifies an avoidable supply-chain weakness that could become exploitable if a future package release, package repository account, distribution endpoint, or artifact is compromised.

Attac

...[truncated 1755 chars]

Remediation
View remediation

Remediation Suggestions

  1. Replace the open-ended version constraint with an exact, reviewed version:

    text
    rapidocr-onnxruntime==<reviewed-version>
    
  2. Generate a hash-locked dependency file and require hash verification during installation:

    bash
    pip install --require-hashes -r requirements.txt
    
  3. Pin all transitive dependencies through a reproducible lockfile generated from a controlled environment.

  4. Record the exact expected model versions, canonical download URLs, file sizes, and SHA-256 hashes.

  5. Verify every downloaded model against a trusted cryptographic digest before loading it. Reject missing, mismatched, or unexpectedly redirected artifacts.

  6. Prefer reviewed, locally provisioned model files for sensitive or offline deployments. Disable automatic downloads where the dependency supports that configuration.

  7. Install dependencies from a trusted, access-controlled package mirror and incorporate dependency provenance, vulnerability, and integrity checks into CI.

  8. Run OCR under a dedicated, least-privileged account or sandbox with access restricted to required input files and model directories. Deny unnecessary outbound network access after approved artifacts have been provisioned.

  9. Review dependency updates explicitly rather than accepting future releases automatically.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (8)

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The usage examples require commands such as "call 票据识别" and "call 文字识别", which impose a specific language for activation. The document does not state that the skill is intentionally China/Chinese-only or provide an alternative language option, so this is a natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The file presents all user-facing instructions and descriptions in Chinese, beginning with the section headers and continuing throughout the document. Under the policy rule, forcing a specific language without user opt-in or justification can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file presents all operational warnings and usage guidance only in Chinese, effectively forcing a specific language on users without opt-in. The policy allows locale constraints only when they are documented and justified or when users are offered a language choice, neither of which appears here.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This skill is designed to OCR invoices and train tickets, both of which commonly contain personal, financial, and travel data, and the script prints structured results directly to stdout without any warning or privacy controls. In shared terminals, logs, agent traces, or downstream telemetry, this can cause unintended disclosure of sensitive information even if the OCR logic itself is functioning as intended.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill instantiates RapidOCR with default behavior that, per the code comment, automatically downloads OCR models on first run. That creates undeclared network activity and a supply-chain exposure path in a tool whose visible purpose is local OCR processing, which can violate offline assumptions and expand attack surface if the remote artifact source is compromised.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

This is a markdown file, so SQP-2 applies to missing user warnings in documentation. The README states that models are automatically downloaded during first run, but it does not explicitly warn users that running the skill will initiate network access and fetch files from an external source, which can affect privacy, connectivity expectations, or controlled environments.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The natural-language description and user-facing comments/documentation are presented in Chinese only, which can amount to forcing a specific language without user opt-in. There is no indication that the skill is intentionally region-specific or that alternative language support is unavailable by design.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

The dependency is specified with a lower-bound only (>=1.2.3), which allows installation of any newer version, including unreviewed major releases that may introduce malicious code, breaking changes, or newly published vulnerable transitive dependencies. In a supply-chain context, this reduces build reproducibility and makes the deployed package set vary over time, increasing the risk of compromise or unexpected insecure behavior.

Content

Scanner excerpt · requirements.txt (reported line 1)May include surrounding context.

text
rapidocr-onnxruntime>=1.2.3

Static analysis

No suspicious patterns detected.