Back to skill

Security audit

A Stock Trading Assistant Custom

Security checks for vulnerabilities and agentic risk

Overview

The skill is an A-share stock assistant, but it deserves review because it can give actionable trading guidance from unauthenticated market-data requests and persist user price alerts.

Install only if you are comfortable with a skill that queries third-party Chinese financial sites, may store alert/watchlist details, and can produce concrete trading suggestions. Treat outputs as informational, verify prices through trusted sources, and do not rely on its position sizing or buy/sell guidance as personalized 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
scripts/fetch_stock.py:112
Finding
Unauthenticated HTTP Transport Allows Financial Market Data Manipulation<![CDATA[ ## Vulnerability Details **File Locations**: - `scripts/fetch_stock.py:112` - `scripts/fetch_stock.py:121-126` - `scripts/fetch_stock.py:166` - `scripts/fetch_stock.py:194-200` - Related endpoint documentation: `references/data-sources.md:9-14`, `references/data-sources.md:28-29`, `references/data-sources.md:54-62` **Vulnerability Type**: Unauthenticated plaintext transport for security-sensitive financial data **Risk Level**: Medium ### Vulnerable Code Single-stock quote retrieval from Sina Finance: ```python symbol = f"{prefix}{clean_code}" url = f"http://hq.sinajs.cn/list={symbol}" raw = fetch_url(url) ``` Fallback single-stock quote retrieval from Eastmoney: ```python market = 1 if prefix == "sh" else 0 url2 = ( f"http://push2.eastmoney.com/api/qt/stock/get" f"?secid={market}.{clean_code}" f"&fields=f43,f44,f45,f46,f47,f48,f57,f58,f60,f107,f169,f170,f171" ) raw2 = fetch_url(url2, {"Referer": "https://www.eastmoney.com"}) ``` Market-index retrieval: ```python symbols = "s_sh000001,s_sz399001,s_sz399006,s_sh000688" names_map = { "s_sh000001": "上证指数", "s_sz399001": "深证成指", "s_sz399006": "创业板指", "s_sh000688": "科创50", } url = f"http://hq.sinajs.cn/list={symbols}" raw = fetch_url(url) ``` Hot-sector retrieval: ```python url = ( "http://push2.eastmoney.com/api/qt/clist/get" "?pn=1&pz=20&po=1&np=1&ut=bd1d9ddb04089700cf9c27f6f7426281" "&fltt=2&invt=2&fid=f3" "&fs=m:90+t:2+f:!50" "&fields=f2,f3,f4,f12,f14,f20,f128,f136,f207,f208,f209" ) raw = fetch_url(url, {"Referer": "https://www.eastmoney.com"}) ``` ### Technical Analysis The implemented financial-data requests use plaintext HTTP rather than authenticated TLS. HTTP provides no server authentication or transport integrity. An attacker capable of observing or modifying the network path can therefore intercept a request and substitute a fabricated response. The parsers trust returned numeric and textual fields after only basic syntax and type conve ...[truncated 2295 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. **Use authenticated TLS for every endpoint** - Replace each `http://` endpoint with a provider-supported `https://` endpoint. - Do not silently fall back to plaintext HTTP if an HTTPS request fails. 2. **Prevent protocol downgrades** - Reject redirects whose destination scheme is not HTTPS. - Consider using a custom redirect handler that explicitly enforces an HTTPS-only policy. 3. **Retain strict certificate validation** - Use Python's default trusted certificate verification. - Do not introduce unverified SSL contexts or disable hostname checking. - Fail closed when certificate validation fails. 4. **Validate response identity and schema** - Verify that the returned symbol exactly matches the requested symbol. - Enforce required fields, expected data types, plausible numeric ranges, and valid timestamps. - Reject incomplete, stale, malformed, or internally inconsistent responses. 5. **Corroborate data used for trading guidance** - For recommendations with financial impact, compare quotes through at least two independent HTTPS sources. - Refuse to issue actionable guidance when sources differ beyond a defined tolerance. - Clearly identify when only one source is available. 6. **Update the endpoint documentation** - Replace the plaintext examples in `references/data-sources.md` with verified HTTPS endpoints. - Explicitly prohibit plaintext fallback in the Skill's operational instructions. 7. **Add automated security tests** - Test that all configured endpoint URLs use HTTPS. - Test that HTTP redirects and invalid certificates are rejected. - Test that mismatched symbols, stale timestamps, impossible prices, and malformed responses fail closed. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (8)

Vague Triggers

Medium
Confidence
94% confidence
Finding
The trigger conditions are very broad, covering generic investing and trading-related queries without strong narrowing criteria or explicit user confirmation. This can cause the skill to activate in ordinary financial conversations and steer the interaction toward real-time trading advice, increasing the chance of unintended actions or inappropriate reliance on the skill.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The skill hard-locks the interaction to the mainland China A-share market and automatically ignores other markets without obtaining user consent. In practice, this can mis-handle ambiguous stock queries, omit relevant context, and provide advice on the wrong asset universe if the user did not explicitly ask for that restriction.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The document gives explicit trading actions such as buy/sell signals and follow-on guidance without any risk disclosure, suitability caveat, or statement that the material is informational only. In a skill context, users may treat this as investment advice and act on it directly, increasing the chance of financial loss or inappropriate reliance.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The file assigns concrete position-sizing ranges by market risk tier, effectively telling users how much capital to deploy. This is more dangerous than generic market commentary because exposure guidance can directly amplify losses for unsuitable users, especially without warnings about volatility, suitability, or the need for professional advice.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
The title and all instructional content are written entirely in Chinese, which effectively enforces a specific language for using this reference. The policy allows locale constraints only when they are clearly documented and justified or when users are offered a language choice; neither is present here.

Natural-Language Policy Violations

Medium
Confidence
98% confidence
Finding
The Accept-Language header is fixed to "zh-CN,zh;q=0.9", which enforces a specific language/locale preference in all requests. This is a natural-language policy concern because the script does not provide an opt-in, override, or justification for forcing that locale.

Natural-Language Policy Violations

Low
Confidence
78% confidence
Finding
Natural-language policy review applies to all file types, and this document presents all instructions and labels exclusively in Chinese. Because there is no opt-in, alternative language option, or justification that the skill is intentionally region-specific, it may violate language/locale choice expectations.

Missing User Warnings

Low
Confidence
95% confidence
Finding
This code fetches stock data from Sina Finance and Eastmoney over the network, but the script provides no explicit user-facing notice that it contacts external third-party services. Although networking is core to the script's purpose, there is no disclosure in the CLI help or runtime output before transmitting requested stock symbols and request metadata such as headers.

Static analysis

No suspicious patterns detected.