Back to skill

Security audit

LongPort Quant Trader (房总版)

Security checks for vulnerabilities and agentic risk

Overview

This is a real automated trading skill, but it needs Review because it can place broker orders automatically and ships exposed credentials plus a fixed Feishu notification recipient.

Review carefully before installing. Rotate any exposed Longport or Feishu credentials, remove hardcoded secrets and recipients, configure your own notification target, pin dependencies, and run only in a dedicated virtual environment with a paper account or dry-run controls until you have verified every order path.

Vulnerability Patterns
  • 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
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
config.json:11
Finding

Longport API credentials are committed in plaintext configuration

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
qqq_monitor_push.py:24
Finding

Feishu application credentials are hardcoded in an executable monitor

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
qqq_monitor_push.py:26
Finding

Monitoring notifications are routed to a hardcoded third-party Feishu recipient

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:32
Finding

Installation instructions use unpinned third-party dependencies

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (219)

Tainted flow: 'payload' from os.getenv (line 21, credential/environment) → httpx.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · get_openid_and_send.py (reported line 22)May include surrounding context.

python
"""获取应用身份访问令牌"""
    url = f"{BASE_URL}/auth/v3/tenant_access_token/internal"
    payload = {"app_id": APP_ID, "app_secret": APP_SECRET}
    response = httpx.post(url, json=payload, timeout=10)
    result = response.json()
    if result.get("code") == 0:
        return result.get("tenant_access_token")

Tainted flow: 'payload' from os.getenv (line 21, credential/environment) → httpx.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · get_openid_and_send.py (reported line 48)May include surrounding context.

python
"msg_type": "interactive",
        "content": content
    }
    response = httpx.post(url, headers=headers, json=payload, timeout=10)
    result = response.json()
    return result

Tainted flow: 'payload' from os.getenv (line 93, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · lianghui_monitor.py (reported line 97)May include surrounding context.

python
"app_id": FEISHU_APP_ID,
        "app_secret": FEISHU_APP_SECRET
    }
    response = requests.post(url, json=payload)
    data = response.json()
    if data.get("code") == 0:
        return data.get("tenant_access_token")

Tainted flow: 'payload' from os.getenv (line 122, credential/environment) → requests.post (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · lianghui_monitor.py (reported line 128)May include surrounding context.

python
"content": json.dumps(message_content)  # content 字段需要是 JSON 字符串
        }
        
        response = requests.post(url, headers=headers, json=payload)
        result = response.json()
        
        if result.get("code") == 0:

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SETUP_GUIDE.md (reported line 20)May include surrounding context.

md
5. 创建后获得三个密钥:
   - `App Key`
   - `App Secret`
   - `Access Token`

### 1.3 配置环境变量

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · qqq_monitor_push.py (reported line 45)May include surrounding context.

python
5. 创建后获得三个密钥:
   - `App Key`
   - `App Secret`
   - `Access Token`

### 1.3 配置环境变量

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SETUP_GUIDE.md (reported line 45)May include surrounding context.

source ~/.zshrc

text

**方法 3: 使用 .env 文件**
在项目目录创建 `.env` 文件:

LONGPORT_APP_KEY=your_app_key_here

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · SETUP_GUIDE.md (reported line 86)May include surrounding context.

source ~/.zshrc

text

**方法 3: 使用 .env 文件**
在项目目录创建 `.env` 文件:

LONGPORT_APP_KEY=your_app_key_here

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

声明描述的是一个较完整的长桥量化交易集成能力,覆盖多市场(港股/美股)、多策略(超跌+动量)、通知、绩效、定时监控和风控管理。实际代码则明显更窄:它只针对固定 A 股股票池获取行情,按涨幅>1%选择最多3只股票,以100股下单买入,并在本次运行中打印理论止损/止盈价。代码没有实现飞书推送、绩效跟踪、定时任务、持仓监控、自动止盈止损卖出,也不支持港股/美股。虽然都属于量化交易场景,但主要能力与覆盖范围存在实质性不一致,因此应判定为描述与行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

总体上,代码与“自动量化交易、每5分钟监控、止盈止损管理”的主旨基本一致,但声明中的若干关键功能并未在代码中实现。最明显的是没有飞书推送和绩效跟踪逻辑;此外,代码只交易港股预设股票池,没有任何美股标的或市场分支处理。策略层面虽有动量与均值回归/突破,但“超跌”表述不够准确。由于这些缺失功能属于描述中的重要组成部分,而非单纯实现细节,因此应判定为描述与行为存在实质性不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

描述与代码部分匹配:代码确实使用长桥证券接口进行自动化量化交易、每5分钟扫描,并包含止盈止损管理。但存在多处实质不一致。首先,描述提到“飞书推送”和“绩效跟踪”,代码中完全没有任何消息推送、Webhook、日志汇总或收益统计实现。其次,描述宣称支持“港股/美股自动交易”,而代码的股票池全部为 .HK 标的,启动信息和逻辑也明确限定为港股。再次,策略描述为“超跌/动量”,但代码实际实现并配置了动量、突破、网格、均值回归四类策略,其中网格策略甚至未见完整买入信号实现。总体来看,代码主功能是港股自动交易扫描器,但声明中包含若干未实现的重要能力,并夸大了市场覆盖范围,因此应判定为描述与实际行为不完全一致。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

整体上,代码的大方向与声明较为接近:确实是长桥证券自动化量化交易,支持港股/美股,具备5分钟持续监控模式、止盈止损和绩效跟踪。因此主用途基本一致。但仍存在重要描述不准确之处。最明显的是声明强调“飞书推送”,而代码完全没有任何飞书相关逻辑,这是一个明确缺失的已声明能力。其次,代码实际会读取账户信息、查询持仓与行情并直接提交买卖订单,这属于敏感且核心的交易执行能力;虽然“自动交易”字面上能部分涵盖,但声明没有明确反映实际代码会直接操作账户和下单。综合来看,描述与实现大体同类,但存在实质性能力不一致,尤其是飞书推送缺失,因此应判定为不完全匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

该代码块的核心用途与声明明显不一致。声明描述的是一个面向实盘的量化交易集成系统,包含券商接入、自动交易、定时监控、风险管理和消息通知;而实际代码只是一个单文件回测引擎,使用随机数据和随机信号进行模拟交易并打印结果。虽然代码中出现了止损止盈参数、股票代码和绩效输出,但这些仅停留在配置或粗略统计层面,没有实现声明中的关键能力。因此应判定为描述与行为存在实质性不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The description presents a live automated trading integration centered on Longbridge Securities, with real-time monitoring every 5 minutes, automated HK/US trading, Feishu alerts, and risk controls like take-profit/stop-loss. The provided code does none of those things. It is a historical backtesting tool: it downloads past price data from yfinance, computes indicators, generates hypothetical buy/sell signals, simulates fixed-size trades, compares strategy returns, and optionally performs grid-search parameter optimization. There is no broker connectivity, no live execution, no notification sending, no scheduler/trigger loop, and no stop-loss/take-profit management. This is a material description-versus-behavior mismatch, with the actual code serving a different primary purpose.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

该代码的核心功能是行情订阅与监控:订阅港股/美股报价,基于前后报价变化检测大单、成交量放大和简单资金流,并输出监控摘要。它没有任何下单、订单管理、仓位、风控执行、止盈止损、策略信号触发交易、消息推送到飞书、或收益绩效记录的实现。因此,声明中的主要能力大多未被代码体现。虽然都与证券市场相关,但实际行为更像“市场异动监控工具”,而不是“自动量化交易集成”。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

该描述与代码存在明显不匹配。声明的核心卖点是“超跌/动量策略 + 飞书推送 + 绩效跟踪 + 自动交易 + 止盈止损”,但代码核心逻辑是“新闻情绪模拟 + 大单跟随模拟”的事件驱动验证脚本。代码没有实现超跌、动量、止盈止损、飞书通知,也没有真正下单;execute_trade 明确写的是虚拟盘测试,仅生成虚拟订单ID并打印记录。所谓绩效跟踪也只是按策略统计买卖次数和打印交易明细,并无收益、回撤、胜率、资金曲线等实质绩效分析。此外,声明称每5分钟监控,但代码是在5分钟总时长内每30秒循环扫描一次。整体上,代码的主要用途与声明的主要用途不同,且缺失多个关键声明能力,因此应判定为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

该描述与代码存在明显不一致。代码核心功能是“事件驱动策略 v2.0 验证”,通过随机生成新闻情绪和大单信号,结合实时行情做虚拟交易记录,并进行简单持仓更新与止盈止损检查。声明中提到的关键能力——超跌/动量策略、飞书推送、自动实盘交易、港股/美股支持、每5分钟监控、绩效跟踪——大部分未在代码中体现或仅部分满足。尤其是 execute_trade 明确标注为“虚拟盘测试”,没有实际调用下单接口;也未见任何飞书通知逻辑;策略类型与声明差异较大。因此应判定为描述与实际行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

声明描述的是一个面向长桥证券的自动化量化交易集成,核心卖点包括超跌/动量策略、飞书推送、港股/美股自动交易、每5分钟监控和止盈止损管理。实际代码虽然与量化交易主题相关,也确实包含止盈止损和绩效跟踪,但其主要策略逻辑与描述明显不同:它基于随机模拟的新闻情绪和大单检测,并加上趋势过滤,不是超跌/动量策略。代码只调用 LongPort QuoteContext 获取行情,没有任何下单/交易账户操作接口,因此更像策略模拟器或监控验证脚本,而不是自动交易集成。也没有任何飞书推送实现。此外,观察列表只有美股代码,缺乏港股支持的体现;轮询节奏是每轮 sleep(30) 秒,和“每5分钟监控”不一致。因此描述与代码行为存在实质性不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

声明描述的是一个面向实际自动化交易的集成技能,核心能力应包括券商接入、定时监控、下单、风控和通知。代码却只是本地运行的策略回测示例,且交易信号、市场状态、价格和盈亏均由随机数模拟。虽然配置中出现了stop_loss、take_profit、max_drawdown等字段,但代码没有使用这些参数执行风险管理。也没有任何网络/API调用、长桥证券接口、飞书通知、真实市场数据处理或5分钟轮询逻辑。因此其主要用途与声明明显不符,属于实质性描述-行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

该代码块的实际用途是“飞书推送模块”,负责将交易、持仓和信号信息组织成飞书卡片并发送。虽然这与声明中的“飞书推送”部分一致,也提到“长桥 OpenAPI”作为数据来源,但代码本身没有任何券商 API 调用、下单、行情轮询、调度器、风控止盈止损、策略判断或收益统计实现。因此,声明描述的是一个完整的自动化量化交易系统,而实际代码只是其中的通知子模块,主目的和能力范围明显不一致。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

该代码块的实际核心用途是飞书消息通知测试,而不是量化交易集成。它通过环境变量读取 FEISHU_APP_ID/FEISHU_APP_SECRET,调用飞书 API 获取租户访问令牌、列出用户、定位特定人员,并发送一张包含“量化交易助手”文案的测试卡片。虽然声明中提到飞书推送,但代码没有体现与长桥证券、港股/美股交易、5分钟监控、超跌/动量策略、止盈止损管理或绩效跟踪相关的任何实现。相反,代码执行了一个未在描述中明确说明的能力:读取企业通讯录并识别特定个人 open_id 后主动发消息。因此描述与代码行为存在明显且实质性的偏差。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The declared description presents a full automated quantitative trading system with strategy execution, monitoring, notifications, and risk management. The supplied code only initializes the Longbridge quote client, requests current quotes for several predefined US stocks, and prints the results. It does not place trades, evaluate any strategy, send notifications, track portfolio performance, or implement periodic monitoring. This is a material mismatch in primary purpose and capabilities.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

描述与代码存在明显能力不一致。代码确实实现了长桥证券港股自动交易、止盈止损和均值回归买入,部分符合“自动交易”与“止盈止损管理”的表述。但声明中的多个核心能力在代码中缺失:没有任何飞书推送实现,没有绩效统计/跟踪逻辑,没有美股股票池或市场处理,也没有每5分钟监控的调度机制。另一个重要偏差是“动量策略”被宣称为自动策略的一部分,但代码对动量条件仅打印“关注”,并不执行买入交易,因此其实际自动执行策略主要是持仓止盈止损和超跌抄底,而非完整的动量+超跌双策略自动交易。基于这些缺失和偏差,应判定为描述与实际行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

声明描述的是一个可自动执行交易的量化交易集成系统,而代码实际只是离线历史回测工具,核心用途明显不同。脚本没有任何下单、账户、定时监控、消息推送或券商API调用逻辑,也没有真正执行止盈止损规则;甚至市场覆盖范围也与声明不符(仅港股,无美股)。因此描述与代码行为存在明显且实质性的功能不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
93% confidence
Finding

描述与代码部分匹配:代码确实使用长桥接口进行自动化交易、每5分钟监控、并包含止盈止损逻辑。但存在多处重要不一致。首先,描述强调“飞书推送”和“绩效跟踪”,代码完全没有消息推送或绩效统计/持久化功能。其次,描述称支持“港股/美股自动交易”,而该代码仅处理港股代码列表 HK_STOCKS,没有任何美股标的或市场切换逻辑。再次,描述提到“超跌/动量策略”,但代码虽然定义了 momentum_threshold,却没有任何基于上涨动量的买入/卖出执行逻辑,实际执行的是超跌买入加持仓止盈止损。因此该代码块未完整实现声明中的关键能力,构成描述与行为不匹配。

Content

No source excerpt is available for this finding.