Back to skill

Security audit

Quant Data Platform

Security checks for vulnerabilities and agentic risk

Overview

This skill looks like a market-data platform, but it can silently return invented financial data through production-looking APIs.

Review carefully before installing. Do not use this for live trading, automated decisions, compliance checks, or serious backtests unless the mock/random paths are removed or explicitly gated and every result includes data source/provenance. Pin dependencies, protect the Tushare token, and treat third-party provider calls as external data sharing.

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
SKILL.md:52
Finding

Unpinned Third-Party Dependencies Create a Supply-Chain Risk

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:52-56
Vulnerability Type: Unpinned dependency installation
Risk Level: Medium

Vulnerable Code

bash
## Installation

```bash
pip install tushare akshare pandas numpy
text

### Technical Analysis

The installation instructions install four third-party packages without fixed versions, integrity hashes, a lock file, or a specified trusted package index. Consequently, the versions installed depend on the package-index state at installation time and may change without any modification to this project.

Python package installation and subsequent imports can execute package-controlled code with the privileges of the user running the installation or application. If a package release or its distribution account is compromised, following these instructions could introduce malicious code into the environment. The runtime also passes the configured Tushare token to the imported Tushare package, increasing the potential effect of a compromised dependency.

The audited project does not itself demonstrate dependency confusion, typosquatting, or a currently compromised package. The confirmed weakness is the absence of dependency pinning and integrity controls.

### Attack Path

1. An attacker compromises an upstream dependency, its publisher account, or the package distribution channel.
2. The attacker publishes a malicious release under one of the dependency names.
3. A user follows the documented `pip install` command without version or hash constraints.
4. The package resolver selects and installs the malicious release.
5. Package installation hooks or imported package code execute in the user's environment.
6. The malicious dependency can access data available to that process, potentially including the `TUSHARE_TOKEN`, local files readable by the user, and application-supplied market data.

### Impact Assessment

Successful exploitation would execute depen
...[truncated 459 chars]
Remediation
View remediation

Remediation Suggestions

  1. Create a reviewed dependency manifest with exact versions, such as:
    text
    tushare==REVIEWED_VERSION
    akshare==REVIEWED_VERSION
    pandas==REVIEWED_VERSION
    numpy==REVIEWED_VERSION
    
  2. Generate and verify cryptographic hashes for every direct and transitive dependency, using a hash-enforcing installer workflow such as pip install --require-hashes.
  3. Commit a lock file generated from reviewed package versions and update it through a controlled dependency-review process.
  4. Install packages inside a dedicated virtual environment or container under a non-privileged account.
  5. Explicitly configure an approved HTTPS package index and prevent fallback to untrusted indexes.
  6. Run software-composition analysis and vulnerability checks in CI before dependency updates are accepted.
  7. Avoid exposing production credentials during dependency installation or import-time initialization, and use a narrowly scoped Tushare token where supported.

T09 · Insecure Skill Coding Practices

Error
Location
quant_data.py:204
Finding

Provider Failures Silently Produce Randomized Financial Data

Content
View full analysis

Vulnerability Details

File Location: quant_data.py:204-213, quant_data.py:264-276, quant_data.py:366-395, and quant_data.py:459-474
Vulnerability Type: Fail-open error handling and unmarked synthetic data
Risk Level: High

Vulnerable Code

Real-time quote failures are converted into mock quotes:

python
            except Exception as e:
                # Fallback to mock data
                quotes = self._get_mock_quotes(codes)
        else:
            quotes = self._get_mock_quotes(codes)

        self.cache.set(cache_key, quotes, ttl=10)  # Cache for 10 seconds
        return quotes

Tick-data failures are suppressed and replaced with mock records:

python
        if self._tushare:
            try:
                pro = self._tushare.pro_api()
                df = pro.tick(ts_code=code, trade_date=date.replace('-', ''))
                return df.to_dict('records')
            except:
                pass

        # Return mock data
        return self._get_mock_tick_data(code, date)

Historical daily-data failures are replaced with mock bars:

python
                    result[code] = bars
                except:
                    result[code] = self._get_mock_daily(code, start, end)
            else:
                result[code] = self._get_mock_daily(code, start, end)

        # Cache for 1 day
        self.cache.set(cache_key, result, ttl=86400)
        return result

Trading-calendar failures are similarly hidden:

python
        if self._tushare:
            try:
                pro = self._tushare.pro_api()
                df = pro.trade_cal(
                    start_date=start.replace('-', ''),
                    end_date=end.replace('-', ''),
                    is_open='1'
                )
                return df['cal_date'].tolist()
            except:
                pass

        # Return
...[truncated 2924 chars]
Remediation
View remediation

Remediation Suggestions

  1. Fail closed by default. Raise typed exceptions for authentication errors, provider outages, rate limits, malformed responses, and unsupported operations.
  2. Remove bare except clauses and catch only anticipated exception types. Preserve exception context and record structured diagnostic logs.
  3. Make simulation behavior explicitly opt-in, for example with mode="mock", and reject mock mode in production configurations.
  4. Return provenance with every result, including provider, retrieval time, simulation status, freshness, and validation status.
  5. Use distinct mock-data types or interfaces so synthetic data cannot be accidentally passed into production trading paths.
  6. Do not cache failed or synthetic responses in production. Cache entries should include source and integrity metadata.
  7. Add startup and runtime health checks that verify credentials, provider connectivity, expected schemas, and data freshness.
  8. Add circuit breakers that stop dependent trading or analytical workflows when authoritative data is unavailable.
  9. Validate market invariants before accepting provider data, including timestamp freshness, nonnegative volumes, valid OHLC relationships, and expected trading dates.
  10. Add tests confirming that provider failures raise visible errors rather than returning plausible-looking random values.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (12)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The module presents itself as a comprehensive quantitative data platform, but large portions of the implementation silently return mock or randomly generated data. In a quantitative trading context, this can directly mislead downstream models, backtests, monitoring, or trading decisions, creating integrity risk rather than a mere documentation issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Multiple code paths assume Chinese-localized field names and outputs, such as DataFrame columns like '代码', '名称', and generated content containing Chinese text, with no option for users to choose another language or locale. This creates a natural-language locale policy issue because the implementation is effectively fixed to a specific language context without opt-in.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The order book API claims to return bid/ask data but actually fabricates synthetic levels with random volumes. In trading infrastructure, fake order book data can distort execution logic, liquidity assessment, slippage estimation, and surveillance, making this dangerous due to deceptive data integrity loss.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The sentiment method advertises sentiment analytics but returns random scores, which can corrupt alpha models, dashboards, and risk signals that rely on alternative data. The danger is heightened because the outputs look plausible enough to be trusted by callers unless they are explicitly warned.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The news API fabricates templated news items while presenting them as if they were retrieved market news. In a trading platform, fake news can influence manual traders, automated sentiment ingestion, alerting systems, and audit trails, making it a serious integrity and decision-support risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The mock news templates, source names, and market fallback text are all Chinese-language strings, and the function provides no way to request a different language. This is a direct natural-language policy concern because user-visible content is forced into one locale by default.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The fundamentals API returns random financial metrics despite claiming to provide actual company fundamentals. This can poison valuation screens, factor models, compliance checks, and investment decisions, especially because numeric outputs appear realistic and may be consumed automatically.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The factor API claims to provide pre-computed factor values but instead generates random values on demand. In quantitative workflows, factors are direct inputs into selection, ranking, and portfolio construction, so silent fabrication can materially damage models and trading outcomes.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The data-quality check returns random quality metrics while implying a genuine assessment. This can cause operators to trust bad datasets or overlook outages and corruption, undermining operational controls that are especially important in market-data infrastructure.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

The credential setup example encourages placing an API token in code or environment configuration without any guidance on secure handling, storage, or avoiding accidental disclosure. In a quantitative trading context, leaked data-provider tokens can enable unauthorized API usage, quota exhaustion, billing abuse, or exposure of connected account activity.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

This code sends user-supplied stock identifiers and dates to the Tushare API, and similar third-party retrieval also occurs via Akshare elsewhere in the class. While network access is central to a data platform, this specific code path has no visible confirmation, logging, or inline disclosure about transmitting request data to external providers.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.