Back to skill

Security audit

Industry Research v1.3.2

Security checks for vulnerabilities and agentic risk

Overview

This financial research skill is mostly purpose-aligned, but it needs review because it handles API keys, writes local archives and reports, bypasses the platform search tool with direct web requests, and contains unsafe implementation details.

Install only if you are comfortable with a finance-research skill making direct web/API requests, using a Bocha API key, and storing research archives, ETF caches, and reports locally. Avoid running check_env_keys.py with real credentials, treat generated reports as untrusted if commodity names come from external input, and prefer pinned dependencies and HTTPS-only data sources before relying on the output for decisions.

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

T09 · Insecure Skill Coding Practices

Warning
Location
check_env_keys.py:2
Finding

API Key Prefixes Are Disclosed Through Diagnostic Output

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
ira/sources.py:94
Finding

Market Data Is Retrieved Over Unencrypted HTTP Connections

Content
View full analysis
Optional[float]: """获取腾讯实时换手率""" market = "sh" if code.startswith(("6", "5")) else "sz" url = f"http://qt.gtimg.cn/q={market}{code}" try: r = requests.get(url, headers=HEADERS, timeout=5) ``` ```python code_padded = code.zfill(5) url = f"http://web.ifzq.gtimg.cn/appstock/app/fqkline/get?param=hk{code_padded},day,,,{days},qfq" try: r = requests.get(url, headers=HEADERS, timeout=DEFAULT_TIMEOUT) ``` The same cleartext pattern also appears in the standalone diagnostic files `test_tx_fields.py`, `test_tx_kline.py`, and `test_tx_turnover.py`. ### Technical Analysis These requests use HTTP rather than HTTPS. HTTP provides neither confidentiality nor server authentication, and it does not protect response integrity. An attacker controlling or observing the network path can read requested stock symbols and modify returned K-line, price, volume, or turnover data. This is particularly important because the affected Tencent endpoints are used as automatic fallback sources. A forged response that conforms to the expected JSON or delimiter format can be accepted as legitimate market data and propagated into technical analysis and generated reports. Although the queried market information is public, the integrity of the response is security-relevant because users may rely on the Skill's output for financial research. ### Attack Path 1. The primary market-data source fails ...[truncated 1072 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
ira/report.py:216
Finding

Unescaped Commodity Names Permit Stored HTML Injection in Generated Reports

Content
View full analysis
{commodity} 研报 - {today_str} ``` ```python

{commodity} 行业研究报告

报告日期:{today_str} | 数据来源:CLI 自动化采集 + 公开资料

一句话总结: {_esc(summary)}
``` ```python out_path = REPORT_DIR / f"{commodity}_{datetime.now().strftime('%Y%m%d_%H%M')}.html" out_path.write_text(html, encoding="utf-8") ``` The value is reachable from the CLI without validation: ```python p_rep = sub.add_parser("report", help="生成 HTML 研报") p_rep.add_argument("commodity", nargs="?", help="商品中文名(空 = 全部今日归档)") ``` ```python p = generate_report(args.commodity) ``` ### Technical Analysis The report generator defines `_esc()` and applies it to many report values, but it interpolates `commodity` directly into the HTML `` and `<h1>` elements. The CLI accepts the commodity argument without an allowlist or escaping step. A commodity value containing HTML markup can therefore become persistent active content in the generated report. For example, a payload using an SVG event handler can close or alter the heading context and execute JavaScript when the report is opened in a browser. The same value is also used directly in the output filename. This creates unsafe path construction. Path separators or special path components could alter the intended location on platforms where the crafted name remains reachable through the archive workflow. The archive module partially replaces slash characters when creating archive names, but report generation does not apply a consistent canonical filename policy. ### Attack Path 1. An attacker convinces a user or automate ...[truncated 1336 chars]
Remediation
View remediation
`, `

`, and any other HTML context. - Generate filenames through a separate strict sanitizer rather than using HTML escaping: ```python safe_filename = re.sub(r"[^A-Za-z0-9._\-\u4e00-\u9fff]", "_", commodity) safe_filename = safe_filename.strip("._") or "report" out_path = REPORT_DIR / f"{safe_filename}_{timestamp}.html" ``` - Resolve the output path and verify that it remains under `REPORT_DIR` before writing: ```python base = REPORT_DIR.resolve() out_path = (base / filename).resolve() if base not in out_path.parents: raise ValueError("Invalid report path") ``` - Apply the same canonical naming policy in `archive.py` and `report.py`. - Prefer a template engine with automatic HTML escaping. - Add tests using payloads containing ``, quotes, `..`, forward slashes, and backslashes. - Consider a restrictive Content Security Policy in generated reports, such as disabling scripts and external resources. ]]>

T08 · Insecure Dependencies

Note
Location
SKILL.md:266
Finding

Third-Party Python Dependencies Are Installed Without Version or Integrity Pinning

Content
View full analysis
Remediation
View remediation
requests== yfinance== ``` - Generate a lock file containing all transitive dependencies. - Use hash verification, for example `pip install --require-hashes -r requirements.txt`. - Install from a trusted, explicitly configured package index. - Run dependency vulnerability and provenance checks in CI. - Review and update pinned dependencies on a controlled schedule rather than resolving mutable latest versions during installation. - Prefer installation in a virtual environment with only the filesystem and network permissions required by the Skill. ]]>
Vulnerability Patterns
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • 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
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (85)

Tainted flow: 'headers' from os.environ.get (line 24, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · bocha_search.py (reported line 29)May include surrounding context.

python
"Content-Type": "application/json",
    }
    t0 = time.time()
    r = requests.post(url, json=payload, headers=headers, timeout=15)
    r.raise_for_status()
    data = r.json()
    elapsed = time.time() - t0

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

If the skill persists archives under local workspace paths without clearly declaring file-write behavior, that creates a real undeclared data-retention surface. Hidden persistence can store user prompts, analysis content, or sensitive research context longer than users expect.

Content

No source excerpt is available for this finding.