Back to skill

Security audit

Cifang Fund Data

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent Cifang ETF/LOF market-data helper, but users should avoid passing the API key on the command line.

Install only if you intend to use the Cifang Quant service and are comfortable sending your Cifang API key to that service. Prefer setting CIFANG_API_KEY through a scoped secret manager or short-lived environment variable; do not put the key directly in a shell command on shared, monitored, or logged systems. Treat outputs as market data for analysis, not financial advice.

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

T09 · Insecure Skill Coding Practices

Note
Location
scripts/fetch_fund_data.py:295
Finding

API Key Exposure Through Command-Line Arguments

Content
View full analysis

Vulnerability Details

File Location: scripts/fetch_fund_data.py:295; insecure usage is recommended in README.md:33-34 and SKILL.md:16
Vulnerability Type: API key disclosure through process arguments, shell history, and operational telemetry
Risk Level: Low

Vulnerable Code

python
parser.add_argument("--api-key", help="API密钥,如果不提供则从环境变量读取")

The README explicitly recommends supplying the secret through this argument:

bash
# 使用 --api-key(推荐)
python scripts/fetch_fund_data.py --api-key "your-api-key" list --keyword 沪深300

The Skill instructions similarly characterize command-line injection as a preferred method:

markdown
2. **优先安全注入**:优先通过 `--api-key` 参数或短期环境变量注入,避免写入长期共享配置

Technical Analysis

Supplying an API key as a command-line argument places the plaintext credential in the process argument vector. Depending on the operating environment, it may consequently be exposed through:

  • Shell history files
  • Process-listing and monitoring tools
  • OS audit records
  • Terminal session recordings
  • CI/CD job logs and orchestration telemetry
  • Diagnostic or support bundles

This is especially problematic because the project documentation recommends --api-key as the preferred method. The implementation does not intentionally print the key, and the key is transmitted only to the fixed, documented HTTPS service. Nevertheless, command-line handling creates an avoidable local disclosure channel.

Attack Path

  1. A user follows the documented recommendation and runs the script with --api-key "secret-value".
  2. The plaintext command is retained in shell history, process telemetry, audit records, or session logs.
  3. A local user, administrator, monitoring service, CI log reader, or other principal with access to those records retrieves the credential.
  4. The exposed key is reused against https://www.cifangquant.com/api.
  5. The attacker consumes the victim' ...[truncated 843 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the --api-key option where compatibility permits, or mark it explicitly as unsafe for shared systems.
  2. Stop recommending command-line secret injection in README.md and SKILL.md.
  3. Prefer CIFANG_API_KEY supplied by a scoped secret manager or a short-lived, restricted process environment.
  4. Offer interactive secret entry through Python's getpass.getpass() when no environment-based secret is available.
  5. If command-line compatibility must be retained, emit a warning explaining that the key may appear in shell history and process telemetry.
  6. Configure CI/CD systems to inject the key through their protected secret mechanisms and mask it from logs.
  7. Continue ensuring that exception messages, debug output, request logs, and diagnostic reports never contain the API key.
  8. Advise users to rotate the credential immediately if it has previously been supplied on a monitored or shared command line.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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
Findings (7)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The description presents a production-style market data skill backed by the 次方量化API for real ETF/LOF list, historical, real-time, and ranking data. The actual code is explicitly labeled as a mock data generator for testing, with hardcoded sample funds and randomly simulated historical prices. While the fund-list and historical-data interfaces are superficially related to the declared domain, the primary behavior is materially different: it fabricates demo data rather than retrieving authentic exchange-traded fund data. It also omits declared core capabilities such as real-time行情 and排行/收益率 data. Therefore this is a clear description-behavior mismatch.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill declares access to sensitive capabilities in practice—environment variables for API keys and outbound network requests—but does not constrain them with explicit tool scope such as permissions or allowed-tools. In an agent setting, this increases the risk of unintended secret access or network egress if the skill is auto-invoked or later extended with scripts that use those capabilities.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger description is broad enough to match many generic finance or market-analysis requests, which can cause the agent to invoke this skill unexpectedly. In context, that matters because invocation may expose the user's API key to a third-party service and initiate network calls without sufficiently specific user intent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This Python file contains its module docstring entirely in Chinese, and the CLI description/help text throughout the file is also Chinese-only. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is clearly justified, which is not documented here.

Content

No source excerpt is available for this finding.

Scope Creep

Low
Category
Excessive Agency
Confidence
70% confidence
Finding

Skill's behavior or capabilities extend beyond its stated purpose. Scope creep allows an agent to perform actions unrelated to its documented functionality, increasing the attack surface.

Content

Scanner excerpt · LICENSE.txt (reported line 12)May include surrounding context.

text
permit persons to whom the Software is furnished to do so.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The usage guidance says users can trigger the skill with natural language and then provides only Chinese prompts, while the README does not state that the skill is China-region-only or that Chinese is optional. This can amount to an implicit language policy constraint without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The module docstring presents the skill description exclusively in Chinese, and the rest of the CLI help text is also Chinese-only. Under the policy rule, forcing a specific language without user opt-in can be a natural-language policy violation when no justification or language selection is provided.

Content

No source excerpt is available for this finding.