T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:82- Finding
Configurable API Base URL Enables Credential and Sensitive Document Exfiltration
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill has a legitimate OCR purpose, but it uploads highly sensitive birth-certificate documents and API credentials through a configurable network destination that is broader than the declared endpoint.
Review before installing. Only use this with birth medical certificate files you are authorized to process, because images leave the local machine for Scnet OCR. Do not customize SCNET_API_BASE unless you fully trust and verify the endpoint, and prefer environment/secret-store API key handling over a plaintext .env file.
scripts/main.py:82Configurable API Base URL Enables Credential and Sensitive Document Exfiltration
scripts/main.py:115Insufficient File Validation Allows Upload of Arbitrary Readable Local Files
The skill requests permission to read its local config/.env file containing the API key. Although this is likely needed for normal operation, granting file-read access to credentials increases the blast radius if the script is compromised, modified, or reused in unintended ways; the skill also processes sensitive PII, so credential misuse could enable unauthorized API usage or abuse under the user's account.
permissions:
read_local_files:
paths:
- "${SKILL_ROOT}/config/.env"
- "${USER_PROVIDED_FILE_PATH}"
reason: 读取用户提供的出生医学证明图片文件及本地配置文件。
network:
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"
The skill requests read access to ${SKILL_ROOT}/config/.env, which commonly stores secrets such as API keys. Granting a skill file-read access to a local .env is broader than necessary for normal credential injection and creates a path for secret exposure, especially when the same skill also has network egress to an external service. In this context, access to highly sensitive user documents plus local secrets materially increases blast radius.
permissions:
read_local_files:
paths:
- "${SKILL_ROOT}/config/.env"
- "${USER_PROVIDED_FILE_PATH}"
reason: 读取用户提供的出生医学证明图片文件及本地配置文件。
network:
The substantive skill instructions, warnings, prerequisites, and usage guidance are presented entirely in Chinese in the main operational section of the README. This creates a natural-language locale constraint without user opt-in or an explicit justification that the skill is intended only for Chinese-speaking or region-specific users.
The README explicitly instructs users to send birth certificate images containing extremely sensitive personal and medical data to a third-party API endpoint. Even though the data flow is disclosed, external transmission of highly sensitive documents materially increases privacy, compliance, and exposure risk if the service, transport, retention policy, or API key handling is weak or misconfigured.
SCNET_API_KEY=your_scnet_api_key_here
SCNET_API_BASE=https://api.scnet.cn/api/llm/v1
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 explicitly uploads user-provided birth medical certificate images to a third-party OCR endpoint. These documents contain highly sensitive personal and medical data for infants and parents, so external transmission creates real confidentiality and compliance risk if consent, minimization, retention, or vendor controls are inadequate. The skill context makes this more dangerous because the data class is unusually sensitive and identity-related.
reason: 读取用户提供的出生医学证明图片文件及本地配置文件。
network:
endpoints:
- "https://api.scnet.cn/api/llm/v1/ocr/recognize"
reason: 将出生医学证明图片上传至 Scnet OCR 服务进行识别处理。
execute_script:
command: "python3 ${SKILL_ROOT}/scripts/main.py BIRTH_CERTIFICATE <filePath>"
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
# Sugon-Scnet OCR API 文档摘要
## 接口地址
`POST https://api.scnet.cn/api/llm/v1/ocr/recognize`
## 请求头
- `Content-Type: multipart/form-data`
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
# Sugon-Scnet OCR API 文档摘要
## 接口地址
`POST https://api.scnet.cn/api/llm/v1/ocr/recognize`
## 请求头
- `Content-Type: multipart/form-data`
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
# Sugon-Scnet OCR API 文档摘要
## 接口地址
`POST https://api.scnet.cn/api/llm/v1/ocr/recognize`
## 请求头
- `Content-Type: multipart/form-data`
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 is hardwired to transmit documents to an external service endpoint, creating an external data egress path. In the context of birth-certificate OCR, this is especially sensitive because the uploaded files likely contain protected personal and medical information, so any unintended or insufficiently disclosed transmission materially increases privacy exposure.
)
sys.exit(error_msg)
config.setdefault('SCNET_API_BASE', 'https://api.scnet.cn/api/llm/v1')
return config
The script sends the user-supplied file to a third-party OCR API, which means potentially sensitive personal data from birth certificates is transmitted off-host. In this skill context, the document contains highly sensitive PII, and the script does not present an explicit runtime consent notice or data-handling warning before upload, increasing privacy and compliance risk.
The skill explicitly transmits a user-provided birth medical certificate image to an external OCR API. This document contains highly sensitive personal data about a newborn and parents, so external transmission creates real privacy, compliance, and data-handling risk even if it is the intended function. The narrow document-specific purpose lowers suspicion of maliciousness, but the sensitivity of the data makes the exposure significant.
reason: 读取用户提供的出生医学证明图片文件及本地配置文件。
network:
endpoints:
- "https://api.scnet.cn/api/llm/v1/ocr/recognize"
reason: 将出生医学证明图片上传至 Scnet OCR 服务进行识别处理。
execute_script:
command: "python3 ${SKILL_ROOT}/scripts/main.py <ocrType> <filePath>"
This markdown file presents core skill documentation content in Chinese only, including the title and feature descriptions. Under the stated policy, forcing a specific language without user opt-in can be a natural-language policy violation unless the locale constraint is explicitly documented and justified.
All user-facing messages, usage text, and instructions in the file are written only in Chinese, and the script does not provide any mechanism for users to select another language. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless clearly justified as region-specific.