Back to skill

Security audit

VIN Recognition OCR - VIN识别

Security checks for vulnerabilities and agentic risk

Overview

This VIN OCR skill is mostly coherent, but its local file handling can unintentionally send non-image local files to a third-party API through symlinks.

Review before installing. Use this only in a controlled working directory with images you intentionally want to send to JisuAPI, avoid passing paths that may be symlinks, and prefer base64 input from a known image. The publisher should fix path canonicalization, reject symlinks, validate image type and size locally, and add a clearer privacy notice for third-party processing.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Error
Location
vinrecognition.py:30
Finding
Symbolic-Link Bypass Allows Unintended Local File Disclosure to an External API<![CDATA[ ## Vulnerability Details **File Location**: `vinrecognition.py`, lines 30-48, 95-108, and 139-140 **Vulnerability Type**: Insufficient path containment validation and external disclosure of local file contents **Risk Level**: High ### Vulnerable Code ```python def _normalize_local_path(user_path: str, field: str) -> Dict[str, Any]: """ 规范化并限制本地文件路径,只允许在当前工作目录及其子目录内读取。 禁止绝对路径和目录穿越(包含 ..),避免被恶意提示利用读取任意系统文件。 """ if not user_path: return { "error": "invalid_param", "message": f"field '{field}' is empty", } if os.path.isabs(user_path): return { "error": "invalid_path", "message": f"Absolute path is not allowed for '{field}'", } norm = os.path.normpath(user_path) if norm.startswith("..") or norm == "..": return { "error": "invalid_path", "message": f"Path traversal is not allowed for '{field}'", } base = os.getcwd() full = os.path.join(base, norm) return {"error": None, "path": full, "relative": norm} ``` ```python path = safe["path"] if not os.path.isfile(path): return {"pic": None, "error": f"File not found: {safe['relative']}"} try: with open(path, "rb") as f: raw = f.read() except Exception as e: return {"pic": None, "error": f"Failed to read file: {e}"} try: encoded = base64.b64encode(raw).decode("utf-8") except Exception as e: return {"pic": None, "error": f"Failed to base64-encode file: {e}"} ``` ```python result = _call_vin_api(appkey, pic_info["pic"]) print(json.dumps(result, ensure_ascii=False, indent=2)) ``` The encoded content is transmitted by `_call_vin_api` as follows: ```python VIN_RECOG_URL = "https://api.jisuapi.com/vinrecognition/recognize" def _call_vin_api(appkey: str, pic_base64: str) -> Dict[str, Any]: params = {"appkey": appkey} data = {"pic": pic_base64} try: resp = requests.post(VIN_RECOG_URL, params=params, da ...[truncated 2699 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Resolve the canonical working directory and requested path before opening the file: ```python from pathlib import Path base = Path.cwd().resolve() candidate = (base / user_path).resolve(strict=True) try: candidate.relative_to(base) except ValueError: return { "error": "invalid_path", "message": f"Path escapes the allowed directory for '{field}'", } ``` 2. Explicitly reject symbolic links when they are unnecessary for the Skill: ```python unresolved = base / user_path if unresolved.is_symlink(): return { "error": "invalid_path", "message": "Symbolic links are not allowed", } ``` If nested path components must also be protected, inspect every component or use a platform-supported safe-open mechanism. 3. Reduce time-of-check-to-time-of-use risk. On supported systems, open files using `os.open()` with `O_NOFOLLOW`, then validate the opened file descriptor with `os.fstat()` before reading it. 4. Confirm that the opened object is a regular file and enforce a strict maximum size before loading it into memory. The documented API indicates a 300 KB image limit, so rejecting larger files locally would reduce both disclosure scope and resource exhaustion risk. 5. Validate the file as an allowed image format using content-based checks rather than trusting its name or extension. Reject malformed and unsupported content before any network transmission. 6. Use a dedicated upload directory with restrictive permissions instead of allowing access to the entire current working directory. 7. Inform users clearly that selected images are transmitted to JisuAPI. Where supported by the provider, pass the API key through an authorization header rather than a URL query parameter to reduce exposure in proxy and server URL logs. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (7)

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding
Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Lp3

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding
The skill requires environment access for an API key and makes outbound network requests, but the manifest does not declare any explicit tool scope such as permissions or allowed-tools. This weakens reviewability and runtime containment because users and platform controls cannot clearly see or limit the skill's actual capabilities.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill sends vehicle VIN images to a third-party API service but does not present a user-facing privacy warning or consent notice. VINs and associated vehicle documents can be sensitive, and silent transmission to an external provider creates privacy, compliance, and user-trust risks.

Natural-Language Policy Violations

Medium
Confidence
87% confidence
Finding
The module docstring presents the skill description and API reference exclusively in Chinese, while the file otherwise mixes English and Chinese. For a general-purpose skill, this imposes a locale/language choice without any user opt-in or documented region-specific justification, which matches the language-policy concern for natural-language content.

External Transmission

Medium
Category
Data Exfiltration
Content
import requests


VIN_RECOG_URL = "https://api.jisuapi.com/vinrecognition/recognize"


def _normalize_local_path(user_path: str, field: str) -> Dict[str, Any]:
Confidence
84% confidence
Finding
The skill transmits image data, potentially containing VINs and surrounding vehicle information, to an external third-party API. Even though this is necessary for the OCR function and uses HTTPS, it still creates a real data-exposure boundary: sensitive user-provided content leaves the local environment and is subject to third-party handling, retention, and compliance risks.

Context-Inappropriate Capability

Medium
Confidence
84% confidence
Finding
The manifest describes a VIN image recognition skill, but the implementation also depends on reading a secret from the process environment. Accessing environment-held credentials is not mentioned in the stated purpose and is not an obvious user-facing VIN OCR capability.

Description-Behavior Mismatch

Low
Confidence
82% confidence
Finding
The manifest describes this skill as recognizing VIN images and returning VIN plus brand/manufacturer-related information. However, the documentation's recommended usage says the agent may additionally use a `vin/query` interface to obtain more detailed vehicle configuration information, which expands beyond OCR recognition into vehicle data lookup.

Static analysis

No suspicious patterns detected.