Back to skill

Security audit

moss-trade-bot-factory

Security checks for vulnerabilities and agentic risk

Overview

This trading-bot skill is mostly coherent about its purpose, but its optional platform and live-trading features handle API credentials and automated orders with weak safeguards.

Install only if you are comfortable with a trading skill that can store platform credentials locally, upload strategy/backtest data to the configured platform, and run automated leveraged BTCUSDT trading. Before using bind or live mode, avoid shared credential paths, restrict file permissions yourself, verify the platform URL is exactly the intended HTTPS origin, and treat any api_secret printed by this version as compromised and rotate it.

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 (4)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/live_trade.py:70
Finding

Binding API Secret Disclosed in Plaintext Output

Content
View full analysis
Remediation
View remediation
8 else "***" print(json.dumps(safe_result, indent=2)) ``` Treat any secret previously printed by this implementation as potentially compromised and rotate or revoke it. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
scripts/live_trade.py:84
Finding

Credential File Created Without Enforced Restrictive Permissions

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/trading_client.py:33
Finding

Authenticated Requests Can Be Sent to Arbitrary or Plaintext Origins

Content
View full analysis
dict: prefix = custom_prefix if custom_prefix is not None else API_PREFIX full_path = f"{prefix}{path}" url = f"{self.base_url}{full_path}" canonical_query = "" if query: sorted_params = sorted(query.items()) canonical_query = urllib.parse.urlencode(sorted_params) url = f"{url}?{canonical_query}" raw_body = "" if body is not None: raw_body = json.dumps(body, separators=(",", ":")) headers = dict(DEFAULT_HEADERS) if need_auth and self.api_key: ts, nonce, sig ...[truncated 3006 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
scripts/requirements.txt:1
Finding

Open-Ended Dependency Versions Make Builds Non-Reproducible

Content
View full analysis
=2.0.0 numpy>=1.24.0 ccxt>=4.0.0 scipy>=1.11.0 ``` ### Technical Analysis Every dependency uses an open-ended lower bound. A future installation can therefore resolve to versions that did not exist when the Skill was audited. No lock file or package hashes constrain the selected artifacts. This is particularly relevant for `ccxt`, which is imported by the market-data fetcher and performs network interactions with cryptocurrency exchanges. All listed packages execute Python code when imported, and package installation may also execute build-backend code when a source distribution is selected. The issue does not establish that the currently named packages are malicious. It creates a supply-chain condition in which future compromised, incompatible, or unexpectedly changed releases can enter the execution environment without a corresponding Skill code change or security review. ### Attack Path 1. A user or automated environment installs `scripts/requirements.txt`. 2. The package resolver selects the newest versions satisfying the lower bounds. 3. A selected version has been compromised, contains a malicious build artifact, or introduces a security-relevant regression. 4. Package code executes during build, installation, or import. 5. The compromised dependency gains the privileges of the user running the Skill, including access to Skill files and any credential files readable by that user. ### Impact Assessment A compromised dependency executes with the same operating-system privileges as the Skill process. Depending on the runtime environment, this can permit: - Reading or modifying local strategy, backtest, and credential files. - Accessing network resources available to the process. - Altering market data or indicator calculatio ...[truncated 243 chars]
Remediation
View remediation
--hash=sha256: numpy== --hash=sha256: ccxt== --hash=sha256: scipy== --hash=sha256: ``` Actual versions and hashes should be generated from a clean, trusted build environment rather than copied from an unverified source. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (51)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

If the actual implemented behavior is limited to packaging and uploading verification artifacts plus reading local credentials, then the skill description is still materially incomplete about outbound data transfer and credential use. In this context, understated upload behavior is risky because trading results, strategy parameters, and local secrets may be sent to a remote platform users did not realize was involved.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the actual implemented behavior is limited to packaging and uploading verification artifacts plus reading local credentials, then the skill description is still materially incomplete about outbound data transfer and credential use. In this context, understated upload behavior is risky because trading results, strategy parameters, and local secrets may be sent to a remote platform users did not realize was involved.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

If the actual implemented behavior is limited to packaging and uploading verification artifacts plus reading local credentials, then the skill description is still materially incomplete about outbound data transfer and credential use. In this context, understated upload behavior is risky because trading results, strategy parameters, and local secrets may be sent to a remote platform users did not realize was involved.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

If the actual implemented behavior is limited to packaging and uploading verification artifacts plus reading local credentials, then the skill description is still materially incomplete about outbound data transfer and credential use. In this context, understated upload behavior is risky because trading results, strategy parameters, and local secrets may be sent to a remote platform users did not realize was involved.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

If the actual implemented behavior is limited to packaging and uploading verification artifacts plus reading local credentials, then the skill description is still materially incomplete about outbound data transfer and credential use. In this context, understated upload behavior is risky because trading results, strategy parameters, and local secrets may be sent to a remote platform users did not realize was involved.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

If the actual implemented behavior is limited to packaging and uploading verification artifacts plus reading local credentials, then the skill description is still materially incomplete about outbound data transfer and credential use. In this context, understated upload behavior is risky because trading results, strategy parameters, and local secrets may be sent to a remote platform users did not realize was involved.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the actual implemented behavior is limited to packaging and uploading verification artifacts plus reading local credentials, then the skill description is still materially incomplete about outbound data transfer and credential use. In this context, understated upload behavior is risky because trading results, strategy parameters, and local secrets may be sent to a remote platform users did not realize was involved.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The CLI includes direct position-opening and position-closing commands that can place leveraged long/short trades against an external platform. Because these actions are not prominently reflected in the stated skill scope, an operator or agent could trigger irreversible financial actions without understanding they are live, not local backtests.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The order commands execute leveraged live trades immediately with no confirmation prompt, no dry-run default, and no explicit warning about real financial consequences. In the context of an agent skill that may be driven by natural-language instructions, this sharply increases the risk of accidental or coerced destructive trading activity.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
96% confidence
Finding

The skill advertises and instructs use of shell execution, file reads/writes, and optional external network access, yet it declares no explicit tool scope or permission boundaries. In a trading skill that handles local credential files and can contact remote platforms, missing least-privilege controls increases the chance of unintended command execution, data exposure, or misuse of networked actions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill requires generating name_i18n / personality_i18n / description_i18n with both zh and en, and explicitly instructs the agent to produce English whenever the user's original description is mainly Chinese. This imposes a language policy on outputs rather than offering a user choice or opt-in.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This documentation gives concrete leverage, position sizing, and stop-loss guidance for highly leveraged crypto trading without any prominent warning about liquidation, amplified losses, slippage, or the possibility of losing most or all capital. In the context of a skill that automatically creates and can validate/simulate trading bots, this omission can normalize unsafe risk-taking and lead users to deploy dangerous configurations with misplaced confidence.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The text recommends enabling rolling positions as a 'profit amplifier' and states trend strategies 'strongly' should enable it, but does not warn that pyramiding into winning positions increases exposure, can magnify reversals, and may turn unrealized gains into larger realized losses. In an automated bot-creation context, such one-sided guidance can push users toward systematically riskier behavior without understanding compounding downside.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
79% confidence
Finding

The skill instructs saving long-lived API credentials in a predictable location under the user’s home directory and reusing them for later upload and live trading actions. Persistent storage of trading secrets increases the blast radius of local compromise, accidental disclosure, backup leakage, or multi-user host access, especially because those credentials can authorize remote trading operations.

Content

Scanner excerpt · knowledge/platform_ops.md (reported line 27)May include surrounding context.

  1. 获取 Pair Code:登录后平台显示 pair code,用户复制
  2. 执行绑定:
    bash
    mkdir -p ~/.moss-trade-bot
    cd {baseDir}/scripts && python3 live_trade.py bind \
      --platform-url "https://ai.moss.site" \
      --pair-code "<pair_code>" \
    

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

These lines require bot metadata to include both zh and en fields and state the script will reject uploads if English is not provided. This imposes a specific language policy on users without opt-in or documented justification tied to locale-specific compliance. Under the natural-language policy rule, forcing a language/locale choice without user choice is a policy concern.

Content

No source excerpt is available for this finding.

File System Enumeration

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code scans file system directories looking for sensitive files. This could be reconnaissance for credential theft.

Content

Scanner excerpt · knowledge/platform_ops.md (reported line 152)May include surrounding context.

前置检查

bash
ls -la ~/.moss-trade-bot/agent_creds.json 2>/dev/null || true
# 如需确认平台地址是否已保存到本地 creds,可读取 base_url:
python3 - <<'PY'
import json, pathlib

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill authorizes starting automatic live trading when the user says a broad phrase like “启动自动交易”, and explicitly says no per-trade confirmation is needed. In a high-risk financial context, this can trigger real market actions without a fresh, explicit activation-time warning, amount/leverage recap, or stronger confirmation step, increasing the chance of accidental or socially engineered execution.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code file contains natural-language documentation entirely in Chinese, including the top-level module docstring and many inline comments, but provides no indication that Chinese is optional or that the skill is region-specific. Under the policy rule for language or locale constraints, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The top-level docstring is entirely in Chinese and presents the skill's operational constraints only in that language. This creates a language/locale policy concern because users are not given an opt-in choice or an alternative language, and no region-specific justification is stated in the file.

Content

No source excerpt is available for this finding.

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
75% confidence
Finding

Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Content

Scanner excerpt · scripts/core/fetcher.py (reported line 95)May include surrounding context.

python
if use_cache and os.path.exists(cache_file):
        mod_time = os.path.getmtime(cache_file)
        if time.time() - mod_time < 86400:
            print(f"Using cached file: {os.path.basename(cache_file)}", file=__import__('sys').stderr)
            return pd.read_csv(cache_file, parse_dates=["timestamp"])

    if not since_date:

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
75% confidence
Finding

Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Content

Scanner excerpt · scripts/core/fetcher.py (reported line 106)May include surrounding context.

python
matches = sorted(glob.glob(pattern), key=os.path.getmtime, reverse=True)
            if matches:
                best = matches[0]
                print(f"Using cached file: {os.path.basename(best)}", file=__import__('sys').stderr)
                return pd.read_csv(best, parse_dates=["timestamp"])

    exchange = get_exchange(exchange_id)

Dynamic import via __import__()

Medium
Category
Dangerous Code Execution
Confidence
75% confidence
Finding

Dynamic import() can load arbitrary modules at runtime, bypassing static analysis and potentially importing malicious code.

Content

Scanner excerpt · scripts/core/fetcher.py (reported line 161)May include surrounding context.

python
# 缓存
    df.to_csv(cache_file, index=False)
    print(f"Fetched {len(df)} candles for {symbol} {timeframe}, cached to {cache_file}", file=__import__('sys').stderr)

    return df

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file contains user-facing descriptive text in Chinese only, while the rest of the script is otherwise usable broadly. This imposes a specific language on users without opt-in or an alternative locale, matching the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file exposes live trading and credential-binding workflows even though the skill is primarily framed around local backtesting and optional external validation. This creates a dangerous capability mismatch: a user or downstream agent may invoke real-money operations under the assumption that the skill is simulation-only, increasing the chance of unintended financial loss.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The script writes API credentials, including the API secret, to a JSON file on disk without enforcing secure permissions or warning that the file contains highly sensitive trading credentials. If the file is exposed through weak filesystem permissions, backups, logs, or multi-user environments, an attacker could take over the linked trading account and place unauthorized trades.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.