Back to skill

Security audit

Vehicle License Ocr

Security checks for vulnerabilities and agentic risk

Overview

This vehicle-license OCR skill mostly does what it says, but it sends sensitive document images to a remote API and allows the upload endpoint to be reconfigured without enough disclosure or safeguards.

Review this skill before installing. Only use it with vehicle-license files you are allowed to send to Scnet, confirm the exact file path before invocation, and do not set `SCNET_API_BASE` to any untrusted or non-HTTPS endpoint. Keep the API key in a protected local config file and consider pinning dependencies in an isolated 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:78
Finding

Configurable API base can expose credentials and sensitive documents to an arbitrary server

Content
View full analysis

Vulnerability Details

File Location: scripts/main.py:78-112
Vulnerability Type: Unrestricted sensitive-data transmission endpoint
Risk Level: Medium

Vulnerable Code

python
config.setdefault('SCNET_API_BASE', 'https://api.scnet.cn/api/llm/v1')
return config

def recognize_with_retry(ocr_type, file_path, config, retry_count=0):
    """
    带重试机制的 OCR 识别函数。
    当遇到 429 (Too Many Requests) 时,自动等待后重试。
    调用 Scnet OCR API 进行识别"""
    api_base = config['SCNET_API_BASE']
    api_key = config['SCNET_API_KEY']
    url = f"{api_base}/ocr/recognize"

    # 检查文件是否存在
    if not os.path.isfile(file_path):
        sys.exit(f"错误: 文件不存在 - {file_path}")

    # 自动检测 MIME 类型
    mime_type, _ = mimetypes.guess_type(file_path)
    if mime_type is None:
        mime_type = 'application/octet-stream'

    headers = {
        'Authorization': f'Bearer {api_key}'
    }

    try:
        with open(file_path, 'rb') as f:
            files = {
                'file': (os.path.basename(file_path), f, mime_type)
            }
            data = {
                'ocrType': ocr_type,
                'channelTag': "scnetSkills"
            }
            response = requests.post(url, headers=headers, data=data, files=files, timeout=60)

Technical Analysis

The optional SCNET_API_BASE setting is used directly to construct the request URL without validating its scheme, hostname, port, or trust relationship. The resulting request contains both the Scnet bearer credential and the complete user-selected document.

Although uploading a document is necessary for the declared remote OCR functionality, the documented service only requires access to https://api.scnet.cn/api/llm/v1/ocr/recognize. Permitting an unrestricted destination exceeds that minimum requirement. A malicious or incorrectly modified configuration can use an attacker-controlled HTTPS host or even plaintext HTTP.

The HTT ...[truncated 1417 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove SCNET_API_BASE configurability unless custom service endpoints are an explicit functional requirement.
  2. If configuration is required, parse the URL and enforce:
    • The https scheme.
    • An explicit allowlist of trusted hostnames.
    • Expected ports only.
    • No embedded username or password.
    • A normalized, expected API path.
  3. Bind the Scnet bearer token to the official Scnet hostname and refuse to attach it to any other destination.
  4. Disable automatic redirects with allow_redirects=False, or validate every redirect target before resending credentials or files.
  5. Display the upload destination and obtain informed user consent before sending identity-related documents.
  6. Document the external transmission, expected recipient, retention implications, and fields that may be extracted.
  7. Add tests confirming that HTTP URLs, unapproved hosts, unexpected ports, and cross-origin redirects are rejected.

T08 · Insecure Dependencies

Note
Location
SKILL.md:65
Finding

Unpinned third-party dependency installation creates supply-chain exposure

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:65-70
Vulnerability Type: Unpinned dependency installation
Risk Level: Low

Vulnerable Code

markdown
### Dependency Installation

This Skill requires Python 3.6+ and the requests library. Run:

```bash
   pip install requests
text

### Technical Analysis

The installation instructions retrieve the currently resolved version of `requests` and its transitive dependencies without fixed versions or integrity hashes. This makes installation results non-reproducible and means a future compromised, malicious, or incompatible release could be installed without a corresponding review of the Skill.

The dependency name is correctly spelled, and the instructions do not specify an untrusted package index. Therefore, the available evidence supports a dependency-hardening weakness rather than intentional dependency confusion or typosquatting.

### Attack Path

1. A user follows the documented `pip install requests` instruction.
2. Package resolution selects versions available from the configured Python package index at installation time.
3. If a selected package or transitive dependency has been compromised, the affected code is installed.
4. Malicious package installation hooks or imported runtime code execute with the permissions of the user running the installation or Skill.

### Impact Assessment

The potential scope is the Python environment and operating-system permissions of the installing user. Depending on a compromised package's behavior, impact could include arbitrary code execution, access to files available to that user, credential theft, or modification of the environment.

Exploitation depends on compromise or unsafe resolution of an upstream package; no malicious dependency or package source was identified in the audited project.
Remediation
View remediation

Remediation Suggestions

  1. Create a reviewed requirements file with exact versions for requests and relevant transitive dependencies.
  2. Record package hashes and install with:
    bash
    pip install --require-hashes -r requirements.txt
    
  3. Perform installation inside an isolated virtual environment with minimal privileges.
  4. Periodically review and update pinned versions to receive security fixes.
  5. Use automated dependency vulnerability scanning while retaining manual review of version changes.
  6. Document the expected package index and avoid untrusted or implicitly configured indexes.
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
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (22)

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/main.py (reported line 20)May include surrounding context.

python
# 获取技能根目录(脚本所在目录的上一级)
SKILL_ROOT = Path(__file__).parent.parent.absolute()
ENV_FILE = SKILL_ROOT / "config" / ".env"

# --- 新增:重试配置 ---
MAX_RETRIES = 3            # 最大重试次数

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 62)May include surrounding context.

md
# --------------------

def load_config():
    """从 .env 文件加载配置,若文件不存在则抛出友好错误"""
    if not ENV_FILE.exists():
        error_msg = (
            "\n===============================================\n"

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 124)May include surrounding context.

md
# --------------------

def load_config():
    """从 .env 文件加载配置,若文件不存在则抛出友好错误"""
    if not ENV_FILE.exists():
        error_msg = (
            "\n===============================================\n"

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/main.py (reported line 29)May include surrounding context.

python
# --------------------

def load_config():
    """从 .env 文件加载配置,若文件不存在则抛出友好错误"""
    if not ENV_FILE.exists():
        error_msg = (
            "\n===============================================\n"

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The README describes a skill that performs OCR on vehicle licenses, which are sensitive identity and vehicle records, but provides no user-facing disclosure about what data is collected, where it is sent, how long it is retained, or how it should be handled safely. This omission can lead users to process regulated personal data without informed consent or proper safeguards, increasing privacy, compliance, and misuse risk.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · README.md (reported line 38)May include surrounding context.

md
* [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/)
* [Analyze your code for known vulnerabilities with Static Application Security Testing (SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
* [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
* [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
* [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill documentation indicates capabilities that read local files, invoke Python from the shell, and send data to an external API, but it does not declare any explicit tool scope or allowed-tools restrictions. In an agent environment, this weakens containment and can allow broader-than-necessary access when the skill is triggered, increasing the chance of unintended file access or outbound data transfer.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
91% confidence
Finding

The skill is designed to transmit user-provided images of vehicle licenses to an external OCR API endpoint. Because vehicle licenses contain sensitive personal and vehicle data, this external transmission creates privacy and compliance risk if users are not clearly informed and if data handling, retention, and destination controls are not tightly defined.

Content

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

SCNET_API_KEY=your_scnet_api_key_here

API 基础地址(一般无需修改)

SCNET_API_BASE=https://api.scnet.cn/api/llm/v1

text
2. 添加:`SCNET_API_KEY=你的密钥`
3. 设置文件权限为 600(仅所有者可读写)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The trigger guidance says the AI may automatically invoke the skill based on broad description keywords and a user mention of an image path, without clearly constraining confirmation, file provenance, or sensitivity checks. In an agent setting, overly broad invocation criteria can cause the model to process unintended local files or transmit sensitive identity documents to a third-party OCR service without sufficiently explicit user intent.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
91% confidence
Finding

This configuration again confirms outbound transmission to a third-party OCR endpoint, which is significant given the skill processes sensitive identity-related documents. The security concern is not the mere presence of a URL, but that the skill context involves personal document data leaving the local environment.

Content

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

md
| 变量名 | 默认值 | 说明 |
|--------|--------|------|
| SCNET_API_KEY | 必需 | Scnet API 密钥 |
| SCNET_API_BASE | https://api.scnet.cn/api/llm/v1 | API 基础地址(一般无需修改) |

### 输出

External Transmission

Medium
Category
Data Exfiltration
Confidence
84% confidence
Finding

This skill depends on sending uploaded documents to an external domain (api.scnet.cn), which creates a real data-exfiltration path outside the local trust boundary. In the context of vehicle-license OCR, the transmitted content is sensitive regulated personal and vehicle data, so the external transmission is materially security-relevant even if it is core functionality rather than overtly malicious behavior.

Content

Scanner excerpt · references/api-docs.md (reported line 4)May include surrounding context.

md
# Sugon-Scnet OCR API 文档摘要

## 接口地址
`POST https://api.scnet.cn/api/llm/v1/ocr/recognize`

## 请求头
- `Content-Type: multipart/form-data`

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The documentation instructs clients to upload potentially sensitive identity and vehicle-license images to a third-party OCR endpoint, but it provides no privacy notice, consent requirement, retention policy, or guidance on handling personal data. In this skill context, that omission is more dangerous because the payloads and OCR results include highly sensitive PII such as names, addresses, ID numbers, vehicle identifiers, and document images.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · scripts/main.py (reported line 45)May include surrounding context.

python
"   b) 配置文件:\n"
            f"      mkdir -p {SKILL_ROOT}/config\n"
            f"      echo 'SCNET_API_KEY=你的密钥' > {ENV_FILE}\n"
            f"      chmod 600 {ENV_FILE}\n"
            "\n配置完成后重新运行。"
        )
        sys.exit(error_msg)

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · scripts/main.py (reported line 152)May include surrounding context.

python
"   b) 配置文件:\n"
            f"      mkdir -p {SKILL_ROOT}/config\n"
            f"      echo 'SCNET_API_KEY=你的密钥' > {ENV_FILE}\n"
            f"      chmod 600 {ENV_FILE}\n"
            "\n配置完成后重新运行。"
        )
        sys.exit(error_msg)

External Transmission

Medium
Category
Data Exfiltration
Confidence
91% confidence
Finding

This skill is explicitly configured to transmit files to an external service at api.scnet.cn, which constitutes real external data exfiltration from the local environment to a third party. In this context, the uploaded documents are vehicle licenses containing personal and regulated data, so remote transmission increases privacy, compliance, and trust risks even if HTTPS is used.

Content

Scanner excerpt · scripts/main.py (reported line 78)May include surrounding context.

python
)
        sys.exit(error_msg)

    config.setdefault('SCNET_API_BASE', 'https://api.scnet.cn/api/llm/v1')
    return config

def recognize_with_retry(ocr_type, file_path, config, retry_count=0):

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script sends a user-provided vehicle-license image to a third-party OCR endpoint, which is a real privacy/security concern because vehicle registration documents contain sensitive personal and vehicle identifiers. The issue is made more serious by the skill context: users may reasonably expect local OCR, but the actual transmission happens automatically without an explicit consent prompt at the moment of upload.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest requires an API key and optional API base, which means the skill sends user data to an external service, but it provides no user-facing disclosure about that external interaction or credential usage. In an OCR skill handling vehicle license data, this is more sensitive than usual because documents may contain personal and vehicle-identifying information that users may not realize is transmitted off-platform.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

This markdown file contains user-facing natural-language content entirely in Chinese, including the title and change entry. Under the policy, forcing a specific language without user opt-in or a documented justification can be a locale-policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The natural-language documentation and user-facing invocation examples are entirely in Chinese, with no indication that users may choose another language or that the locale restriction is intentional and justified. This may violate language/locale policy where skills should not impose a language without user opt-in.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

Line L025 says '结婚证识别 OCR 技能' while the manifest name/description and subsequent feature list describe '行驶证识别'. This is an active documentation contradiction about the skill's purpose, not merely an omission.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

User-facing docstrings, usage text, and error messages are written exclusively in Chinese, and the script does not offer any language choice or note that it is intentionally region-specific. Under the policy, forcing a specific language without opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

The manifest description is written entirely in Chinese and does not indicate that language is user-selectable or that the skill is intentionally limited to Chinese-speaking users. This can violate language/locale policy when a skill appears to force a specific language without opt-in or justification.

Content

No source excerpt is available for this finding.