Back to skill

Security audit

Investment Daily Report

Security checks for vulnerabilities and agentic risk

Overview

This skill coherently generates local Markdown investment reports from market data, with no evidence of hidden execution, credential access, persistence, or destructive behavior.

Install only if you are comfortable with a Chinese-language investment-report skill that sends market queries through the local NeoData gateway and writes Markdown reports locally. Treat the report as externally sourced financial content, review it before acting on it, and open generated Markdown in a viewer that disables unsafe HTML, scripts, and external resource loading.

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
scripts/generate_report.cjs:81
Finding
Unsanitized Remote Content Written to Generated Markdown Reports<![CDATA[ ## Vulnerability Details **File Location**: `scripts/generate_report.cjs:81-89, 107-110, 146-190, 217` **Vulnerability Type**: Stored Markdown/HTML content injection **Risk Level**: Medium ### Vulnerable Code Remote document fields are extracted without validation or sanitization: ```js // 也提取 docData 中的文档标题和摘要 const docs = []; const docGroups = parsed?.data?.docData?.docRecall || []; for (const g of docGroups) { for (const doc of (g.docList || []).slice(0, 3)) { docs.push({ type: 'doc', title: doc.title || '', summary: (doc.summary || '').slice(0, 300) }); } } resolve([...recalls, ...docs]); ``` The formatter only removes carriage returns, reduces repeated newlines, and truncates the value: ```js function fmt(content, maxLen = 1000) { if (!content) return '暂无数据'; return content.replace(/\r/g, '').replace(/\n{3,}/g, '\n\n').trim().slice(0, maxLen); } ``` Remote fields are then inserted directly into Markdown: ```js if (results.cn_overview?.length > 0) { md += `## 📈 A股大盘\n\n`; for (const b of results.cn_overview.slice(0, 2)) { if (b.content) md += fmt(b.content) + '\n\n'; } } if (!quick && results.cn_sectors?.length > 0) { md += `## 🔥 板块轮动\n\n`; md += fmt(results.cn_sectors[0]?.content || '', 1500) + '\n\n'; } if (!quick && results.cn_flow?.length > 0) { md += `## 💰 资金流向\n\n`; md += fmt(results.cn_flow[0]?.content || '', 1200) + '\n\n'; } if (!quick && results.cn_stocks?.length > 0) { md += `## 🚨 个股异动\n\n`; md += fmt(results.cn_stocks[0]?.content || '', 1200) + '\n\n'; } if (!quick && results.events?.length > 0) { md += `## 📢 重要公告\n\n`; for (const b of results.events.slice(0, 3)) { if (b.title || b.summary) md += `- **${b.title || ''}** ${b.summary || ''}\n`; else if (b.content) md += fmt(b.content, 300) + '\n'; } md += '\n'; } if (results.hk_overview?.length > 0) { md += `## 🇭🇰 港股大盘\n\n`; md += fmt(results.hk_overview[0]?.content || '', 1000) + '\n\n'; } if (results.us_overview?.len ...[truncated 2959 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Treat every gateway response field as untrusted data and validate the complete response against an explicit schema before use. 2. Escape Markdown metacharacters in plain-text fields such as titles and summaries. 3. Remove or encode raw HTML unless HTML output is an explicit and securely handled requirement. 4. Parse links and images, permit only approved schemes such as `https`, and reject dangerous or unexpected schemes. 5. Consider disabling external images and links entirely in generated reports, or render them as inert text. 6. Use a Markdown sanitizer designed for the capabilities of the eventual renderer rather than relying on truncation or regular-expression cleanup. 7. Authenticate the local gateway or verify responses using a trusted application-level mechanism where the gateway supports one. 8. Add security tests containing malicious Markdown, raw HTML, external images, malformed links, and dangerous URI schemes. 9. Document that generated reports contain externally sourced data and should be opened only in Markdown viewers that disable unsafe HTML and active content. ]]>
Vulnerability Patterns
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • 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 (9)

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
SQP-3 applies to natural-language policy issues in all file types, including markdown. The title, introduction, and usage descriptions are presented only in Chinese, which can amount to a language policy violation when no user opt-in, alternative language option, or explicit region-specific justification is provided.

Lp3

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding
Without declared permissions the skill's intent is opaque and cannot be validated.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
The manifest description is written entirely in Chinese and states that the skill generates a structured Markdown daily report, while the rest of the file consistently presents the report format in Chinese. There is no indication that users may choose another language, which constitutes a language/locale policy issue under the natural-language policy rule.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
This markdown file is entirely presented in Chinese, beginning with a Chinese title, with no indication that language selection is optional or user-configurable. The policy for natural-language violations applies to all file types and flags content that forces a specific language without user opt-in.

Context Window Stuffing

Medium
Category
Memory Poisoning
Content
## 🚨 个股异动

| 排行类型 | 排序类型 | 股票代码 | 股票名称 | 最新价 | 涨跌幅 | 5日涨跌幅 | 21日涨跌幅 | 60日涨跌幅 | 年初至今涨跌幅 | 涨跌金额 | 换手率 | 量比 | 振幅 | 成交量 | 成交额 | 市盈率 | 市净率 | 总市值 | 流通市值 | 涨速 | 主力净流入 |
| :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: | :---: |
| 涨幅(沪深京) | 降序 | sz300540 | 蜀道装备 | 26.64 | 20.00 | -- | -- | -- | -- | -- | 11.91 | 7.06 | 19.73 | -- | -- | -- | -- | 61.15 | 55.07 | -- | -- |
| 涨幅(沪深京) | 降序 | sh688811 | 有研复材 | 23.82 | 20.00 | -- | -- | -- | -- | -- | 51.89 | 2.10 | 20.76 | -- | -- | -- | -- | 119.50 | 21.94 | -- | -- |
| 涨幅(沪深京) | 降序 | sz300518 | 新迅达 | 24.69 | 15.54 | -- | -- | -- | -- | -- | 11.40 | 6.26 | 19.14 | -- | -- | -- | -- | 49.23 | 49.23 | -- | -- |
Confidence
80% confidence
Finding
Skill attempts to fill the context window with filler content, displacing legitimate instructions and safety constraints. This can degrade agent performance or bypass safety boundaries.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The generated report timestamp is explicitly formatted with `toLocaleString('zh-CN', { timeZone: 'Asia/Shanghai' })`, and the script’s user-facing strings are all Chinese. This imposes a specific language/locale on output without any opt-in or configurable alternative, which matches the language/locale policy violation criteria.

Natural-Language Policy Violations

Low
Confidence
88% confidence
Finding
The changelog specifies hard-coded Chinese query phrases for skill behavior, which indicates a language constraint in natural-language operation. Because there is no indication here that users can choose another language or that the locale restriction is explicitly justified, this appears to violate the language/locale policy requirement.

Missing User Warnings

Low
Confidence
89% confidence
Finding
This is a markdown file, so SQP-2 applies to omissions in user-facing warnings. Line L28 states that the skill generates a file with a default name, but the description does not explicitly warn that execution modifies the local filesystem by creating an output file.

Natural-Language Policy Violations

Low
Confidence
81% confidence
Finding
This markdown file contains user-facing natural language entirely in Chinese, including the title, generation note, data source note, disclaimer, and error message. Under the stated policy, forcing a specific language without user opt-in can be a locale-policy violation, and the file does not indicate any language choice or region-specific justification.

Static analysis

Detected: suspicious.env_credential_access

Environment variable access combined with network send.

Critical
Code
suspicious.env_credential_access
Location
scripts/generate_report.cjs:14