T09 · Insecure Skill Coding Practices
- Location
scripts/query_stocks.py:24- Finding
API Token Transmitted over Plaintext HTTP
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This stock-screening skill is mostly coherent, but it sends paid API tokens over insecure HTTP and stores tokens persistently in shell startup files.
Review before installing. This skill requires a paid token and sends stock queries to an external service; do not use it with sensitive trading or account information unless the endpoint is changed to HTTPS and token handling is improved. Avoid running the installer as-is because it can persist your token in ~/.bashrc; prefer passing the token per command or using a proper secret store, and rotate any token previously sent over the HTTP endpoint.
scripts/query_stocks.py:24API Token Transmitted over Plaintext HTTP
scripts/install.sh:18Unpinned Dependency Installation from the Active Package Index
scripts/install.sh:35Unsafe Plaintext Token Persistence in Shell Startup Configuration
The request target is derived from an environment-controlled base URL and the same request carries the X-Token authentication secret. In this skill context, allowing API_BASE to be overridden means a caller or compromised runtime can redirect requests to an attacker-controlled host and exfiltrate the token and stock query data.
"User-Agent": "OpenClaw-Skill/1.0"
}
try:
resp = requests.get(
f"{API_BASE}{endpoint}",
headers=headers,
params=params or {},
The YARA match overstates this as malware-like backdoor persistence, but the underlying behavior is still risky: the script appends a secret-bearing export line to ~/.bashrc, creating lasting credential persistence in a broadly used startup file. In this stock-screening skill context, that is unnecessary and increases the blast radius of token compromise, even though it is not itself a backdoor payload.
*] 复制 Skill 文件..."
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
cp -r "$SCRIPT_DIR/../skill/"* "$SKILL_DIR/"
echo "[✓] Skill 安装完成"
# 5. 配置 Token
echo ""
echo "========================================"
echo " 配置 Token"
echo "========================================"
read -p "请输入你的 API Token(直接回车跳过): " USER_TOKEN
if [ -n "$USER_TOKEN" ]; then
echo "export YUFENG_QUANT_TOKEN=\"$USER_TOKEN\"" >> ~/.bashrc
export YUFENG_QUANT_TOKEN="$USER_TOKEN"
echo "[✓] Token 已配置到 ~/.bashrc"
else
echo "[*] 未配置 Token,使用时需通过 --token 参数传递"
fi
echo ""
echo "========================================"
echo " 安装完成!"
echo "========================================"
echo ""
echo "使用方式:"
echo " python3 ~/.workbuddy/skills/a-stock-quant-screener/scripts/query_stocks.py \\"
echo " --action screen --token YOUR_TOKEN"
echo ""
echo "支持的 action:"
echo " screen - 今日选股"
echo
The default API endpoint uses plain HTTP, so the X-Token header and request contents are transmitted without transport encryption. In a skill that handles authentication and financial-interest queries, this enables interception, credential theft, and response tampering by any party on the network path.
The README explicitly states that the skill uses a cloud engine and requires a token, but it does not clearly warn users that their prompts, stock queries, and authentication data will be sent to a third-party remote service. In a finance-related skill, this matters because user queries may reveal trading intent or sensitive operational data, and users cannot give informed consent without clear disclosure.
The skill declares only a Bash tool but omits any explicit tool scope or permission boundaries while its documented workflow uses both environment-variable access and outbound network access to a third-party service. That mismatch reduces reviewability and allows the skill to exercise more capability than is transparently declared, increasing the chance of unintended credential access or external data exfiltration.
The trigger phrases are broad and match many ordinary investing questions, which makes accidental activation likely. Over-triggering is dangerous here because activation can lead to external API usage, credential prompts, or monetized upsell flows when the user may have only wanted general advice.
The 'When to Run' section is ambiguous and lacks precise negative boundaries, so the agent may invoke the skill in contexts that do not require third-party API access. In this skill, ambiguous routing matters because it can unnecessarily expose users to token collection and external service dependence.
The skill instructs the agent to read YUFENG_QUANT_TOKEN from the environment, which is sensitive credential material. Even if a token is functionally needed, requesting ambient env access without narrowly constraining what may be read creates a credential-handling risk and can normalize unsafe secret access patterns in a skill whose purpose is stock screening rather than secret management.
The skill includes commercial purchase instructions and directs users to an external HTTP service to buy a token, which expands the skill from analysis into off-platform monetization and credential acquisition. The use of plain HTTP rather than HTTPS further raises phishing, interception, and integrity concerns for users following the instructions.
The skill advises users to place the API token in ~/.bashrc or ~/.zshrc, which stores a long-lived secret in shell startup files that may be broadly readable, backed up, synced, or accidentally exposed. It also omits warnings about secret sensitivity, rotation, least privilege, and safer alternatives, increasing the risk of credential leakage.
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
# 3. 创建 Skill 目录
SKILL_DIR="$HOME/.workbuddy/skills/a-stock-quant-screener"
mkdir -p "$SKILL_DIR/scripts"
# 4. 复制文件
echo "[*] 复制 Skill 文件..."
The installer asks for an API token and appends it directly to ~/.bashrc, creating persistent plaintext credential storage in the user's shell startup file. This exceeds simple one-time installation behavior and increases exposure to local compromise, accidental disclosure, shell-history/profile sharing, and unintended reuse in future sessions.
The script stores the API token in plaintext in ~/.bashrc without warning the user that the credential will remain on disk and be loaded into future shells. Plaintext persistence can lead to credential theft by other local processes, backup leakage, shoulder-surfing during support/debugging, or accidental disclosure when dotfiles are shared.
Modifying a user's shell profile to store credentials introduces persistence unrelated to core stock-screening logic and makes sensitive data available to every future shell session. In the context of this skill, there is no strong justification for profile-level credential persistence, so the behavior creates unnecessary credential exposure risk.
The script's docstring, CLI description, help text, and error messages are all presented in Chinese, with no indication that the user can select another language. This is a natural-language policy concern because it imposes a specific locale on all users rather than offering choice or documenting a justified locale restriction.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
return t
print(json.dumps({
"error": "未找到 Token",
"message": "请先获取 Token:https://api.yufeng-quant.com/subscribe\n"
"购买后运行:export YUFENG_QUANT_TOKEN=your-token"
}, ensure_ascii=False))
sys.exit(1)
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
return t
print(json.dumps({
"error": "未找到 Token",
"message": "请先获取 Token:https://api.yufeng-quant.com/subscribe\n"
"购买后运行:export YUFENG_QUANT_TOKEN=your-token"
}, ensure_ascii=False))
sys.exit(1)
The natural-language instructions, feature descriptions, and usage guidance are all presented only in Chinese. This can constitute a language-policy violation when no user opt-in, alternative locale, or explicit justification for the locale restriction is provided.
All installer prompts, status messages, and usage text are presented only in Chinese, which imposes a specific language on users. The file does not offer language selection or explain that the skill is intentionally limited to a Chinese-speaking or region-specific audience.
The script retrieves YUFENG_QUANT_TOKEN from environment variables and instructs users to export it, which is a credential-handling capability not mentioned in the manifest. For a stock screener, remote API authentication may be an implementation detail, but environment-based credential access is still an undeclared capability beyond the user-facing purpose description.
The manifest describes A股选股、技术分析、资金流向、择时等 investment-analysis functions, but the code also implements a status action that queries /api/v1/token/status to retrieve token balance and account state. Account/subscription management is outside the stated end-user purpose of stock screening and analysis.