Back to skill

Security audit

股票持仓分析大师

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent portfolio web app, but it exposes private holdings and LLM credentials through unauthenticated LAN APIs and under-discloses external LLM data flows.

Review before installing or running on any network. Use only on localhost unless you add authentication, do not enter valuable LLM API keys until secret storage and config APIs are fixed, restrict LLM providers to trusted endpoints, and back up portfolio.db before using delete or edit functions.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (6)

T05 · Unauthorized Access and Privilege Escalation

Error
Location
portfolio_system.py:43
Finding

Unauthenticated LAN-accessible APIs expose financial data, credentials, and administrative operations

Content
View full analysis
', methods=['DELETE']) def delete_holding(symbol): result = manager.delete_holding(symbol) return jsonify(result) @app.route('/api/llm/config', methods=['GET']) def get_llm_config_api(): result = manager.get_llm_config() return jsonify(result) @app.route('/api/llm/config', methods=['POST']) def update_llm_config_api(): data = request.get_json() config_id = data.get('id', 1) model_type = data.get('model_type', 'openai') model_name = data.get('model_name', 'gpt-3.5-turbo') api_url = data.get('api_url', 'https://api.openai.com/v1/chat/completions') api_key = data.get('api_key', '') api_id = data.get('api_id', '') enabled = data.get('enabled', True) result = manager.update_llm_config( config_id, model_type, model_name, api_url, api_key, api_id, enabled ) return jsonify(result) ``` ```python def start_server(host='0.0.0.0', port=5000, debug=False, auto_update=True): ... app.run(host=host, port=port, debug=debug, threaded=True) def main(): ... start_server(host='0.0.0.0', port=5000, debug=False, auto_update=True) ``` ### Technical Analysis The application binds to all network interfaces and exposes every portfolio and LLM-management endpoint without authentication or authorization. `CORS(app)` also enables broadly permissive cro ...[truncated 1583 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
llm_manager.py:43
Finding

LLM API keys are stored in plaintext and returned verbatim through an unauthenticated endpoint

Content
View full analysis
response.json()) .then(data => { if (data.status === 'success' && data.data.length > 0) { const config = data.data[0]; document.getElementById('apiKey').value = config.api_key; } }); ``` ### Technical Analysis The API key is persisted directly in SQLite without encryption and is returned in full through the configuration API. The browser then inserts the complete secret into a form field. Using an input of type `password` only changes visual presentation; it does not protect the value from network clients, browser scripts, extensions, or developer tools. Because the endpoint has no authenticat ...[truncated 1036 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
portfolio_system.py:306
Finding

User-configurable LLM URL enables server-side request forgery and credential or portfolio-data exfiltration

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
llm_manager.py:325
Finding

MiniMax request logging persists bearer credentials and private financial prompts

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
templates/index.html:650
Finding

Unsafe HTML rendering permits stored and LLM-assisted cross-site scripting

Content
View full analysis
{ const pnlClass = holding.pnl >= 0 ? 'profit' : 'loss'; const statusClass = holding.pnl >= 0 ? 'status-profit' : 'status-loss'; const statusText = holding.pnl >= 0 ? 'profit' : 'loss'; html += ` ${statusText} ${holding.name} ${holding.symbol} Edit `; }); tbody.innerHTML = html; ``` ```javascript let html = ''; logs.slice(0, 10).forEach(log => { html += `
${log.symbol}
${log.details}
`; }); container.innerHTML = html; ``` ```javascript if (data.status === 'success') { resultDiv.innerHTML = `
${data.content}
`; } ``` ```python accumulated_content += content html_content = markdown.markdown(accumulated_content) sock.send(json.dumps({ 'status': 'success', 'content': html_content, 'original': accumulated_content, 'chunk': content })) ``` ### Technical Analysis Holding names, symbols, and operation-log details are inserted into HTML templates without escaping and assigned through `innerHTML`. The same values are also embedded inside inline JavaScript event-handler attributes. A crafted name containing ...[truncated 1685 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
templates/index.html:8
Finding

Third-party browser scripts are executed without Subresource Integrity protection

Content
View full analysis
``` ```html ``` ### Technical Analysis The application loads executable JavaScript and stylesheets from a third-party CDN at runtime without `integrity` metadata. Although package versions are specified, the browser does not verify that the downloaded files match an audited cryptographic digest. A CDN compromise, account compromise, malicious package replacement, or unexpected upstream artifact change could cause attacker-controlled JavaScript to execute in the application's origin. This origin has access to sensitive portfolio and LLM configuration APIs. ### Attack Path 1. A CDN-served artifact or its upstream package is compromised. 2. A user opens the portfolio dashboard. 3. The browser downloads and executes the modified JavaScript because no integrity check is present. 4. The malicious dependency calls local APIs in the page's origin. 5. Portfolio information and API credentials are extracted, or administrative operations are performed. ### Impact Assessment A successful supply-chain compromise can execute arbitrary browser code for every user loading the affected asset. The resulting access includes portfolio data, operation history, LLM credentials, and all state-changing APIs available to the application origin. ]]>
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (57)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · README.md (reported line 116)May include surrounding context.

删除持仓

text
DELETE /api/portfolio/delete/<symbol>

获取操作记录

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

声明描述的是一个完整的股票持仓分析/管理系统,但给出的代码块主要职责是LLM配置与调用,不是投资组合管理核心模块。代码创建并读写llm_config表,保存api_key、api_url等敏感配置;选择启用的模型并向外部API发送请求;将返回的Markdown转HTML;在analyze_stock中只是从holding_manager读取股票与持仓数据后拼接提示词交给大模型分析。也就是说,实际代码的主要用途是“AI分析后端/模型接入层”,而不是声明中的“持仓管理、实时更新价格、盈亏分析、报告生成系统”本身。且声明未体现其明显的外部网络调用、LLM配置存储与第三方数据传输能力,因此存在实质性描述不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

Most of the declared stock portfolio functionality is present: holdings management, price updates, profit/loss-related data access, logs, and report generation/export. However, the code also includes a substantial additional capability not reflected in the description: large-model (LLM) integration. It exposes endpoints to get/update LLM config, accepts API URL/key/ID/model settings, calls the model for stock analysis, and streams analysis results over WebSocket. These are material undeclared capabilities beyond ordinary support code for portfolio management, so this should be flagged as a mismatch.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The code allows stored configuration of arbitrary api_url values and then posts prompts to the selected URL, effectively creating an SSRF/data-exfiltration primitive under the guise of model configuration. Because prompts can contain portfolio holdings and market analysis inputs, a malicious or compromised configuration can silently route sensitive financial data to attacker-controlled infrastructure.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The MiniMax branch logs request headers and request data verbatim, which includes the Authorization bearer token and full prompt contents. This exposes API credentials and potentially sensitive portfolio data to log files and stdout, creating a straightforward credential leakage and data disclosure risk.

Content

No source excerpt is available for this finding.

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · templates/index.html (reported line 128)May include surrounding context.

html
</head>

<body>
    <!-- 导航栏 -->
    <nav class="navbar navbar-expand-lg navbar-dark shadow-sm sticky-top">
        <div class="container-fluid">
            <a class="navbar-brand fw-bold" href="/">

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The UI fetches stored LLM configuration and writes the API key back into a browser password field. Any user who can load this page can retrieve the secret through the DOM or dev tools, turning a server-side credential into a client-exposed secret and enabling unauthorized reuse of the provider account.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README indicates the service supports LAN access and shows binding to 0.0.0.0, but it does not prominently warn that the app is network-exposed by default or discuss authentication and access-control implications. For a portfolio management app with add/edit/delete/report endpoints, this omission can lead operators to deploy it on trusted-looking home or office networks without understanding that any reachable host may access or modify data.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill declares executable capabilities that imply network access and persistent data modification, but it does not declare any tool scope or permission boundaries. That creates a least-privilege failure: users and the hosting platform are not clearly informed that the skill can write data and perform network operations, increasing the chance of unintended or overly broad execution.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

L003 将触发条件描述为“当用户需要管理股票持仓、查看实时价格、分析盈亏情况、生成投资报告时”,这是宽泛的自然语言场景描述,而不是明确、可区分的触发短语或约束条件。缺少排除条件或具体调用范围,可能导致在一般投资讨论中被意外触发。

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The documentation describes real-time and automatic price updates but does not clearly warn users that the skill will perform network requests to fetch data. Hidden network activity matters in a finance-related skill because portfolio holdings and usage patterns may be exposed to external services or trigger unexpected background connections.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill supports add, edit, and delete operations on portfolio data, but the usage guidance does not strongly warn that it can modify or remove persisted holdings. In a financial context, undisclosed destructive actions can lead to accidental data loss or unauthorized changes if the skill is invoked unexpectedly.

Content

No source excerpt is available for this finding.

Internal Network Request

Medium
Category
Server-Side Request Forgery
Confidence
70% confidence
Finding

Code issues a request to a loopback, link-local, or private-range host. This can reach internal services not meant to be exposed and is a common SSRF pivot.

Content

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

md
import requests

# 获取持仓数据
response = requests.get('http://localhost:5000/api/portfolio')
data = response.json()

# 更新价格

Internal Network Request

Medium
Category
Server-Side Request Forgery
Confidence
70% confidence
Finding

Code issues a request to a loopback, link-local, or private-range host. This can reach internal services not meant to be exposed and is a common SSRF pivot.

Content

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

md
import requests

# 获取持仓数据
response = requests.get('http://localhost:5000/api/portfolio')
data = response.json()

# 更新价格

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% 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 56)May include surrounding context.

md
data = response.json()

# 更新价格
response = requests.post('http://localhost:5000/api/portfolio/update')

# 添加持仓
response = requests.post('http://localhost:5000/api/portfolio/add', json={

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% 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 59)May include surrounding context.

md
data = response.json()

# 更新价格
response = requests.post('http://localhost:5000/api/portfolio/update')

# 添加持仓
response = requests.post('http://localhost:5000/api/portfolio/add', json={

Internal Network Request

Medium
Category
Server-Side Request Forgery
Confidence
70% confidence
Finding

Code issues a request to a loopback, link-local, or private-range host. This can reach internal services not meant to be exposed and is a common SSRF pivot.

Content

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

md
data = response.json()

# 更新价格
response = requests.post('http://localhost:5000/api/portfolio/update')

# 添加持仓
response = requests.post('http://localhost:5000/api/portfolio/add', json={

Internal Network Request

Medium
Category
Server-Side Request Forgery
Confidence
70% confidence
Finding

Code issues a request to a loopback, link-local, or private-range host. This can reach internal services not meant to be exposed and is a common SSRF pivot.

Content

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

md
data = response.json()

# 更新价格
response = requests.post('http://localhost:5000/api/portfolio/update')

# 添加持仓
response = requests.post('http://localhost:5000/api/portfolio/add', json={

External Transmission

Medium
Category
Data Exfiltration
Confidence
70% 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 59)May include surrounding context.

md
response = requests.post('http://localhost:5000/api/portfolio/update')

# 添加持仓
response = requests.post('http://localhost:5000/api/portfolio/add', json={
    'symbol': '600519',
    'name': '贵州茅台',
    'quantity': 100,

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The skill uses browser-like spoofed headers to access third-party market data endpoints, which can conceal the true client identity and bypass normal API usage expectations. In a portfolio tool this is not directly code-execution dangerous, but it increases compliance, transparency, and provider-blocking risk and may violate third-party service terms.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill automatically transmits portfolio symbols to external quote providers without any consent or warning. Even if only ticker symbols are sent, the outbound requests reveal user interests and trading exposure patterns to third parties, which is a privacy leak amplified by repeated automatic updates.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The delete_holding function permanently removes a holding record from the database and only logs the action after deletion. There is no confirmation prompt, safeguard, or warning in the function indicating that the operation is destructive and irreversible.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This file implements a generic multi-provider LLM configuration and invocation subsystem, including persistent provider settings and arbitrary endpoint selection, which materially expands the skill beyond narrow portfolio analysis. In a portfolio-analysis context, this increases attack surface by enabling outbound data transfer and model/provider switching without tight purpose limitation or trust boundaries.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% 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 · llm_manager.py (reported line 69)May include surrounding context.

python
cursor.execute('''
            INSERT INTO llm_config (model_type, model_name, api_url, api_key, api_id, enabled)
            VALUES (?, ?, ?, ?, ?, ?)
            ''', ('openai', 'gpt-3.5-turbo', 'https://api.openai.com/v1/chat/completions', '', '', 1))
            
            # 插入MiniMax默认配置
            cursor.execute('''

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% 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 · portfolio_system.py (reported line 313)May include surrounding context.

python
cursor.execute('''
            INSERT INTO llm_config (model_type, model_name, api_url, api_key, api_id, enabled)
            VALUES (?, ?, ?, ?, ?, ?)
            ''', ('openai', 'gpt-3.5-turbo', 'https://api.openai.com/v1/chat/completions', '', '', 1))
            
            # 插入MiniMax默认配置
            cursor.execute('''