Back to skill

Security audit

Stock Deep Report

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a coherent stock-report generator, but its HTML builder can place untrusted market or news text into reports without escaping, creating a real browser-script injection risk.

Review before installing. The skill does not show evidence of theft, backdoors, or destructive behavior, but generated HTML reports should be treated as untrusted until the renderer escapes every externally sourced field. Avoid including private notes in report data, and open generated reports cautiously.

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

Error
Location
references/build.py:185
Finding

Stored HTML and JavaScript Injection in Generated Reports

Content
View full analysis
{h}" html += "{cell}" for i, row in enumerate(rows): cls = " highlight" if row.get("highlight") else "" html += f"" for cell in row["cells"]: align = "right" if isinstance(cell, (int, float)) or (isinstance(cell, str) and cell.replace(".","").replace("-","").replace("+","").isdigit()) else "left" color = "" if isinstance(cell, str): if "+" in cell and "%" in cell: color = 'style="color:var(--red);font-weight:700"' elif "-" in cell and "%" in cell and cell.count("-") == 1: color = 'style="color:var(--green);font-weight:700"' elif cell.startswith(""): color = "" html += f"" html += "" ``` Peer comparison titles, headers, and cells have the same vulnerability: ```python peers_title = peers.get("title", "同行估值与业绩对比") html = f"""
SEC 09   同行对比

🏭 {peers_title}

{h}""" for h in headers: html += f"" html += "" for row in rows: cls = "highlight" if row.get("highlight") else "" html += f'
Remediation
View remediation
{esc(h)}" for row in rows: html += '' if row.get("highlight") else "{esc(cell)}" for cell in row.get("cells", []): html += f"" html += "" ``` 2. Escape peer comparison metadata: ```python html = f"""

🏭 {esc(peers_title)}

""" ``` 3. Escape stock metadata and report dates: ```python stock_name = esc(data["stock"]["name"]) stock_code = esc(data["stock"]["code"]) safe_report_date = esc(report_date) ``` 4. Audit every formatted HTML string in `build.py`. All strings from JSON should be considered untrusted, including: - Stock metadata. - Table headers and cells. - Scores and advice. - Technical-analysis notes. - Survey metadata. - Valuation notes. - Peer comparison fields. - Report dates and footer values. 5. If limited formatting such as `` and `
` must be supported, use a centralized HTML sanitizer with a strict allowlist of tag names and attributes. Do not preserve arbitrary attributes or event handlers. 6. Prefer constructing the report through an auto-escaping template engine. Require an explicit safe-markup type for the small number of fields that intentionally support formatting. 7. Validate structured numeric fields separately. Enforce numeric ranges for percentages, bar widths, scores, and valuation percentiles before using them in CSS or calculations. 8. Add regression tests using payloads such as: ```html ``` The generated report must contain escaped text and must not create executable elements. 9. Correct `SKILL.md` and `references/json_template.md` so they no longer claim that all fields are escaped until complete output encoding is enforced. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (26)

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The docstring claims rendered JSON is safely transformed into HTML, but many fields are interpolated directly into HTML without escaping, including table headers/cells, titles, notes, analyst/corporate-action fields, and even the HTML . If an attacker can influence stock_data.json, they can inject script or markup into the generated report, leading to stored/self-XSS when the HTML is opened locally or served by another component.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Manifest 描述称该技能支持 A股、港股、美股,并从新闻、资金、技术、估值、同行、股东结构等多个维度做全面分析。但同一文件的 network-access 仅允许 *.eastmoney.com 和 cninfo.com.cn,而后文大量数据来源与流程都围绕东方财富/中文站点展开,缺少与美股全面覆盖相匹配的数据来源能力,导致宣称范围明显大于实际可支撑行为。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest description is entirely specified in Chinese and describes Chinese-language report generation, while the skill also claims to support Hong Kong and U.S. stocks. There is no indication that users may choose another language, so the skill effectively imposes a locale/language preference without opt-in.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · SKILL.md (reported line 17)May include surrounding context.

md
# ─────────────────────────────────────────────
allowed-tools:
  - Read                                           # 读取 JSON / 脚本
  - Write                                          # 写入 stock_data.json / build_json.py
  - Edit                                           # 增量更新 JSON
  - Bash                                           # 仅用于执行 references/build.py
  - WebFetch                                       # 抓取东方财富公开网页

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · SKILL.md (reported line 118)May include surrounding context.

md
| 个股资料(F10) | `https://emweb.securities.eastmoney.com/pc_hsf10/pages/index.html?type=web&code={market}{code}` | 公司概况、财务分析、股东研究 |
| 财务分析 | `{F10_URL}#/cwfx` | 利润表、资产负债表、现金流量表 |
| 股东研究 | `{F10_URL}#/gdyj` | 前十大股东、机构持仓 |
| 资金流向 | `https://data.eastmoney.com/zjlx/{code}.html` | 主力资金净流入、超大单/大单/中单/小单 |
| 融资融券 | `https://data.eastmoney.com/rzrq/detail/{code}.html` | 融资余额、融券余量(仅适用于融资融券标的) |
| 沪深港通持股 | `https://data.eastmoney.com/hsgtcg/stock.html?scode={code}` | 北向/南向资金持仓变化(仅适用于沪深港通标的) |
| 公司公告 | `https://data.eastmoney.com/notices/stock/{code}.html` | 近30天公告列表 |

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · SKILL.md (reported line 119)May include surrounding context.

md
| 个股资料(F10) | `https://emweb.securities.eastmoney.com/pc_hsf10/pages/index.html?type=web&code={market}{code}` | 公司概况、财务分析、股东研究 |
| 财务分析 | `{F10_URL}#/cwfx` | 利润表、资产负债表、现金流量表 |
| 股东研究 | `{F10_URL}#/gdyj` | 前十大股东、机构持仓 |
| 资金流向 | `https://data.eastmoney.com/zjlx/{code}.html` | 主力资金净流入、超大单/大单/中单/小单 |
| 融资融券 | `https://data.eastmoney.com/rzrq/detail/{code}.html` | 融资余额、融券余量(仅适用于融资融券标的) |
| 沪深港通持股 | `https://data.eastmoney.com/hsgtcg/stock.html?scode={code}` | 北向/南向资金持仓变化(仅适用于沪深港通标的) |
| 公司公告 | `https://data.eastmoney.com/notices/stock/{code}.html` | 近30天公告列表 |

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · SKILL.md (reported line 120)May include surrounding context.

md
| 个股资料(F10) | `https://emweb.securities.eastmoney.com/pc_hsf10/pages/index.html?type=web&code={market}{code}` | 公司概况、财务分析、股东研究 |
| 财务分析 | `{F10_URL}#/cwfx` | 利润表、资产负债表、现金流量表 |
| 股东研究 | `{F10_URL}#/gdyj` | 前十大股东、机构持仓 |
| 资金流向 | `https://data.eastmoney.com/zjlx/{code}.html` | 主力资金净流入、超大单/大单/中单/小单 |
| 融资融券 | `https://data.eastmoney.com/rzrq/detail/{code}.html` | 融资余额、融券余量(仅适用于融资融券标的) |
| 沪深港通持股 | `https://data.eastmoney.com/hsgtcg/stock.html?scode={code}` | 北向/南向资金持仓变化(仅适用于沪深港通标的) |
| 公司公告 | `https://data.eastmoney.com/notices/stock/{code}.html` | 近30天公告列表 |

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · SKILL.md (reported line 121)May include surrounding context.

md
| 个股资料(F10) | `https://emweb.securities.eastmoney.com/pc_hsf10/pages/index.html?type=web&code={market}{code}` | 公司概况、财务分析、股东研究 |
| 财务分析 | `{F10_URL}#/cwfx` | 利润表、资产负债表、现金流量表 |
| 股东研究 | `{F10_URL}#/gdyj` | 前十大股东、机构持仓 |
| 资金流向 | `https://data.eastmoney.com/zjlx/{code}.html` | 主力资金净流入、超大单/大单/中单/小单 |
| 融资融券 | `https://data.eastmoney.com/rzrq/detail/{code}.html` | 融资余额、融券余量(仅适用于融资融券标的) |
| 沪深港通持股 | `https://data.eastmoney.com/hsgtcg/stock.html?scode={code}` | 北向/南向资金持仓变化(仅适用于沪深港通标的) |
| 公司公告 | `https://data.eastmoney.com/notices/stock/{code}.html` | 近30天公告列表 |

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · SKILL.md (reported line 123)May include surrounding context.

md
| 个股资料(F10) | `https://emweb.securities.eastmoney.com/pc_hsf10/pages/index.html?type=web&code={market}{code}` | 公司概况、财务分析、股东研究 |
| 财务分析 | `{F10_URL}#/cwfx` | 利润表、资产负债表、现金流量表 |
| 股东研究 | `{F10_URL}#/gdyj` | 前十大股东、机构持仓 |
| 资金流向 | `https://data.eastmoney.com/zjlx/{code}.html` | 主力资金净流入、超大单/大单/中单/小单 |
| 融资融券 | `https://data.eastmoney.com/rzrq/detail/{code}.html` | 融资余额、融券余量(仅适用于融资融券标的) |
| 沪深港通持股 | `https://data.eastmoney.com/hsgtcg/stock.html?scode={code}` | 北向/南向资金持仓变化(仅适用于沪深港通标的) |
| 公司公告 | `https://data.eastmoney.com/notices/stock/{code}.html` | 近30天公告列表 |

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · SKILL.md (reported line 124)May include surrounding context.

md
| 个股资料(F10) | `https://emweb.securities.eastmoney.com/pc_hsf10/pages/index.html?type=web&code={market}{code}` | 公司概况、财务分析、股东研究 |
| 财务分析 | `{F10_URL}#/cwfx` | 利润表、资产负债表、现金流量表 |
| 股东研究 | `{F10_URL}#/gdyj` | 前十大股东、机构持仓 |
| 资金流向 | `https://data.eastmoney.com/zjlx/{code}.html` | 主力资金净流入、超大单/大单/中单/小单 |
| 融资融券 | `https://data.eastmoney.com/rzrq/detail/{code}.html` | 融资余额、融券余量(仅适用于融资融券标的) |
| 沪深港通持股 | `https://data.eastmoney.com/hsgtcg/stock.html?scode={code}` | 北向/南向资金持仓变化(仅适用于沪深港通标的) |
| 公司公告 | `https://data.eastmoney.com/notices/stock/{code}.html` | 近30天公告列表 |

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · SKILL.md (reported line 125)May include surrounding context.

md
| 个股资料(F10) | `https://emweb.securities.eastmoney.com/pc_hsf10/pages/index.html?type=web&code={market}{code}` | 公司概况、财务分析、股东研究 |
| 财务分析 | `{F10_URL}#/cwfx` | 利润表、资产负债表、现金流量表 |
| 股东研究 | `{F10_URL}#/gdyj` | 前十大股东、机构持仓 |
| 资金流向 | `https://data.eastmoney.com/zjlx/{code}.html` | 主力资金净流入、超大单/大单/中单/小单 |
| 融资融券 | `https://data.eastmoney.com/rzrq/detail/{code}.html` | 融资余额、融券余量(仅适用于融资融券标的) |
| 沪深港通持股 | `https://data.eastmoney.com/hsgtcg/stock.html?scode={code}` | 北向/南向资金持仓变化(仅适用于沪深港通标的) |
| 公司公告 | `https://data.eastmoney.com/notices/stock/{code}.html` | 近30天公告列表 |

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · SKILL.md (reported line 126)May include surrounding context.

md
| 个股资料(F10) | `https://emweb.securities.eastmoney.com/pc_hsf10/pages/index.html?type=web&code={market}{code}` | 公司概况、财务分析、股东研究 |
| 财务分析 | `{F10_URL}#/cwfx` | 利润表、资产负债表、现金流量表 |
| 股东研究 | `{F10_URL}#/gdyj` | 前十大股东、机构持仓 |
| 资金流向 | `https://data.eastmoney.com/zjlx/{code}.html` | 主力资金净流入、超大单/大单/中单/小单 |
| 融资融券 | `https://data.eastmoney.com/rzrq/detail/{code}.html` | 融资余额、融券余量(仅适用于融资融券标的) |
| 沪深港通持股 | `https://data.eastmoney.com/hsgtcg/stock.html?scode={code}` | 北向/南向资金持仓变化(仅适用于沪深港通标的) |
| 公司公告 | `https://data.eastmoney.com/notices/stock/{code}.html` | 近30天公告列表 |

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · SKILL.md (reported line 127)May include surrounding context.

md
| 个股资料(F10) | `https://emweb.securities.eastmoney.com/pc_hsf10/pages/index.html?type=web&code={market}{code}` | 公司概况、财务分析、股东研究 |
| 财务分析 | `{F10_URL}#/cwfx` | 利润表、资产负债表、现金流量表 |
| 股东研究 | `{F10_URL}#/gdyj` | 前十大股东、机构持仓 |
| 资金流向 | `https://data.eastmoney.com/zjlx/{code}.html` | 主力资金净流入、超大单/大单/中单/小单 |
| 融资融券 | `https://data.eastmoney.com/rzrq/detail/{code}.html` | 融资余额、融券余量(仅适用于融资融券标的) |
| 沪深港通持股 | `https://data.eastmoney.com/hsgtcg/stock.html?scode={code}` | 北向/南向资金持仓变化(仅适用于沪深港通标的) |
| 公司公告 | `https://data.eastmoney.com/notices/stock/{code}.html` | 近30天公告列表 |

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · SKILL.md (reported line 128)May include surrounding context.

md
| 个股资料(F10) | `https://emweb.securities.eastmoney.com/pc_hsf10/pages/index.html?type=web&code={market}{code}` | 公司概况、财务分析、股东研究 |
| 财务分析 | `{F10_URL}#/cwfx` | 利润表、资产负债表、现金流量表 |
| 股东研究 | `{F10_URL}#/gdyj` | 前十大股东、机构持仓 |
| 资金流向 | `https://data.eastmoney.com/zjlx/{code}.html` | 主力资金净流入、超大单/大单/中单/小单 |
| 融资融券 | `https://data.eastmoney.com/rzrq/detail/{code}.html` | 融资余额、融券余量(仅适用于融资融券标的) |
| 沪深港通持股 | `https://data.eastmoney.com/hsgtcg/stock.html?scode={code}` | 北向/南向资金持仓变化(仅适用于沪深港通标的) |
| 公司公告 | `https://data.eastmoney.com/notices/stock/{code}.html` | 近30天公告列表 |

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% 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 · SKILL.md (reported line 129)May include surrounding context.

md
| 个股资料(F10) | `https://emweb.securities.eastmoney.com/pc_hsf10/pages/index.html?type=web&code={market}{code}` | 公司概况、财务分析、股东研究 |
| 财务分析 | `{F10_URL}#/cwfx` | 利润表、资产负债表、现金流量表 |
| 股东研究 | `{F10_URL}#/gdyj` | 前十大股东、机构持仓 |
| 资金流向 | `https://data.eastmoney.com/zjlx/{code}.html` | 主力资金净流入、超大单/大单/中单/小单 |
| 融资融券 | `https://data.eastmoney.com/rzrq/detail/{code}.html` | 融资余额、融券余量(仅适用于融资融券标的) |
| 沪深港通持股 | `https://data.eastmoney.com/hsgtcg/stock.html?scode={code}` | 北向/南向资金持仓变化(仅适用于沪深港通标的) |
| 公司公告 | `https://data.eastmoney.com/notices/stock/{code}.html` | 近30天公告列表 |

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The activation section includes broad phrases such as "个股分析报告", "股票报告", "深度分析", and even direct stock-code input alone, without clear constraints or exclusion examples. This can cause the skill to activate for ordinary finance questions or any message containing a ticker, rather than only when the user explicitly wants this specific HTML-report workflow.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The instruction to update persistent work memory with stock code, report path, and data sources exceeds the minimum capability required to generate a one-off HTML report. Unnecessary persistence increases privacy and retention risk, and could create cross-session data exposure or behavioral profiling without a clear user need.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The markdown template and instructions are entirely prescriptive in Chinese, including required field values, labels, and report-writing guidance such as investment advice text and investor profiles. Because the file does not state that the skill is China-region-specific or offer an opt-in language/locale choice, it appears to impose a specific language/locale by default.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

L262 声称 build.py 会对“所有文本字段”调用 esc() 转义 < > &,这意味着 HTML 标签不会被保留;但 L264-L272 又列出“允许的 HTML 标签(保留)”,并指定多个字段可使用 、
、 等。作为面向开发者的数据模板文档,这会直接误导使用者对实际渲染与安全边界的理解。

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/json_template.md (reported line 335)May include surrounding context.

md
# 1. 复制 JSON 模板到 ${cwd}/stock_data.json
cp stock_data_template.json "$PWD/stock_data.json"

# 2. 用 Python 脚本分块填充数据(避免 Write 工具超过 5KB 限制)
python3 "$PWD/build_json.py"            # 脚本内部用 os.getcwd() 拼接文件名

# 3. 运行 build.py 生成 HTML(两个路径都必须位于 ${cwd} 之内)

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/json_template.md (reported line 335)May include surrounding context.

md
# 1. 复制 JSON 模板到 ${cwd}/stock_data.json
cp stock_data_template.json "$PWD/stock_data.json"

# 2. 用 Python 脚本分块填充数据(避免 Write 工具超过 5KB 限制)
python3 "$PWD/build_json.py"            # 脚本内部用 os.getcwd() 拼接文件名

# 3. 运行 build.py 生成 HTML(两个路径都必须位于 ${cwd} 之内)

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

前文明确将 AI 综合点评定义为 SEC 17,但在执行流程中 Step 2.5 又写成“生成 SEC 13 的 AI 综合点评”。这会使技能实际构建流程与其自述的章节结构不一致,属于技能意图说明与实现说明之间的语义错配。

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

该处是明确的流程说明文字,直接把 AI 综合点评归入 SEC 13;而章节总表中同一内容被定义为 SEC 17。这不是简单的遗漏,而是文档内部对同一功能的编号出现正面冲突,可能误导执行者写入错误章节。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The instructions require the AI to write "像一位有观点、说人话的资深行研分析师", which fixes the response style and implicitly language/register without mentioning user preference. While stylistic guidance is acceptable, forcing a single language/locale presentation for all users can conflict with language-choice policy when the skill serves multiple markets.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The generated document sets lang="zh-CN", and the script’s user-facing output and report content are written exclusively in Chinese. For SQP-3, this is a natural-language locale constraint that forces a specific language without any opt-in or explanation that the skill is intentionally region-specific.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.