T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:84- Finding
Configurable OCR Endpoint Can Exfiltrate API Credentials and Sensitive Financial Images
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This payment-bill OCR skill is mostly transparent about uploading sensitive images, but it can send both the image and API key to a configurable endpoint outside the declared host.
Review before installing. Only use this skill for payment screenshots you are willing to upload to Scnet's OCR service, verify config/.env yourself, and leave SCNET_API_BASE at the documented api.scnet.cn value unless you fully trust the alternate endpoint. Use a virtual environment and avoid pasting the API key into chat.
scripts/main.py:84Configurable OCR Endpoint Can Exfiltrate API Credentials and Sensitive Financial Images
SKILL.md:102Unpinned 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)
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
> 本文档仅针对 `mobile_pay_bill_ocr` 技能使用的 **移动支付账单识别** 场景。本技能仅支持 `MOBILE_PAYMENT_BILL` 一种识别类型,不接受身份证、合同、印章、发票、卡证等非支付类文档。
## 接口地址
`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.
> 本文档仅针对 `mobile_pay_bill_ocr` 技能使用的 **移动支付账单识别** 场景。本技能仅支持 `MOBILE_PAYMENT_BILL` 一种识别类型,不接受身份证、合同、印章、发票、卡证等非支付类文档。
## 接口地址
`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.
> 本文档仅针对 `mobile_pay_bill_ocr` 技能使用的 **移动支付账单识别** 场景。本技能仅支持 `MOBILE_PAYMENT_BILL` 一种识别类型,不接受身份证、合同、印章、发票、卡证等非支付类文档。
## 接口地址
`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)
This skill transmits user-supplied payment-bill images to an external API endpoint, which can expose highly sensitive financial and personal data outside the local environment. In the context of a mobile payment OCR skill, the transmission is expected for functionality, but it still creates a real privacy and data-exfiltration risk if users are unaware, the endpoint is misconfigured, or data handling at the remote service is insecure.
)
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):
This markdown file contains user-facing natural language entirely in Chinese, including the title and release notes. Under the stated policy, forcing a specific language without user opt-in can be a natural-language policy violation, and there is no indication here that the locale restriction is optional or justified.
The module docstring and command/output description are written entirely in Chinese and present the skill as operating in that language by default, with no indication that another language is supported or that the user can opt in to Chinese. The policy for this audit flags natural-language locale constraints when a skill effectively forces a specific language without user choice.