T09 · Insecure Skill Coding Practices
- Location
SKILL.md:39- Finding
API Key Exposure Through Full Credential-File Display and Permission-Unsafe Storage
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill mostly performs the advertised paid LinkedIn school lookup, but it also handles API keys, billing/top-up flows, error reporting, and an undisclosed update check in ways users should review carefully.
Review this skill before installing. Use a dedicated low-balance API key, avoid printing the full .env file, confirm any paid query or top-up action separately, and do not include sensitive request or response data in error reports unless you are comfortable sending it to the provider.
SKILL.md:39API Key Exposure Through Full Credential-File Display and Permission-Unsafe Storage
requirements.txt:1Unbounded Third-Party Dependency Installation
scripts/common.py:200Undisclosed Automatic Version-Check Request and Persistent Cache Write
Remote version checks, local metadata parsing, cache writes, and upgrade notifications add hidden network and filesystem behavior unrelated to the advertised lookup task. While not inherently malicious, this undisclosed update-check path expands attack surface and can create unexpected persistence or tracking behavior.
Remote version checks, local metadata parsing, cache writes, and upgrade notifications add hidden network and filesystem behavior unrelated to the advertised lookup task. While not inherently malicious, this undisclosed update-check path expands attack surface and can create unexpected persistence or tracking behavior.
Remote version checks, local metadata parsing, cache writes, and upgrade notifications add hidden network and filesystem behavior unrelated to the advertised lookup task. While not inherently malicious, this undisclosed update-check path expands attack surface and can create unexpected persistence or tracking behavior.
Remote version checks, local metadata parsing, cache writes, and upgrade notifications add hidden network and filesystem behavior unrelated to the advertised lookup task. While not inherently malicious, this undisclosed update-check path expands attack surface and can create unexpected persistence or tracking behavior.
The instructions explicitly direct reading a credential file from the user's home directory using cat ~/.upkuajing/.env. Exposing or encouraging direct access to a raw secret store increases the risk of credential disclosure to the agent, logs, or downstream tooling, especially because the skill context is only a school information lookup and does not justify broad secret-file inspection.
This skill requires an API key. The API key is stored in the ~/.upkuajing/.env file:
cat ~/.upkuajing/.env
Example file content:
The skill tells the agent to check for a credential in ~/.upkuajing/.env and, if absent, create and save a new key automatically. This combines secret discovery with credential provisioning and local persistence, which is far beyond the least privilege expected for a lookup skill and could lead to unauthorized account creation, secret sprawl, or accidental leakage.
### **API Key Not Set**
First check if the `~/.upkuajing/.env` file has UPKUAJING_API_KEY;
If UPKUAJING_API_KEY is not set, prompt the user to choose:
1. User has one: User provides it (manually add to ~/.upkuajing/.env file)
2. User doesn't have one: You can apply using the interface (`auth.py --new_key`), the new key will be automatically saved to ~/.upkuajing/.env
Wait for user selection;
This section again instructs interaction with a local .env credential store and automatic saving of newly created API keys. Repeated emphasis on reading and writing long-lived secrets to a home-directory file materially raises the chance of credential mishandling, especially in an agent setting where file contents may be surfaced to models or logs.
First check if the `~/.upkuajing/.env` file has UPKUAJING_API_KEY;
If UPKUAJING_API_KEY is not set, prompt the user to choose:
1. User has one: User provides it (manually add to ~/.upkuajing/.env file)
2. User doesn't have one: You can apply using the interface (`auth.py --new_key`), the new key will be automatically saved to ~/.upkuajing/.env
Wait for user selection;
### **Account Top-up**
The file implements account authentication, API-key provisioning, balance lookup, and recharge flows that do not align with the stated purpose of LinkedIn school-detail lookup. Capability/purpose mismatch is dangerous because users may invoke a seemingly benign research skill while unknowingly enabling billing or credential-management actions for a third-party service.
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():
This code writes an API key to a plaintext .env file, creating a real credential-exposure risk if the file is readable by other processes/users, backed up insecurely, or accidentally committed. In a misleadingly scoped skill, hidden secret persistence is especially dangerous because users may not realize a new long-lived credential has been stored locally.
"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")
Recharge-order creation and pricing/account operations introduce payment-related side effects unrelated to educational institution verification. In the context of a recruiter/research skill, this broadens the trust boundary and creates risk of unexpected charges, misuse of linked accounts, or social-engineering-style abuse under a misleading skill description.
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'
# 日志开关
This file implements a remote platform error-reporting path that is unrelated to the stated purpose of a LinkedIn school-detail enrichment skill. Capability mismatch is dangerous because it expands the skill's data flows and trust boundaries, creating an undisclosed channel that can transmit operational or user-derived data off-system without clear necessity for the advertised function.
The skill declares executable behaviors involving environment access, local file reads/writes, and network usage, but does not declare any explicit tool scope or permissions boundary. That makes the effective capability set opaque to reviewers and increases the chance an agent may perform credential access, persistence, or outbound requests beyond what a user would expect from a simple school lookup skill.
The API reference explicitly encourages sending requestParams, responseData, and exception context to a centralized error-reporting endpoint, which can include user-supplied content, internal responses, and stack traces. Although the document notes that sensitive fields are 'automatically desensitized,' it does not define guarantees, scope, or user/operator safeguards, so this creates a real risk of privacy leakage or overcollection of sensitive data during failure handling.
The code can provision a new API credential and persist it locally even though the skill is presented as a LinkedIn school lookup tool. This is risky because it collects and stores long-lived credentials under a misleading context, increasing the chance users authorize or retain secrets they did not expect to create.
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:
The script writes a newly issued API key directly to a local .env file without an upfront warning or confirmation before the sensitive write occurs. This can expose credentials through weak file permissions, accidental check-in, local disclosure, or user confusion about where secrets are stored.
The file’s user-facing natural language is entirely in Chinese, beginning with the module description and continuing through comments and console messages. Under the policy, forcing a specific language without user opt-in is a locale/language policy violation unless a justified region-specific constraint is documented, which is not present here.
Detected: suspicious.exposed_secret_literal