Back to skill

Security audit

A股新闻研报检索

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed Eastmoney financial search helper that sends user queries to an external API and saves results locally, with manageable privacy and file-writing cautions.

Install only if you are comfortable sending finance search queries to Eastmoney using MX_APIKEY and storing returned results on disk. Keep MX_OUTPUT_DIR inside a private workspace, avoid shared writable directories, and do not use this for confidential or regulated research topics unless your organization permits that external API use.

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
mx_search.py:157
Finding

Predictable Output Files Permit Symlink-Based File Overwrite

Content
View full analysis
= 3: query = " ".join(sys.argv[1:-1]) output_dir = Path(sys.argv[-1]) else: query = " ".join(sys.argv[1:]) output_dir = DEFAULT_OUTPUT_DIR # 确保输出目录存在 output_dir.mkdir(parents=True, exist_ok=True) try: mx = MXSearch() result = mx.search(query) # 终端显示格式化结果 print(mx.format_pretty(result)) # 提取纯文本保存为 .txt 文件 content = mx.extract_content(result) if content.strip(): filename = output_dir / f"mx_search_{safe_filename(query)}.txt" with open(filename, "w", encoding="utf-8") as f: f.write(content) print(f"\n✅ 纯文本结果已保存到: {filename}") # 同时保存原始 JSON 结果 json_filename = output_dir / f"mx_search_{safe_filename(query)}.json" with open(json_filename, "w", encoding="utf-8") as f: json.dump(result, f, ensure_ascii=False, indent=2) ``` ### Technical Analysis The command-line interface accepts an arbitrary output directory and derives both output filenames deterministically from the search query. It then opens those paths in write mode without checking whether the destination already exists or is a symbolic link. Python's ordinary `open(path, "w")` follows symbolic links and truncates an existing destination. Consequently, if another local user or process can write to the selected output directory, it can predict the filename, place a symbolic link at that path, and cause the process to truncate and replace the symlink target. The same deterministic filename also causes ordinary executions of identical or colliding sanitized queries to overwrite previous search results silently. Exploitati ...[truncated 1281 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (8)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
93% confidence
Finding

The skill invokes a local Python script, depends on an environment secret (MX_APIKEY), writes output files, and retrieves remote content, but it does not declare an explicit tool/permission scope. That creates a least-privilege gap: an agent or reviewer cannot clearly constrain or audit the skill’s access to environment variables, filesystem writes, and network use, increasing the risk of overbroad execution or misuse if the script behavior changes.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill is described as search/retrieval, but it persistently stores both extracted text and raw JSON search results to local files by default. This expands data handling beyond transient retrieval and can unintentionally retain sensitive user queries, proprietary research topics, or returned content on disk where other local users, processes, or backups may access them.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
90% confidence
Finding

This code performs a network POST to an external domain with user-supplied query content and an API key header. Although external transmission is core to the skill's functionality, it still represents a real data egress point and secret usage boundary that can expose sensitive financial research intent or be problematic in restricted environments.

Content

Scanner excerpt · mx_search.py (reported line 53)May include surrounding context.

python
"query": query
        }
        
        response = requests.post(self.BASE_URL, headers=headers, json=data, timeout=30)
        response.raise_for_status()
        return response.json()

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill sends the user's search query to a third-party financial search API, which is an external disclosure of potentially sensitive intent, trading research, or internal topics. In this skill's context, external lookup is expected, but the absence of explicit disclosure/consent still matters because finance-related queries can themselves be confidential.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

Accepting an arbitrary output directory and creating it allows the skill to write retrieved content to any filesystem location the running user can access. In an agent context, this broadens the capability from simple information retrieval to general file persistence, which may be surprising and can facilitate unintended data placement or policy bypass if the agent is expected to be read-only.

Content

No source excerpt is available for this finding.

Tainted flow: 'filename' from os.getenv (line 183, credential/environment) → open (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · mx_search.py (reported line 184)May include surrounding context.

python
content = mx.extract_content(result)
        if content.strip():
            filename = output_dir / f"mx_search_{safe_filename(query)}.txt"
            with open(filename, "w", encoding="utf-8") as f:
                f.write(content)
            print(f"\n✅ 纯文本结果已保存到: {filename}")

Tainted flow: 'json_filename' from os.getenv (line 189, credential/environment) → open (file write)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · mx_search.py (reported line 190)May include surrounding context.

python
# 同时保存原始 JSON 结果
        json_filename = output_dir / f"mx_search_{safe_filename(query)}.json"
        with open(json_filename, "w", encoding="utf-8") as f:
            json.dump(result, f, ensure_ascii=False, indent=2)
        print(f"📄 原始结果已保存到: {json_filename}")

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

This eval file embeds user-facing prompts and expected behavior exclusively in Chinese, which indicates the skill may be constrained to a specific language without any explicit user opt-in or justification. Under the policy rule, forcing a specific language/locale in natural-language content can be a violation when no alternative or scope note is provided.

Content

No source excerpt is available for this finding.