T09 · Insecure Skill Coding Practices
- Location
SKILL.md:45- Finding
Unsafe API Key Display and Insufficient Local File Permission Enforcement
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill mostly matches its phone-validation purpose, but it handles API keys, billing flows, and update checks in ways users should review carefully before installing.
Review this skill before installing. Use it only if you trust the Upkuajing service with the phone numbers you submit and with a paid API key. Do not print ~/.upkuajing/.env in terminal output or chat; store the key with restrictive file permissions, rotate it if exposed, and require explicit confirmation before any paid validation or recharge action.
SKILL.md:45Unsafe API Key Display and Insufficient Local File Permission Enforcement
requirements.txt:1Unbounded Third-Party Dependency Version
The documentation indicates the skill may perform version checks, read local files, write a version cache, contact a remote version endpoint, and emit upgrade notices—behavior unrelated to core phone validation. Undisclosed background network activity and local writes expand the trust boundary and can expose metadata or create unwanted persistence without clear user awareness.
The documentation indicates the skill may perform version checks, read local files, write a version cache, contact a remote version endpoint, and emit upgrade notices—behavior unrelated to core phone validation. Undisclosed background network activity and local writes expand the trust boundary and can expose metadata or create unwanted persistence without clear user awareness.
The documentation indicates the skill may perform version checks, read local files, write a version cache, contact a remote version endpoint, and emit upgrade notices—behavior unrelated to core phone validation. Undisclosed background network activity and local writes expand the trust boundary and can expose metadata or create unwanted persistence without clear user awareness.
The documentation indicates the skill may perform version checks, read local files, write a version cache, contact a remote version endpoint, and emit upgrade notices—behavior unrelated to core phone validation. Undisclosed background network activity and local writes expand the trust boundary and can expose metadata or create unwanted persistence without clear user awareness.
The skill instructs reading the full contents of ~/.upkuajing/.env using cat, which can expose the API key and potentially other secrets stored in that file. Directly surfacing secret material to the agent or user interface increases the risk of credential leakage, reuse, or accidental logging.
使用此技能需要API密钥。API密钥保存在 ~/.upkuajing/.env 文件中:
cat ~/.upkuajing/.env
文件内容示例:
The skill's setup flow explicitly involves checking a local secret file for an API key and then potentially initiating key provisioning that writes credentials back to disk. This expands the skill from validation into credential acquisition and storage, increasing the chance of secrets being exposed, mishandled, or persisted insecurely.
### **未设置API密钥**
请先检查 `~/.upkuajing/.env` 文件是否有 UPKUAJING_API_KEY;
如果未设置 UPKUAJING_API_KEY API密钥,请提示并让用户选择:
1. 用户有,由用户提供(手动添加到 ~/.upkuajing/.env 文件)
2. 用户没有,你可使用接口进行申请(`auth.py --new_key`),申请到新密钥后,会自动保存到 ~/.upkuajing/.env
等待用户选择;
Automatically applying for a new API key and saving it into ~/.upkuajing/.env introduces credential creation and persistence inside a skill whose main purpose is phone checking. If exploited or misused, this could create unauthorized accounts, store secrets in predictable locations, and expose credentials through logs, backups, or later file reads.
请先检查 `~/.upkuajing/.env` 文件是否有 UPKUAJING_API_KEY;
如果未设置 UPKUAJING_API_KEY API密钥,请提示并让用户选择:
1. 用户有,由用户提供(手动添加到 ~/.upkuajing/.env 文件)
2. 用户没有,你可使用接口进行申请(`auth.py --new_key`),申请到新密钥后,会自动保存到 ~/.upkuajing/.env
等待用户选择;
### **账户充值**
The file implements account onboarding, API key issuance, balance lookup, recharge order creation, and pricing retrieval, which materially exceeds the stated skill purpose of phone-number validity and WhatsApp-status checking. This scope expansion increases attack surface and can enable unauthorized billing, credential provisioning, or account manipulation pathways unrelated to the advertised function.
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
申请新的 API 密钥。
"""
# 检查是否已存在 .env 文件和 API key
env_file = UPKUAJING_ENV_FILE
if env_file.exists():
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
申请新的 API 密钥。
"""
# 检查是否已存在 .env 文件和 API key
env_file = UPKUAJING_ENV_FILE
if env_file.exists():
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
申请新的 API 密钥。
"""
# 检查是否已存在 .env 文件和 API key
env_file = UPKUAJING_ENV_FILE
if env_file.exists():
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
申请新的 API 密钥。
"""
# 检查是否已存在 .env 文件和 API key
env_file = UPKUAJING_ENV_FILE
if env_file.exists():
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
申请新的 API 密钥。
"""
# 检查是否已存在 .env 文件和 API key
env_file = UPKUAJING_ENV_FILE
if env_file.exists():
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
"""
申请新的 API 密钥。
"""
# 检查是否已存在 .env 文件和 API key
env_file = UPKUAJING_ENV_FILE
if env_file.exists():
The function writes a newly issued API key directly into a plain-text .env file under the user's home directory. Storing long-lived credentials in plain text increases the chance of disclosure through weak filesystem permissions, backups, logs, support bundles, or other local processes, especially in a skill whose advertised purpose does not require secret-management behavior.
"envFilePath": str(env_file)
}
# 保存到 .env 文件
try:
with open(env_file, 'w', encoding='utf-8') as f:
f.write(f"{API_KEY_ENV}={api_key}\n")
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.
API_BASE_URL = "https://openapi.upkuajing.com"
API_KEY_ENV = "UPKUAJING_API_KEY"
UPKUAJING_DIR = Path.home() / '.upkuajing'
UPKUAJING_ENV_FILE = UPKUAJING_DIR / '.env'
UPKUAJING_LOGS_DIR = UPKUAJING_DIR / 'logs'
# 日志开关
The skill advertises executable behavior that can read environment variables, access local files, write to disk, and make network requests, but it does not declare any explicit tool scope or permission boundaries. This weakens user and platform visibility into what the skill may access, increasing the chance of over-privileged execution or unintended sensitive-data exposure.
The file’s user-facing instructions and descriptions are exclusively in Chinese, and nowhere does it indicate that the user can choose another language or that the skill is intentionally restricted to a Chinese-speaking context. Under the policy, forcing a specific language without user opt-in is a natural-language policy concern.
This is a markdown file, so SQP-2 applies to omissions in the skill description. The document instructs users to send an Authorization token and a list of phone numbers, which are sensitive credentials and personal data, but it provides no warning about privacy, secure handling, or transmission implications.
The document explicitly instructs sending request parameters, response payloads, and error context to a centralized error-reporting API. Although it notes that sensitive fields are 'automatically masked,' it does not define the masking scope, guarantee coverage for all secrets/PII, or instruct operators to minimize or avoid sending user data, which creates a realistic risk of privacy leakage through logs and telemetry.
The file’s user-facing description, CLI help text, and status/error messages are entirely in Chinese, with no indication that language selection is optional or that the skill is intentionally limited to a Chinese-only audience. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.
The code can request a new API key and persist it locally, which is an account bootstrap capability rather than core phone-verification logic. In a skill that users expect only to validate phone numbers, automatic credential provisioning broadens trust assumptions and can lead to unintended account creation or secret handling exposure.
Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.
pass # 如果读取失败,继续执行
# 不需要认证申请新密钥
response = make_request('/agent/auth/create', {}, require_auth=False)
# 检查是否申请成功
if response.get('code') != 0:
Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.
pass # 如果读取失败,继续执行
# 不需要认证申请新密钥
response = make_request('/agent/auth/create', {}, require_auth=False)
# 检查是否申请成功
if response.get('code') != 0:
Creating recharge orders and exposing pricing APIs are monetization/account-management capabilities unrelated to phone validation. In the context of a narrowly described validation skill, hidden billing functionality is risky because it may surprise users, facilitate unwanted charges, or normalize overprivileged agent behavior.
Detected: suspicious.exposed_secret_literal