Back to skill

Security audit

批量身份证 OCR 提取工具 (导出 TXT 版)

Security checks for vulnerabilities and agentic risk

Overview

The skill performs the advertised ID-card OCR task, but it handles highly sensitive identity data with weak safeguards and should be reviewed before installation.

Install only if you are authorized to process these ID-card images, are comfortable sending them to Tencent Cloud OCR, and can tolerate a plaintext attachment containing full identity details. Prefer a revised version that uses per-request private temporary files, cleans them up after delivery, pins dependencies, and clearly documents consent, retention, and secure handling requirements.

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

T09 · Insecure Skill Coding Practices

Error
Location
batch_id.py:51
Finding

Predictable Shared Temporary File Can Expose ID Card Data Across Requests

Content
View full analysis

Vulnerability Details

File Location: batch_id.py, lines 51–59
Vulnerability Type: Predictable and shared temporary file containing sensitive personal data
Risk Level: High

Vulnerable Code

python
file_path = "/tmp/身份证提取结果.txt"
with open(file_path, "w", encoding="utf-8") as f:
    f.write(final_file_text)

# 5. Return the file to OpenClaw
# The OpenClaw file-return protocol normally requires a file path or Base64 data
return {
    "result": f"✅ Successfully extracted information from {len(all_content)} ID cards. Please see the attachment.",
    "files": [file_path]
}

Technical Analysis

Every invocation writes highly sensitive ID card information to the same predictable path under /tmp. There is no request-specific filename, exclusive file creation, synchronization, restrictive permission assignment, or cleanup.

In a reused or concurrent runtime, multiple invocations can access and overwrite the same file. The returned response identifies only the shared path, so the platform may read it after another invocation has replaced its contents. This creates a time-of-check/time-of-use race that can cause one user's file response to contain another user's identity information.

The output contains names, sex, and national identification numbers. Leaving the file behind also increases the period during which later processes or invocations may access stale personal data. The effective default permissions depend on the process umask and are not explicitly restricted by the Skill.

Attack Path

  1. A victim invokes the Skill with one or more ID card images.
  2. The victim's OCR results are written to /tmp/身份证提取结果.txt.
  3. Before the platform consumes the returned file, an attacker triggers another invocation, or the attacker's invocation is interleaved with the victim's invocation.
  4. Both invocations write to the same path without locking or exclusive creation.
  5. Depending on executi ...[truncated 767 chars]
Remediation
View remediation

Remediation Suggestions

  • Create a unique private file for each invocation using tempfile.NamedTemporaryFile, tempfile.mkstemp, or a request-specific directory generated with tempfile.mkdtemp.
  • Ensure the file is created atomically with permissions limited to the owner, preferably mode 0600.
  • Never derive the temporary filename from user-controlled input.
  • Ensure the platform consumes the file before deletion, then remove it in a finally block or through a documented post-delivery cleanup mechanism.
  • Where supported, return the generated content as an in-memory byte stream or Base64 payload instead of writing sensitive information to disk.
  • Add concurrency tests that run multiple invocations simultaneously and verify that each response contains only its own records.
  • Minimize retention of OCR results and document the handling lifecycle for identity data.

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Unbounded Dependency Version Allows Unreviewed Future Releases

Content
View full analysis

Vulnerability Details

File Location: requirements.txt, line 1
Vulnerability Type: Unpinned third-party dependency
Risk Level: Medium

Vulnerable Code

text
tencentcloud-sdk-python>=3.0.0

Technical Analysis

The dependency specification accepts every package release at or above version 3.0.0. Consequently, separate deployments can install different code even when the Skill source has not changed.

Python packages execute code within the Skill's process and inherit its accessible environment, filesystem permissions, network access, and Tencent Cloud credentials. If a future compatible release is compromised, malicious, or introduces a security regression, it can be installed automatically without an explicit source change or security review.

The requirement also lacks integrity hashes, so the installation process does not independently verify that an approved artifact was selected.

Attack Path

  1. A future version of tencentcloud-sdk-python available from the configured package index is compromised or contains malicious or vulnerable code.
  2. The Skill is installed or rebuilt after that version becomes available.
  3. The package resolver selects the new release because it satisfies the open-ended minimum-version constraint.
  4. The package is imported by batch_id.py and executes within the Skill process.
  5. Compromised dependency code can access resources available to that process, potentially including Tencent Cloud credentials, OCR inputs, OCR responses, generated identity records, local files, and outbound network connectivity.

Impact Assessment

The dependency itself does not directly provide additional privileges, but malicious package code would execute with the full privileges of the Skill process. The resulting scope can include credential theft, disclosure or modification of ID card data, unauthorized Tencent Cloud API activity within the credentials' permissions, and ...[truncated 61 chars]

Remediation
View remediation

Remediation Suggestions

  • Replace the open-ended requirement with an exact version that has been tested and reviewed, for example tencentcloud-sdk-python==<reviewed-version>.
  • Generate a lock file or fully pinned requirements file that includes all transitive dependencies.
  • Require package hashes during installation, such as with pip's --require-hashes, to ensure only approved artifacts are installed.
  • Obtain dependencies exclusively from a trusted package index and enforce TLS certificate validation.
  • Use an automated dependency update process that performs vulnerability scanning, release review, and regression testing before changing the pinned version.
  • Run the Skill with minimal filesystem, network, and cloud permissions so that a compromised dependency has a reduced impact.
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 (12)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill sends user-supplied identity-card image URLs to an external OCR provider without an explicit disclosure, consent step, or data-transfer warning. In context this is more dangerous because the transmitted content is government ID imagery, which contains highly sensitive PII and may trigger regulatory obligations for third-party processing and cross-boundary data handling.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
94% confidence
Finding

The code creates a local file containing extracted identity-card data and returns it as an attachment without warning the user that a sensitive file artifact will be generated. This increases the chance of accidental redistribution, storage in downstream systems, or exposure to other components handling attachments, especially because the file contains full identity details.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill description says it extracts up to 50 ID cards and generates a .txt file to send to the user, but it does not warn that this involves highly sensitive personal identity information. Omitting that warning can mislead users or downstream agents into handling, transmitting, or storing regulated data without informed consent, appropriate safeguards, or minimization, increasing privacy and compliance risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill is explicitly designed to process highly sensitive government ID data and export extracted personal identifiers to a text file, but the documentation provides no warning about consent, lawful use, retention, or the risks of uploading other people's identity documents. In this context, omission of privacy and authorization guidance materially increases the chance of misuse, unauthorized processing, and accidental disclosure of regulated personal data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill reads tencent-secret-id and tencent-secret-key from configuration and uses them to authenticate with Tencent Cloud, but there is no user-facing notice, confirmation, or warning in the code about credential usage. Because credential access is a safety-relevant operation under the rule, some disclosure should be present.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill performs OCR on identity cards and extracts names, sex, and government ID numbers, which are highly sensitive personal identifiers. In this skill context there is no stated purpose limitation, consent flow, minimization, or retention control, so the behavior creates a real privacy and compliance risk if used on user-supplied documents.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code persists extracted ID-card data to a plaintext local file in /tmp, increasing the exposure surface beyond transient in-memory processing. Writing sensitive identity data to disk without encryption, access controls, or a clear necessity raises the risk of unintended disclosure through logs, attachments, debugging, or leftover temporary artifacts.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The description advertises a broad capability to extract information from up to 50 ID images and send a text file, but it does not define who may invoke it, under what circumstances, or what guardrails apply. That ambiguity can cause unintended activation on sensitive documents, overcollection of personal data, or use in contexts lacking authorization or user awareness.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
75% confidence
Finding

The manifest description is entirely in Chinese and presents the skill behavior in a single language without indicating that users may choose another language or that the skill is intentionally restricted to a Chinese-speaking context. This can violate language or locale policy when no opt-in or justification is provided.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
75% confidence
Finding

The natural-language instructions, field names, and usage flow are entirely Chinese and assume Chinese ID-card processing, but the file does not explicitly state that the skill is region- or locale-specific. Under the policy, forcing a specific language or locale without opt-in can be a natural-language policy issue unless the constraint is clearly documented and justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

All visible result messages and the generated output labels are written only in Chinese, with no indication that the user can select another language. This can violate language/locale policy when a skill enforces a locale-specific experience without opt-in or documented justification.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
92% confidence
Finding

The dependency is specified with a lower bound only (>=3.0.0), which allows installation of any newer version, including unreviewed releases that may introduce breaking changes or supply-chain risk. While this is common in development, it weakens reproducibility and can expose deployments to vulnerable or malicious upstream versions if dependency resolution occurs later.

Content

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

text
tencentcloud-sdk-python>=3.0.0