Back to skill

Security audit

缠论买点扫描闭环

Security checks for vulnerabilities and agentic risk

Overview

The skill is a disclosed A-share trading-watchlist and report workflow, with data-freshness and HTML-report safety caveats but no evidence of hidden execution or exfiltration.

Install only if you are comfortable letting the agent modify your external stock watchlist groups and generate financial decision-support reports. Before relying on a report, confirm TODAY/NEXT_TRADE and all K-line data are current, review any watchlist changes, and treat the generated trigger prices as non-advisory technical analysis. The publisher should add HTML escaping for report fields and ideally declare narrower tool/write permissions.

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/缠论扫描_条件单闭环.py:390
Finding

Stored HTML and Script Injection in Generated Trading Report

Content
View full analysis
{r['code']} {r['name']} ``` Other dynamic values are also rendered without HTML escaping: ```python rows.append( f"{it['tag']}" f"{coef}" f"{trig}" f"{pct}" f"{it['qty']}" f"{it['reach']}" f"{it['memo']}" ) ``` ```python
形态推导{r['detail']}
``` ```python
{r['tmw_act']}
``` The overview table repeats the unescaped stock information: ```python _tmw_rows.append( f"{_fcell}{_r['code']}{_r['name']}" f"{_r['board']}{_r['close']:.2f}" f"{_r['today_act']}" f"{_r['tmw_act']}" ) ``` The resulting document is written as an executable HTML file: ```python with open(out, "w", encoding="utf-8") as f: f.write(html) ``` ### Technical Analysis The report generator builds HTML through direct string interpolation without applying context-appropriate HTML encoding. The documented workflow populates `POOL` using external market-data connectors and manual updates. Consequently, fields such as stock names and codes cross a trust boundary before being embedded in the report. If an attacker controls or compromises a connector response, influences manually supplied pool data, or otherwise places markup in an interpolated field, browser-int ...[truncated 1978 chars]
Remediation
View remediation
{safe_code}" f"{safe_name}" ) ``` 2. Validate structured fields before rendering. For example, restrict stock codes to the expected syntax: ```python import re STOCK_CODE_RE = re.compile(r"^(?:sh|sz)\d{6}$") if not STOCK_CODE_RE.fullmatch(code): raise ValueError(f"Invalid stock code: {code!r}") ``` Use allowlists for board, category, form, and group values. 3. Keep trusted formatting separate from untrusted text. Some internally generated fields intentionally contain HTML formatting such as ``. Do not indiscriminately trust connector-provided strings merely because internal strategy text uses markup. Prefer structured templates where formatting is added by the application and all data values are escaped. 4. Add a restrictive Content Security Policy to reduce the impact of any missed encoding sink: ```html ``` The current report uses inline button handlers. Replace them with non-script controls or move the required behavior to an approved local script with a nonce or hash before enforcing `script-src 'none'`. 5. Add regression tests using adversarial values such as: ```python name = '' ``` Verify that the generated report contains escaped text such as `<img` and no executable element. 6. Treat all connector output as untrusted, ev ...[truncated 179 chars]
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (6)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill instructs the agent to update variables, run a Python script, and generate an HTML report, which implies file-writing behavior, but it does not declare any explicit tool scope or allowed-tools restrictions. In an agent environment, missing tool scoping can let the model use broader-than-intended file capabilities, increasing the chance of unintended file modification or writes outside the expected script/report workflow.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The script claims to perform a live scan and fetch same-day K-line data, but in reality it only processes a hardcoded stock pool and static prices. In a trading-automation context, this is dangerous because users may rely on the generated report and trigger orders under the false assumption that the output reflects current market data, leading to materially wrong trading decisions.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The report text instructs users that the script will support next-day 09:35 shape judgment and execution logic, but the code contains only static descriptive text and no scheduling, live market observation, or execution capability. In a financial workflow, this mismatch can mislead operators into believing an automated control exists when it does not, creating a dangerous automation gap during time-sensitive trading decisions.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill advertises rolling reuse of watchlist groups, but the script merely computes group counts for HTML output and does not persist, update, or synchronize any actual group state. In this context, the issue is dangerous because users may assume continuity between runs and make follow-on trading decisions based on nonexistent watchlist management.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The instruction '涨红跌绿(A 股惯例),货币符号 ¥' imposes a locale-specific presentation convention in the skill guidance. The policy requires flagging language or locale constraints when they are forced rather than offered as a user choice or clearly justified as a regional compliance requirement.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

The execution-discipline section says 'break below 5-day MA to take profit, break below 10-day MA to stop loss,' but the actual code uses a different logic: take profit at MA5 +10% and stop loss only after MA10 minus an extra 3% buffer. In a trading script, inconsistent risk-control wording can cause users to execute materially different exits than the generated conditions, undermining risk management.

Content

No source excerpt is available for this finding.