Back to skill

Security audit

bill_of_lading_ocr

Security checks for vulnerabilities and agentic risk

Overview

This OCR skill is mostly coherent and disclosed, but it can send a user-selected sensitive document and API token to a configurable network endpoint without validating that the endpoint is Scnet.

Review before installing. Only use this with bill-of-lading files you are authorized to upload to Scnet, and do not place regulated or confidential documents through it unless your organization approves that vendor. Keep SCNET_API_BASE fixed to the documented https://api.scnet.cn/api/llm/v1 endpoint or add endpoint validation before use, because a changed value could send both the document and API key elsewhere.

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
scripts/main.py:78
Finding

Unrestricted OCR API endpoint permits disclosure of the API credential and selected local file

Content
View full analysis
Remediation
View remediation
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 (18)

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 68)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 135)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"

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 declares capabilities to read local files, invoke Python from the shell, and transmit data over the network, but it does not define an explicit tool scope such as permissions or allowed-tools. This creates a governance gap: an agent/runtime may permit broader execution than users expect, increasing the chance of unintended file access or exfiltration when the skill is invoked.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest description at L003 forces a specific language presentation, and the rest of the skill documentation is likewise Chinese-only. Under the policy, language constraints should either be optional for the user or clearly justified as region-specific; neither is stated here.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
88% confidence
Finding

The skill explicitly uploads user-selected local bill-of-lading files to an external OCR service at api.scnet.cn. Because these documents may contain commercial or personal data, this creates a real data-exfiltration/privacy risk if users misunderstand the workflow, provide sensitive files, or if the external service is not approved for the data involved.

Content

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

md
## 前置配置

> **⚠️ 数据外传警告**:本技能调用 Scnet 在线 OCR 服务,你需要将待识别的本地文件上传至 `https://api.scnet.cn/api/llm/v1/ocr/recognize`。提单中可能包含商业敏感信息或个人数据,请确保你有权将该文件内容外传,并建议仅使用可信来源文件。

> **⚠️ 重要**:使用前需要申请 Scnet API Token

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 60)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(仅所有者可读写)

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 117)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(仅所有者可读写)

External Transmission

Medium
Category
Data Exfiltration
Confidence
96% confidence
Finding

The documentation explicitly states that uploaded local files are sent to an external OCR service at api.scnet.cn. Because the skill processes bills of lading and related shipping documents, this can expose commercially sensitive and potentially personal data to a third-party service, creating a real data exfiltration and compliance risk even if it is part of the intended design.

Content

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

md
> **⚠️ 数据外传警告**:调用本接口会将你上传的本地文件发送至 Scnet 外部 OCR 服务(`https://api.scnet.cn`)。提单等单据可能包含收发货人、航次、货量、联系方式等商业或个人信息,请确认你有权外传该文件内容,并仅上传可信来源文件。

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

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

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
97% confidence
Finding

The skill sends user-supplied document files and an API token to an external third-party endpoint at api.scnet.cn for OCR processing. In the context of bills of lading, the uploaded documents can contain commercially sensitive shipping, consignee, cargo, and carrier data, so this creates a real data exfiltration and privacy/compliance risk if users are unaware or if the remote service is untrusted or compromised.

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):

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The description only says the skill extracts core bill-of-lading information, but does not define clear invocation boundaries, supported document types, or exclusion conditions. In an agentic system, this can cause overbroad routing of arbitrary documents containing text or logistics terms, increasing the chance of unnecessary file access, OCR on unrelated sensitive files, and unintended network transmission to the external OCR service.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill description is written to operate in Chinese without stating that this is optional, locale-driven, or selected by the user. This can bias agent behavior toward Chinese-language handling or responses in contexts where the user did not request it, leading to misrouting, incorrect extraction assumptions, or user-confusing behavior rather than direct code execution risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The changelog content is entirely in Chinese, beginning with the title and continuing through the release notes, with no indication that the language is optional or that the skill is region-specific. Under the policy rule for natural-language violations, this can be treated as forcing a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The file’s user-facing natural-language content is entirely in Chinese and does not indicate any option to use another language or locale. Under the stated policy, forcing a specific language without user opt-in can be a policy violation unless the locale constraint is clearly documented and justified.

Content

No source excerpt is available for this finding.