T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/main.py:92- Finding
Unrestricted Local File Upload to a Remote OCR Service
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This OCR skill mostly does what it claims, but it can upload any readable local file and the API token to a configurable external endpoint.
Review this skill before installing in sensitive environments. Only run it on files you intentionally want to send to Scnet, keep config/.env private, do not let untrusted chat content choose file paths, and avoid changing SCNET_API_BASE unless you fully trust the destination. Prefer adding file type, size, path, and endpoint allowlist checks before production use.
scripts/main.py:92Unrestricted Local File Upload to a Remote OCR Service
scripts/main.py:78Configurable API Base Can Exfiltrate the Bearer Token and Uploaded Documents
SKILL.md:66Unpinned Third-Party Dependency Installation
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# 获取技能根目录(脚本所在目录的上一级)
SKILL_ROOT = Path(__file__).parent.parent.absolute()
ENV_FILE = SKILL_ROOT / "config" / ".env"
# --- 新增:重试配置 ---
MAX_RETRIES = 3 # 最大重试次数
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# --------------------
def load_config():
"""从 .env 文件加载配置,若文件不存在则抛出友好错误"""
if not ENV_FILE.exists():
error_msg = (
"\n===============================================\n"
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# --------------------
def load_config():
"""从 .env 文件加载配置,若文件不存在则抛出友好错误"""
if not ENV_FILE.exists():
error_msg = (
"\n===============================================\n"
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
# --------------------
def load_config():
"""从 .env 文件加载配置,若文件不存在则抛出友好错误"""
if not ENV_FILE.exists():
error_msg = (
"\n===============================================\n"
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.
* [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)
The skill documentation indicates capabilities that can read local files, invoke shell commands, and send data over the network, but it does not declare any explicit tool scope or permissions boundary. That omission increases the risk of overbroad execution in an agent environment, especially because the skill accepts an arbitrary local file path and uploads document contents to an external OCR API.
The manifest description, headings, parameter descriptions, warnings, and example user utterances are all written exclusively in Chinese, which effectively constrains the skill's interaction language. The file does not state that the skill is region-specific or provide any opt-in or alternative language option, which matches the locale-policy violation criteria.
The skill is designed to transmit user-supplied local document images to an external third-party service endpoint for OCR. This is security-relevant because packing lists can contain sensitive commercial, personal, or shipment data, and the current documentation does not clearly require consent, data minimization, destination allowlisting, or retention/privacy disclosures.
SCNET_API_KEY=your_scnet_api_key_here
SCNET_API_BASE=https://api.scnet.cn/api/llm/v1
2. 添加:`SCNET_API_KEY=你的密钥`
3. 设置文件权限为 600(仅所有者可读写)
The configuration section reinforces that the skill depends on an external API base URL, which means document contents and metadata may leave the local environment. If the base URL is user-modifiable without validation, it also creates a risk of redirecting uploads to an attacker-controlled endpoint or an untrusted service.
| 变量名 | 默认值 | 说明 |
|--------|--------|------|
| SCNET_API_KEY | 必需 | Scnet API 密钥 |
| SCNET_API_BASE | https://api.scnet.cn/api/llm/v1 | API 基础地址(一般无需修改) |
### 输出
This skill is explicitly designed to call an external OCR service at api.scnet.cn, which means document images/PDFs and associated metadata leave the trust boundary. While external access is expected for OCR functionality, it still represents a true data exfiltration surface if users are not informed and if sensitive trade documents are processed without appropriate controls.
# Sugon-Scnet OCR API 文档摘要
## 接口地址
`POST https://api.scnet.cn/api/llm/v1/ocr/recognize`
## 请求头
- `Content-Type: multipart/form-data`
The documentation shows that user-supplied files and an API bearer token are sent to a third-party OCR endpoint, but it does not warn about the resulting disclosure of document contents to an external service. In the context of packing lists, invoices, consignee/exporter identities, addresses, and shipment identifiers may contain sensitive commercial or personal data, so silent external transmission creates a real privacy and compliance risk.
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
" 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)
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.
" 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)
The skill uploads user-supplied document files to an external OCR service at api.scnet.cn. This is a real data-exfiltration boundary because packing lists commonly contain sensitive commercial data such as consignor/consignee identities, shipment numbers, weights, and volumes. In the context of an OCR skill, external transmission is functionally expected, but it still creates confidentiality and compliance risk if users are not explicitly informed or if the endpoint can be overridden.
)
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):
The description field is natural-language user-facing metadata, and it forces a specific language/locale experience with no opt-in or justification. Under the policy, language restrictions are acceptable only when the skill offers a choice or clearly documents that the locale constraint is intentional and justified.
This markdown file contains user-facing natural language exclusively in Chinese ('变更日志', '新增装箱单识别功能') with no indication that the skill is region-specific or that language selection is optional. Under the policy, forcing a specific language without user opt-in can be a locale-policy violation.
No suspicious patterns detected.