Back to skill

Security audit

股票历史行情查询 - Stock Historical Data Query - 极速数据

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward stock data lookup wrapper that sends user-requested stock queries to JisuAPI using a configured API key.

Install only if you are comfortable sending stock codes, date ranges, and your JISU_API_KEY to JisuAPI. Use a dedicated API key with quota or billing limits where possible, and avoid treating returned market data as investment 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

Warning
Location
stockhistory.py:17
Finding

API Credential Exposed in URL Query Parameters

Content
View full analysis

Vulnerability Details

File Location: stockhistory.py, lines 17–25
Vulnerability Type: API credential exposure through URL query strings
Risk Level: Medium

Vulnerable Code:

python
def _call_api(path: str, appkey: str, params: dict = None):
    if params is None:
        params = {}
    all_params = {"appkey": appkey}
    all_params.update({k: v for k, v in params.items() if v not in (None, "")})

    url = f"{BASE_URL}/{path}"

    try:
        resp = requests.get(url, params=all_params, timeout=10)

Technical Analysis

The code adds the value of JISU_API_KEY to all_params as appkey and passes that dictionary to requests.get() through the params argument. The Requests library serializes these parameters into the request URL, resulting in a URL resembling:

text
https://api.jisuapi.com/stockhistory/query?appkey=SECRET_VALUE&code=300917

HTTPS encrypts the request while it is in transit, but it does not prevent complete URLs from being recorded at either endpoint or by trusted infrastructure. Query strings may appear in reverse-proxy access logs, API gateway logs, application telemetry, debugging output, monitoring systems, or HTTP client instrumentation. Consequently, personnel or attackers with access to those records may recover the API credential.

This is an insecure credential-handling practice consistent with CWE-598, “Use of GET Request Method With Sensitive Query Strings.”

Attack Path

  1. A user configures a valid JisuAPI credential in the JISU_API_KEY environment variable.
  2. The user invokes the skill's query, list, or detail command.
  3. _call_api() inserts the credential into the GET request's URL query string.
  4. An API gateway, reverse proxy, endpoint server, telemetry component, or debugging facility records the complete request URL.
  5. An attacker or unauthorized operator gains read access to the relevant logs or telemetry.

...[truncated 856 chars]

Remediation
View remediation

Remediation Suggestions

  1. Prefer an authentication header, such as Authorization, or a POST body if JisuAPI officially supports either mechanism:

    python
    headers = {"Authorization": f"Bearer {appkey}"}
    resp = requests.get(url, params=params, headers=headers, timeout=10)
    
  2. Follow the provider's documented authentication mechanism. Do not migrate the key to a custom header unless the service supports it, because doing so could break authentication.

  3. If JisuAPI requires appkey in the query string:

    • Disable full-query logging where possible.
    • Configure gateways, proxies, telemetry systems, and exception handlers to redact appkey.
    • Ensure debug-level HTTP logging is disabled in production.
    • Restrict access to request logs and apply short retention periods.
    • Use a dedicated, least-privilege API credential for this skill.
    • Configure usage limits, billing alerts, and anomaly monitoring.
    • Rotate the credential periodically and immediately after suspected exposure.
  4. Avoid including response or exception details that might reproduce sensitive request URLs in user-visible output.

  5. Add an automated test that captures generated diagnostics and verifies that the configured API key never appears in logs or error messages.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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 (5)

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding

Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill declares it requires an environment variable and implicitly performs outbound API access, but it does not declare an explicit tool scope such as permissions or allowed-tools. This can weaken least-privilege enforcement and make the skill's network and secret-access behavior less transparent to the host, increasing the chance of unintended secret exposure or unauthorized external calls.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

该描述先给出两个示例,但随后以“或类似历史行情问题时”概括,未明确哪些问题应触发、哪些不应触发,容易扩大到一般性的股票咨询或分析对话。对于技能激活条件,缺少明确范围或排除示例会增加误调用风险。

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 · stockhistory.py (reported line 14)May include surrounding context.

python
import requests


BASE_URL = "https://api.jisuapi.com/stockhistory"


def _call_api(path: str, appkey: str, params: dict = None):

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

描述内容及示例均以中文直接规定用户表达方式和输出场景,没有说明是否支持其他语言,也未给出用户可选择语言的选项。按自然语言政策要求,若对语言/locale 形成隐性强制,应提供用户选择或明确、合理的地域性限制说明。

Content

No source excerpt is available for this finding.