Back to skill

Security audit

TencentCloud MLIDPassport OCR

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward Tencent Cloud passport OCR wrapper, but users should treat submitted passport images and returned fields as highly sensitive personal data.

Install only if you intend to send passport images or passport image URLs to Tencent Cloud for OCR. Use a restricted Tencent Cloud key, avoid enabling cropped face-image return unless needed, process only documents you are authorized to handle, and consider pinning the SDK dependency in your own environment.

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

Warning
Location
scripts/main.py:70
Finding

Image size validation occurs after an unbounded file read

Content
View full analysis
MAX_IMAGE_SIZE_BYTES: print(f"Error: Image exceeds the {MAX_IMAGE_SIZE_BYTES // (1024 * 1024)} MB limit", file=sys.stderr) sys.exit(1) encoded = base64.b64encode(raw).decode("utf-8") ``` The comments and error message above are translated into English for presentation; the executable behavior matches the audited source. ### Technical Analysis The code calls `f.read()` without a size argument, loading the complete user-selected file into memory before checking whether it exceeds `MAX_IMAGE_SIZE_BYTES`. The nominal 10 MB restriction therefore does not protect the process from memory exhaustion. The Base64-text branch also returns immediately after validating the encoding syntax. It does not enforce the decoded-size limit before returning, so an oversized Base64 document can bypass the intended input-size validation. This is an insecure resource-handling issue rather than evidence of covert exfiltration. The Base64 conversion itself is necessary for the declared Tencent Cloud OCR API and is not malicious. ### Attack Path 1. An attacker creates or identifies a file substantially larger than available process memory. 2. The attacker causes the Skill to be invoked with that path through `--image-base64`. 3. `os.path.isfile()` accepts the path. 4. `f.read()` attempts to load the entire file before the size check is reached. 5. The Python proc ...[truncated 899 chars]
Remediation
View remediation
MAX_ENCODED_INPUT_SIZE: raise ValueError("Input file is too large") with open(value, "rb") as file: raw = file.read(MAX_ENCODED_INPUT_SIZE + 1) if len(raw) > MAX_ENCODED_INPUT_SIZE: raise ValueError("Input file is too large") try: raw_str = raw.decode("ascii").strip() decoded = base64.b64decode(raw_str, validate=True) if len(decoded) > MAX_IMAGE_SIZE_BYTES: raise ValueError("Decoded image is too large") return raw_str except (UnicodeDecodeError, ValueError): pass ``` ]]>

T08 · Insecure Dependencies

Note
Location
SKILL.md:35
Finding

Tencent Cloud SDK installation instruction does not pin a reviewed version

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (4)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill handles passport images and extracts identity attributes such as passport number, name, birth date, nationality, and MRZ data, but it does not warn users that this is highly sensitive personal data or that it will be sent to a third-party cloud OCR provider. Without a clear warning and consent flow, users may unknowingly expose regulated identity information, creating significant privacy, compliance, and misuse risks.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
85% confidence
Finding

The skill relies on environment-based secrets (TENCENTCLOUD_SECRET_ID and TENCENTCLOUD_SECRET_KEY) but does not declare any explicit tool scope or permissions boundary. In an agent setting, missing scope declarations can cause the skill to be invoked with broader-than-necessary ambient authority, increasing the chance of unintended secret access or unsafe composition with other capabilities.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger conditions include broad catch-all language like '涉及护照OCR识别的任何场景' and '涉及多国多地区护照识别的场景,' which makes the skill activate in ambiguous situations. Because this skill processes highly sensitive identity documents, overbroad activation can cause unnecessary collection, transmission, or extraction of passport data when a narrower or safer response would suffice.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This skill transmits highly sensitive passport images and extracted identity data to Tencent Cloud OCR, but the code provides no explicit user-facing warning, consent check, or privacy notice at the point of transmission. Because passports contain government ID numbers, nationality, birth date, and potentially cropped face images, sending them to a third-party remote service without clear disclosure materially increases privacy, compliance, and data-handling risk.

Content

No source excerpt is available for this finding.