Back to skill

Security audit

SZFIU Market Data Bot

Security checks for vulnerabilities and agentic risk

Overview

This finance skill is mostly purpose-aligned, but it stores trading credentials persistently and includes paths that can bypass its promised real-trading safeguards.

Review this skill carefully before installing. Use only scoped or sandbox trading credentials, assume the token may be written into ~/.fiu-market/config, ~/.mcp.json, and backups, check file permissions after setup, avoid untrusted token values, and do not use the generic mcp_router.sh for any order-related action unless you have an external confirmation control.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/cli.sh:17
Finding

Persistent Shell Command Injection Through the Stored Authentication Token

Content
View full analysis
" exit 1 fi } ``` ```bash # Save config with secure permissions mkdir -p "$HOME/.fiu-market" echo "export FIU_MCP_TOKEN=\"$TOKEN\"" > "$CONFIG_FILE" chmod 600 "$CONFIG_FILE" # Secure: only owner can read ``` The installer uses the same unsafe serialization pattern: ```bash TOKEN="$1" CONFIG_DIR="$HOME/.fiu-market" CONFIG_FILE="$CONFIG_DIR/config" # Create config directory mkdir -p "$CONFIG_DIR" # Save token echo "export FIU_MCP_TOKEN=\"$TOKEN\"" > "$CONFIG_FILE" ``` ### Technical Analysis The setup argument is embedded directly inside executable shell syntax without escaping or validation. The resulting file is later executed with `source`, rather than parsed as data. A malicious value can close the double-quoted assignment and append shell commands. For example, a token shaped like the following would create executable configuration content: ```text "; attacker_command; # ``` The generated file would be equivalent to: ```bash export FIU_MCP_TOKEN=""; attacker_command; #" ``` Restricting the file to mode `600` does not prevent exploitation because the commands are written and subsequently executed by the file owner. The vulnerability creates a persistent execution path: setup stores the payload, while a later command triggers it. ### Attack Path 1. An attacker persuades a user or Agent to run `setup` with a crafted token. 2. `cmd_setup` writes the token into `~/.fiu-market/config` as shell source code. 3. The user subsequently invokes `status`, `test`, `discover` ...[truncated 645 chars]
Remediation
View remediation
"$CONFIG_FILE" chmod 600 "$CONFIG_FILE" ``` 3. Read the value without shell evaluation: ```bash IFS= read -r FIU_MCP_TOKEN < "$CONFIG_FILE" export FIU_MCP_TOKEN ``` 4. Validate the supplied token against the expected JWT character set and structure before storing it. 5. Use `printf '%s'` instead of `echo` to avoid option and escape-sequence ambiguities. 6. Prefer an operating-system credential store or an environment-variable reference in MCP configuration. 7. Remove or migrate existing executable configuration files. Users should rotate tokens if an untrusted setup value may have been used. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/cli.sh:85
Finding

Bearer Token Stored in Multiple Plaintext Files Without Consistently Restricted Permissions

Content
View full analysis
"$CONFIG_FILE" chmod 600 "$CONFIG_FILE" # Secure: only owner can read # Create MCP config - warn users to merge if they have existing config cat > "$MCP_FILE" << MCPEOF { "mcpServers": { "stockHkF10": {"transport":"streamable_http","url":"https://ai.szfiu.com/stock_hk_f10/","headers":{"Authorization":"Bearer $TOKEN"}}, "stockUsF10": {"transport":"streamable_http","url":"https://ai.szfiu.com/stock_us_f10/","headers":{"Authorization":"Bearer $TOKEN"}}, "stockCnF10": {"transport":"streamable_http","url":"https://ai.szfiu.com/stock_cn_f10/","headers":{"Authorization":"Bearer $TOKEN"}}, "stockHkSdk": {"transport":"streamable_http","url":"https://ai.szfiu.com/stock_hk_sdk/","headers":{"Authorization":"Bearer $TOKEN"}}, "stockUsSdk": {"transport":"streamable_http","url":"https://ai.szfiu.com/stock_us_sdk/","headers":{"Authorization":"Bearer $TOKEN"}}, "stockCnSdk": {"transport":"streamable_http","url":"https://ai.szfiu.com/stock_cn_sdk/","headers":{"Authorization":"Bearer $TOKEN"}}, "szfiuToolkit": {"transport":"streamable_http","url":"https://ai.szfiu.com/toolkit/"} } } MCPEOF ``` The standalone installer does not restrict either credential-bearing file: ```bash CONFIG_DIR="$HOME/.fiu-market" CONFIG_FILE="$CONFIG_DIR/config" # Create config directory mkdir -p "$CONFIG_DIR" # Save token echo "export FIU_MCP_TOKEN=\"$TOKEN\"" > "$CONFIG_FILE" ``` It later embeds the token into `~/.mcp.json`: ```bash # Replace placeholder with actual token sed -i "s/TOKEN_PLACEHOLDER/$TOKEN/g" "$MCP_FILE" ``` ### Technical Analysis The complete JWT bearer token is duplicated in: - `~/.fiu-market/config` - `~/.mc ...[truncated 1590 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/mcp_router.sh:57
Finding

Generic MCP Router Can Bypass the Required Real-Trading Confirmation

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/cli.sh:213
Finding

User-Controlled Values Are Interpolated Directly Into JSON Requests

Content
View full analysis
Remediation
View remediation
&2 exit 1 fi ``` 3. Apply strict market-specific symbol validation and reasonable length limits. 4. Pass the completed payload to curl as a single quoted argument: ```bash curl ... --data-binary "$REQUEST_JSON" ``` 5. Apply the same construction method consistently to `scripts/cli.sh`, `scripts/quote.sh`, and every other request-building script. 6. Add regression tests containing quotes, backslashes, braces, brackets, newlines, and duplicate-key payloads. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (67)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The documented capability extends beyond a narrow stock assistant by including generic MCP tool discovery and access to a separate toolkit service, which is not clearly reflected in the description. Even if intended for convenience, exposing broader remote tool enumeration and invocation expands attack surface and may allow interactions unrelated to the user's expected financial workflow.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The documented capability extends beyond a narrow stock assistant by including generic MCP tool discovery and access to a separate toolkit service, which is not clearly reflected in the description. Even if intended for convenience, exposing broader remote tool enumeration and invocation expands attack surface and may allow interactions unrelated to the user's expected financial workflow.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

The documented capability extends beyond a narrow stock assistant by including generic MCP tool discovery and access to a separate toolkit service, which is not clearly reflected in the description. Even if intended for convenience, exposing broader remote tool enumeration and invocation expands attack surface and may allow interactions unrelated to the user's expected financial workflow.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
81% confidence
Finding

This skill is user-invocable and is allowed to use both Write and Bash while depending on a primary credential, enabling persistent local changes in the same context where sensitive tokens are handled. That combination creates a real session-persistence risk because the skill can store secrets or alter local state in ways that survive the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 7)May include surrounding context.

md
user-invocable: true
allowed-tools:
  - Read
  - Write
  - Bash
metadata:
  openclaw:

Session Persistence

Medium
Category
Rogue Agent
Confidence
93% confidence
Finding

The skill explicitly states it will create or overwrite ~/.mcp.json and store configuration persistently, which is a textbook persistence mechanism. In this context, that is more dangerous because the file controls future MCP connections; modifying it can silently register remote endpoints and affect later sessions well beyond the user's immediate request.

Content

Scanner excerpt · SKILL.md (reported line 194)May include surrounding context.

md
- Trading defaults to SIMULATE mode for safety
- Real trading requires explicit "REAL" confirmation
- Always check market status before trading
- The setup command will create/overwrite ~/.mcp.json (standard MCP config file)
- Backup is created automatically before overwriting
- Config files are stored with restricted permissions (600) - only owner can read
- This skill adds 7 FIU MCP entries to your MCP configuration

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill is user-invocable and requests both Write and Bash, which are broader capabilities than are inherently necessary for querying market data or placing trades through a remote MCP service. In this context, those permissions enable local filesystem modification and shell execution, increasing the blast radius if the skill is misused, compromised, or invoked with adversarial inputs.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
84% confidence
Finding

The skill combines session persistence and local mutation primitives by using Write/Bash alongside persistent credential and config setup. In this context, persistence is more dangerous because a user-invocable finance skill can leave behind tokens and modified MCP configuration that continue to affect future sessions and other tools.

Content

Scanner excerpt · SKILL_CN.md (reported line 7)May include surrounding context.

md
user-invocable: true
allowed-tools:
  - Read
  - Write
  - Bash
metadata:
  openclaw:

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

文件标题和整体说明明确将该技能定义为中文版本(“SKILL_CN.md”“FIU 行情交易助手”),且示例与交互说明均仅提供中文,没有说明用户可改用其他语言。这构成了语言/locale 约束,但文档中未提供显式的用户选择或 opt-in 机制。

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill presents itself as a market data/trading assistant but also performs local environment setup, stores credentials, and creates or overwrites MCP configuration files. That hidden expansion of scope is dangerous because invoking a finance-oriented skill can unexpectedly alter local trust/configuration state and persist sensitive tokens on disk.

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 · docs/MCP_TOOLS.md (reported line 57)May include surrounding context.

Use this command to list all available tools for a market:

bash
curl -s -X POST https://ai.szfiu.com/stock_hk_sdk/ \
  -H "Authorization: Bearer $FIU_MCP_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documentation includes a concrete trade command that appears capable of placing a live buy order, but it does not warn users that this may execute real trades with financial consequences. In the context of a trading assistant, omission of a clear safety notice materially increases the risk of accidental order placement, especially when users copy-paste examples verbatim.

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 · docs/mcp-interfaces_CN.md (reported line 373)May include surrounding context.

查询港股行情

bash
curl -X POST https://ai.szfiu.com/stock_hk_sdk/ \
  -H "Authorization: Bearer {api_key}" \
  -H "Content-Type: application/json" \
  -d '{"tool": "quote", "params": {"symbol": "00700.HK"}}'

External Transmission

Medium
Category
Data Exfiltration
Confidence
90% confidence
Finding

The documentation instructs clients to send authenticated requests containing a bearer token to an external domain, which creates an external transmission path for credentials and user-requested market queries. In the context of an agent skill, this is security-relevant because the skill normalizes outbound network access to a third-party service and could expose sensitive API tokens or query data if the endpoint, logs, or downstream handling are compromised.

Content

Scanner excerpt · docs/mcp-interfaces_EN.md (reported line 373)May include surrounding context.

Query HK Stock Quote

bash
curl -X POST https://ai.szfiu.com/stock_hk_sdk/ \
  -H "Authorization: Bearer {api_key}" \
  -H "Content-Type: application/json" \
  -d '{"tool": "quote", "params": {"symbol": "00700.HK"}}'

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script writes the bearer token in plaintext to a user-local config file without warning the user that a reusable credential is being persisted on disk. This increases the risk of credential disclosure through local compromise, backups, shell history/workstation sharing, or accidental file exposure, especially because no file permissions are tightened after creation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script embeds the bearer token directly into ~/.mcp.json, creating a second plaintext copy of the credential in a common configuration file that other tools or users may read. Duplicating secrets across files increases exposure surface and makes accidental leakage via backups, dotfile syncing, screenshots, support bundles, or repository commits more likely.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 · install.sh (reported line 111)May include surrounding context.

sh
echo ""
echo "🧪 测试连接..."

TEST_RESPONSE=$(curl -s -X POST "https://ai.szfiu.com/toolkit/" \
    -H "Content-Type: application/json" \
    -H "Accept: application/json, text/event-stream" \
    -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}')

External Transmission

Medium
Category
Data Exfiltration
Confidence
90% confidence
Finding

This script transmits authenticated data to an external service using a bearer token, which is a real security-relevant behavior because it exposes credentials and account-query activity to a remote endpoint outside the local trust boundary. In this skill's financial/trading context, even a cash-balance query can reveal sensitive account information, making undisclosed external transmission more significant than in a generic utility script.

Content

Scanner excerpt · scripts/cash.sh (reported line 15)May include surrounding context.

sh
exit 1
fi

curl -s -X POST "https://ai.szfiu.com/stock_hk_sdk/" \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d "{

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script silently sends an authenticated request containing a bearer token to an external internet service and provides no user-facing disclosure, confirmation, or endpoint transparency beyond the source code itself. In a skill context that can be invoked by an agent, this increases the risk of unintended credential use and undisclosed transmission of account-related financial data.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The module comments say the script is the main dispatch script and explicitly list commands such as kline, trade, positions, cash, orders, and capflow as handled. The case statement later does not route any of those commands, so the documentation contradicts the real behavior rather than merely omitting detail.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The file header claims the script handles trade, positions, cash, orders, capflow, and kline, and the status/help text repeats those capabilities. However, the dispatch logic only implements setup, test, discover, quote, search, and status, so the described behavior materially exceeds what the code actually does.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script's user-facing messages and usage instructions are consistently presented in Chinese, starting with the token setup error and continuing throughout the CLI. This imposes a specific language on users without opt-in or any documented justification for a locale restriction, which matches the natural-language locale policy concern.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
94% confidence
Finding

The script persists a reusable bearer token to disk under the user's home directory and later sources it into the shell. Persistent credential storage increases the blast radius of local compromise, shell injection into the config file, backup leakage, or accidental token reuse across sessions, which is especially sensitive for a finance/trading assistant.

Content

Scanner excerpt · scripts/cli.sh (reported line 86)May include surrounding context.

sh
fi

    # Save config with secure permissions
    mkdir -p "$HOME/.fiu-market"
    echo "export FIU_MCP_TOKEN=\"$TOKEN\"" > "$CONFIG_FILE"
    chmod 600 "$CONFIG_FILE"  # Secure: only owner can read

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

Scanner excerpt · scripts/cli.sh (reported line 88)May include surrounding context.

sh
# Save config with secure permissions
    mkdir -p "$HOME/.fiu-market"
    echo "export FIU_MCP_TOKEN=\"$TOKEN\"" > "$CONFIG_FILE"
    chmod 600 "$CONFIG_FILE"  # Secure: only owner can read

    # Create MCP config - warn users to merge if they have existing config
    cat > "$MCP_FILE" << MCPEOF

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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/cli.sh (reported line 123)May include surrounding context.

sh
# Test toolkit (no auth needed)
    echo "1. 测试 szfiuToolkit..."
    RESP=$(curl -s -X POST "https://ai.szfiu.com/toolkit/" \
        -H "Content-Type: application/json" \
        -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}')
    if echo "$RESP" | grep -q "tools"; then

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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/cli.sh (reported line 259)May include surrounding context.

sh
# Test toolkit (no auth needed)
    echo "1. 测试 szfiuToolkit..."
    RESP=$(curl -s -X POST "https://ai.szfiu.com/toolkit/" \
        -H "Content-Type: application/json" \
        -d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}')
    if echo "$RESP" | grep -q "tools"; then