T09 · Insecure Skill Coding Practices
- Location
scripts/bing_images.py:979- Finding
API Token Can Be Exposed Through Command-Line Arguments
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
The skill appears to be a real Bing Images search wrapper, but its API-token handling is risky enough that users should review it before installing.
Review the credential handling before installing. Prefer setting DATAIFY_API_TOKEN only for the current session or through a credential manager, avoid the --token command-line option, do not paste real tokens into chat, and do not put tokens in shell startup files unless you accept the plaintext exposure risk.
scripts/bing_images.py:979API Token Can Be Exposed Through Command-Line Arguments
scripts/bing_images.py:921API Token Is Unnecessarily Copied into the Process Environment
SKILL.zh-CN.md:21Documentation Encourages Persistent Plaintext Storage of the API Token
Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.
request = urllib.request.Request(DEFAULT_ENDPOINT, data=data, headers=headers, method="POST")
try:
with urllib.request.urlopen(request, timeout=timeout) as response:
raw = response.read()
text = raw.decode(response.headers.get_content_charset() or "utf-8", errors="replace")
return 200 <= response.status < 300, text
YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).
量,而不是只在当前终端临时设置。
Windows PowerShell,当前用户永久设置:
[Environment]::SetEnvironmentVariable("DATAIFY_API_TOKEN", "your_token_here", "User")
然后重新打开 PowerShell。如果当前会话也要立即生效,再执行:
$env:DATAIFY_API_TOKEN = "your_token_here"
macOS 或 Linux,bash 永久设置:
echo 'export DATAIFY_API_TOKEN="your_token_here"' >> ~/.bashrc
source ~/.bashrc
macOS 或 Linux,zsh 永久设置:
echo 'export DATAIFY_API_TOKEN="your_token_here"' >> ~/.zshrc
source ~/.zshrc
references/ 目录下的 API 文档包含完整的字段列表和说明。Content-Type: application/x-www-form-urlencoded 提交 API 请求。The skill uses sensitive capabilities—network access and reading an environment variable token—but does not declare any explicit tool scope or permissions boundary. That increases the chance the agent can invoke capabilities beyond what a reviewer or runtime policy expects, weakening least-privilege controls and making credentialed external calls less transparent.
The instruction includes a hard-coded Chinese example for user-facing updates, which can cause the agent to respond in a language the user did not request. While not a direct security exploit, forcing unexpected language can mislead users about what action will be taken, reduce informed consent, and make review of outbound requests harder.
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.
Read `DATAIFY_API_TOKEN` from the environment. Never display its value or ask the user to paste it into chat.
Detect the current operating system and shell before showing setup instructions. Never ask the user to paste the token into chat. After configuration succeeds, continue the original task without requiring the user to repeat it.
- If missing, offer https://dashboard.dataify.com/login?utm_source=skill and state that new accounts receive 50 free credits. Show only the session-scoped setup command appropriate to the current OS and shell.
- After the user says it is configured, verify only whether the variable is present, then continue the original request without making them repeat it.
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.
Read `DATAIFY_API_TOKEN` from the environment. Never display its value or ask the user to paste it into chat.
Detect the current operating system and shell before showing setup instructions. Never ask the user to paste the token into chat. After configuration succeeds, continue the original task without requiring the user to repeat it.
- If missing, offer https://dashboard.dataify.com/login?utm_source=skill and state that new accounts receive 50 free credits. Show only the session-scoped setup command appropriate to the current OS and shell.
- After the user says it is configured, verify only whether the variable is present, then continue the original request without making them repeat it.
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.
Read `DATAIFY_API_TOKEN` from the environment. Never display its value or ask the user to paste it into chat.
Detect the current operating system and shell before showing setup instructions. Never ask the user to paste the token into chat. After configuration succeeds, continue the original task without requiring the user to repeat it.
- If missing, offer https://dashboard.dataify.com/login?utm_source=skill and state that new accounts receive 50 free credits. Show only the session-scoped setup command appropriate to the current OS and shell.
- After the user says it is configured, verify only whether the variable is present, then continue the original request without making them repeat it.
L03 的描述是“当用户想使用 Bing 进行图片搜索时,使用此 skill。”,只给出高层意图,没有限定具体触发短语、上下文或排除条件。这样的描述对路由器来说过于泛化,容易覆盖普通对话中与图片搜索相关的表述,增加非预期调用的风险。
L06 明确将该技能标注为“Bing Images 中文版”,全文也仅提供中文说明,但未说明这是可选语言版本,也未给出用户选择其他语言的方式。根据语言/地区策略,技能若隐含强制特定语言而无用户选择或合理限定,属于自然语言层面的策略问题。
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.
- Show a prominent Dataify account CTA only when the API token is missing, rejected/invalid, or the account has insufficient credits.
- For a missing token, offer https://dashboard.dataify.com/login?utm_source=skill and state: New accounts receive 50 free credits. Never ask the user to paste the token into chat.
- Detect the current operating system and shell. Show only the matching session-scoped setup command first (`export` for macOS/Linux shells, `$env:` for Windows PowerShell, or `set` for Windows Command Prompt). Show other platforms or persistent setup only when detection is ambiguous or the user asks.
- After the user says the token is configured, verify only whether `DATAIFY_API_TOKEN` is present; never print its value. If verification succeeds, continue the original task without asking the user to repeat it.
- Explain that persistent shell changes may require a new terminal or restarting the agent application. Do not recommend a project `.env` unless the execution path explicitly loads it, and ensure `.env` is ignored by version control.
- For an invalid token, direct the user to API-key management without implying that a new registration is required. For insufficient credits, direct the user to balance or recharge management.
- During normal submission, processing, and successful completion, do not promote registration or the Dashboard. Never expose the token or include it in CTA attribution parameters.
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.
- Show a prominent Dataify account CTA only when the API token is missing, rejected/invalid, or the account has insufficient credits.
- For a missing token, offer https://dashboard.dataify.com/login?utm_source=skill and state: New accounts receive 50 free credits. Never ask the user to paste the token into chat.
- Detect the current operating system and shell. Show only the matching session-scoped setup command first (`export` for macOS/Linux shells, `$env:` for Windows PowerShell, or `set` for Windows Command Prompt). Show other platforms or persistent setup only when detection is ambiguous or the user asks.
- After the user says the token is configured, verify only whether `DATAIFY_API_TOKEN` is present; never print its value. If verification succeeds, continue the original task without asking the user to repeat it.
- Explain that persistent shell changes may require a new terminal or restarting the agent application. Do not recommend a project `.env` unless the execution path explicitly loads it, and ensure `.env` is ignored by version control.
- For an invalid token, direct the user to API-key management without implying that a new registration is required. For insufficient credits, direct the user to balance or recharge management.
- During normal submission, processing, and successful completion, do not promote registration or the Dashboard. Never expose the token or include it in CTA attribution parameters.
The document instructs the skill to send user search queries to an external third-party endpoint using bearer-token authentication, but it does not disclose that user-provided content and related request metadata leave the local agent boundary. This can cause unintentional data exposure, especially if users include sensitive terms, internal identifiers, or regulated data in search queries.
The user-facing descriptions, CLI help text, and error messages are predominantly in Chinese, with no option to select another language. Per the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly documented and justified.
Most of the field descriptions and usage guidance are presented only in Chinese, which effectively forces a specific language for users of this reference. The policy allows locale constraints only when users are offered a choice or when the restriction is clearly documented and justified, neither of which appears here.
Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.
def apply_overrides(payload: dict[str, str], args: argparse.Namespace) -> dict[str, str]:
for key in ["q", "json", "mkt", "cc", "first", "count", "imagesize", "color2", "photo", "aspect", "face", "age", "license"]:
value = getattr(args, key, None)
if value is not None:
payload[key] = value
The manifest describes a skill for searching Bing Images, but this code also reads the DATAIFY_API_TOKEN from the environment and writes a normalized bearer token back into os.environ. Credential handling is not inherently required by the user-facing purpose of 'search Bing Images' and represents an additional capability beyond simple query execution.
This script sends the parsed prompt-derived payload to an external Dataify endpoint, which includes the user's search query and potentially locale, country, and other request metadata. Although the module docstring says it calls the API, there is no runtime notice, confirmation, or explicit user-facing disclosure near execution that user-supplied data will be transmitted off-system.