Back to skill

Security audit

A股量化选股助手

Security checks for vulnerabilities and agentic risk

Overview

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.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/query_stocks.py:24
Finding

API Token Transmitted over Plaintext HTTP

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
scripts/install.sh:18
Finding

Unpinned Dependency Installation from the Active Package Index

Content
View full analysis
/dev/null || python3 -m pip install requests --quiet ``` The same unconstrained installation instruction appears in `README.md` line 19: ```bash pip install requests ``` ### Technical Analysis The installer retrieves `requests` without specifying a reviewed version or verifying a package hash. Resolution therefore depends on the user's current pip configuration, configured indexes, mirrors, and the package version available when installation occurs. If the active index or mirror is compromised, or if pip has been configured to use an attacker-controlled repository, the installer can retrieve an unauthorized distribution. Python packages may execute installation or build logic during installation, and imported package code later executes with the privileges of the user invoking the skill. The broad global `pip3` invocation also risks modifying the user's system or user-level Python environment rather than an isolated environment. ### Attack Path 1. An attacker compromises or controls a Python package index or mirror configured on the target system. 2. The user runs `scripts/install.sh`. 3. Pip resolves the unconstrained `requests` requirement through the affected index. 4. A malicious or modified package distribution is downloaded and installed. 5. Package installation logic or later imports execute attacker-controlled Python code with the invoking user's privileges. ### Impact Assessment Successful exploitation permits code execution under the account running the installer. The attacker may access files, credentials, environment variables, and network resources available to that account. Administrative privileges are not inherently obtained, but impact increases if the installer is run using a privileged account o ...[truncated 38 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/install.sh:35
Finding

Unsafe Plaintext Token Persistence in Shell Startup Configuration

Content
View full analysis
> ~/.bashrc export YUFENG_QUANT_TOKEN="$USER_TOKEN" ``` `USER_TOKEN` is populated from interactive input immediately before this block. ### Technical Analysis The installer writes the API token directly into `~/.bashrc` as plaintext. Shell startup files are persistent, frequently backed up, and often accessible to other processes running under the same user account. This unnecessarily increases the lifetime and exposure surface of the credential. The value is embedded in generated shell syntax without validation or shell-safe serialization. A token containing a double quote followed by shell syntax can terminate the generated quoted assignment. For example, a value shaped like: ```text "; attacker_command; # ``` would produce a startup-file line structurally equivalent to: ```bash export YUFENG_QUANT_TOKEN=""; attacker_command; #" ``` The inserted command would not execute during the installer because the variable is not evaluated there. It would execute when a later interactive shell sources the modified `~/.bashrc`. Exploitation requires the user to enter or paste an attacker-crafted token, such as one supplied through a deceptive subscription or support workflow. ### Attack Path 1. An attacker persuades the user to paste a crafted string as the API token. 2. The installer interpolates that string into an `export` command and appends it to `~/.bashrc`. 3. The installer completes without evaluating the injected shell syntax. 4. The user later opens a shell that sources `~/.bashrc`. 5. The injected command executes with the user's privileges. 6. Independently of command injection, any process or person able to read the startup file can recove ...[truncated 435 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
Findings (21)

Tainted flow: 'API_BASE' from os.environ.get (line 23, credential/environment) → requests.get (network output)

Critical
Category
Data Flow
Confidence
97% confidence
Finding

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.

Content

Scanner excerpt · scripts/query_stocks.py (reported line 49)May include surrounding context.

python
"User-Agent": "OpenClaw-Skill/1.0"
    }
    try:
        resp = requests.get(
            f"{API_BASE}{endpoint}",
            headers=headers,
            params=params or {},

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
83% confidence
Finding

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.

Content

Scanner excerpt · scripts/install.sh (reported line 39)May include surrounding context.

sh
*] 复制 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

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

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.

Content

Scanner excerpt · scripts/install.sh (reported line 24)May include surrounding context.

sh
# 3. 创建 Skill 目录
SKILL_DIR="$HOME/.workbuddy/skills/a-stock-quant-screener"
mkdir -p "$SKILL_DIR/scripts"

# 4. 复制文件
echo "[*] 复制 Skill 文件..."

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

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.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/query_stocks.py (reported line 35)May include surrounding context.

python
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)

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/query_stocks.py (reported line 60)May include surrounding context.

python
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)

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
71% confidence
Finding

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.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

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.

Content

No source excerpt is available for this finding.