Back to skill

Security audit

Trading Quant

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed market-data and analysis CLI; it has normal finance-data risks but no artifact-backed hidden, destructive, or deceptive behavior.

Install only if you are comfortable with a finance-analysis tool that contacts public market/news APIs, writes local caches, and may download model artifacts for sentiment analysis. Treat BUY/SELL-style scores as informational analysis, not investment advice, and prefer pinned dependencies/model revisions before using it in a sensitive environment.

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

T08 · Insecure Dependencies

Warning
Location
scripts/lib/analysis/sentiment.py:235
Finding

Unpinned Dependencies and Mutable Runtime Model Downloads

Content
View full analysis

Vulnerability Details

File Location: requirements.txt:1-6; scripts/lib/analysis/sentiment.py:235-254
Vulnerability Type: Supply-chain integrity weakness
Risk Level: Medium

Vulnerable Code

requirements.txt:1-6:

text
pandas>=2.0.0
pandas-ta>=0.3.14b
httpx>=0.27.0
aiohttp>=3.9.0
pyyaml>=6.0
python-dateutil>=2.9.0

scripts/lib/analysis/sentiment.py:235-254:

python
try:
    tokenizer = AutoTokenizer.from_pretrained(
        model_name,
        local_files_only=True,
        cache_dir=self.cache_dir
    )
    model = AutoModelForSequenceClassification.from_pretrained(
        model_name,
        local_files_only=True,
        cache_dir=self.cache_dir
    )
    logger.info(f"Model loaded from local cache: {model_name}")
except (OSError, ValueError):
    # Download from Hugging Face
    logger.info(f"Downloading model: {model_name}")
    tokenizer = AutoTokenizer.from_pretrained(
        model_name,
        cache_dir=self.cache_dir
    )
    model = AutoModelForSequenceClassification.from_pretrained(
        model_name,
        cache_dir=self.cache_dir
    )

Technical Analysis

All Python dependencies use open-ended minimum-version constraints. There is no lockfile, package hash verification, or maximum-version constraint. Consequently, separate installations can resolve to materially different dependency sets, including future releases that were never reviewed with this project.

The sentiment analyzer also downloads models by mutable repository name when a local copy is unavailable. It does not specify a reviewed Hugging Face commit through the revision parameter. The effective model artifact can therefore change after the Skill package has been audited.

This creates two related supply-chain risks:

  1. A compromised or unexpectedly incompatible future Python package release can be installed automatically.
  2. A ...[truncated 1656 chars]
Remediation
View remediation

Remediation Suggestions

  1. Replace open-ended dependency ranges with exact, reviewed versions.
  2. Generate and commit a reproducible lockfile using a tool such as pip-tools, Poetry, or uv.
  3. Require package hashes during installation, for example through a hash-locked requirements file and pip install --require-hashes.
  4. Use a controlled package index or approved internal mirror for production deployments.
  5. Pin every Hugging Face model to a reviewed immutable commit:
    python
    AutoTokenizer.from_pretrained(
        model_name,
        revision="REVIEWED_COMMIT_SHA",
        cache_dir=self.cache_dir
    )
    
  6. Prefer reviewed safetensors artifacts and reject legacy serialization formats where practical.
  7. Download and verify models during a controlled installation phase rather than implicitly during command execution.
  8. Provide an offline or local_files_only=True production mode that fails safely if an approved model is unavailable.
  9. Add dependency and model-artifact scanning to CI, including alerts for changed lockfile hashes or model revisions.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/batch_fetch.sh:8
Finding

Predictable Temporary Directory Allows Symlink-Based File Overwrite

Content
View full analysis

Vulnerability Details

File Location: scripts/batch_fetch.sh:8-9,15-47,55
Vulnerability Type: Insecure temporary-file handling
Risk Level: Medium

Vulnerable Code

bash
OUT=/tmp/quant_batch_$$
mkdir -p "$OUT"

profile=${1:-closing}

case "$profile" in
  closing)
    $PYTHON "$QUANT" stock_analysis > "$OUT/stock.json" 2>/dev/null &
    $PYTHON "$QUANT" northbound_flow > "$OUT/northbound.json" 2>/dev/null &
    $PYTHON "$QUANT" market_anomaly > "$OUT/anomaly.json" 2>/dev/null &
    $PYTHON "$QUANT" news_sentiment > "$OUT/news.json" 2>/dev/null &
    $PYTHON "$QUANT" gold_analysis > "$OUT/gold.json" 2>/dev/null &
    $PYTHON "$QUANT" margin_data > "$OUT/margin.json" 2>/dev/null &
    $PYTHON "$QUANT" lhb > "$OUT/lhb.json" 2>/dev/null &
    $PYTHON "$QUANT" top_amount > "$OUT/top_amount.json" 2>/dev/null &
    $PYTHON "$QUANT" save_daily > "$OUT/save.json" 2>/dev/null &
    ;;
  daily)
    $PYTHON "$QUANT" stock_analysis > "$OUT/stock.json" 2>/dev/null &
    $PYTHON "$QUANT" northbound_flow > "$OUT/northbound.json" 2>/dev/null &
    $PYTHON "$QUANT" global_overview > "$OUT/global.json" 2>/dev/null &
    ;;
  weekly)
    $PYTHON "$QUANT" stock_analysis > "$OUT/stock.json" 2>/dev/null &
    $PYTHON "$QUANT" global_overview > "$OUT/global.json" 2>/dev/null &
    ;;
  morning)
    $PYTHON "$QUANT" global_overview > "$OUT/global.json" 2>/dev/null &
    $PYTHON "$QUANT" northbound_flow > "$OUT/northbound.json" 2>/dev/null &
    ;;
  macro)
    $PYTHON "$QUANT" global_overview > "$OUT/global.json" 2>/dev/null &
    $PYTHON "$QUANT" northbound_flow > "$OUT/northbound.json" 2>/dev/null &
    ;;
esac

wait

echo "{"
first=1
for f in "$OUT"/*.json; do
  name=$(basename "$f" .json)
  [ $first
...[truncated 2368 chars]
Remediation
View remediation

Remediation Suggestions

  1. Create the directory atomically with mktemp:
    bash
    OUT=$(mktemp -d -t quant_batch.XXXXXXXX) || exit 1
    
  2. Register cleanup immediately and quote the path:
    bash
    trap 'rm -rf -- "$OUT"' EXIT HUP INT TERM
    
  3. Set a restrictive permission mask before creating files:
    bash
    umask 077
    
  4. Enable defensive shell behavior:
    bash
    set -euo pipefail
    
  5. Verify that the temporary directory is owned by the current user and is not a symbolic link if compatibility prevents using mktemp.
  6. Do not run this script from a privileged cron account unless strictly necessary.
  7. Avoid suppressing all standard error output during scheduled operation; send failures to a protected log so directory-creation and redirection problems are detectable.
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (81)

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
89% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The implementation appears to provide batch or historical quote retrieval via yfinance rather than real-time cross-market quantitative analysis. Financial users are particularly sensitive to stale or partial data, so mislabeled functionality materially increases operational and trust risk.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
80% confidence
Finding

The skill advertises executable entrypoints but declares no explicit tool scope or permissions despite requiring network, filesystem, and likely environment access. This weakens least-privilege boundaries and can let a broadly-invoked skill operate with more capability than users or the platform expect.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The invocation description is broad enough to match many generic stock-related prompts, which can cause over-triggering of a skill that also has network and file capabilities. Combined with the significant description/behavior mismatches, this increases the chance of unintended data access or misleading outputs.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The manifest description and the rest of the document are written primarily in Chinese and present the skill as a Chinese-language tool, but they do not state that language selection is optional. This can violate language/locale policy where users should not be forced into a specific language without opt-in or clear justification.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The manifest describes realtime quotes, multi-factor scoring,涨跌停/北向资金/分钟级资金流, global overview, and fund-flow analysis. In the closing profile, the script also triggers news_sentiment, margin_data, lhb, top_amount, and save_daily, which are not mentioned in the stated skill description and therefore expand the advertised behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This Python file contains many natural-language output strings in Chinese that appear to populate the returned signals list for downstream user display. Because the skill does not offer language selection or indicate that it is intentionally limited to a Chinese-speaking context, it may violate a language/locale policy requiring user choice or explicit justification.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring says it 'completely relies on broker interfaces' and the classify_industry docstring says it returns 'unknown' when all interfaces fail. In practice, _load_file_cache and _prefill_from_watchlist load and persist industry values from /tmp and from knowledge/watchlist.json before any API call, so the documented intent contradicts the actual behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This code hard-codes natural-language output in Chinese for the confidence field, which is user-facing structured output. The file also consistently emits Chinese signal and alert strings, with no opt-in or locale-selection mechanism, which fits the language/locale policy violation category.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.