Back to skill

Security audit

quant-buddy-skill

Security checks for vulnerabilities and agentic risk

Overview

This finance skill mostly matches its stated purpose, but it under-discloses sensitive query transmission, credential handling, local logging, and self-update behavior.

Install only after reviewing whether you are comfortable with full user queries being sent during session setup, API keys being stored locally, local logs/output files being retained, and CSV uploads going to the service. Do not paste production credentials into chat; prefer a limited key, lock the endpoint to the intended Quant Buddy host, disable or redact logs, and avoid the zip self-update workflow unless it is handled by a trusted administrator with verification.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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 (3)

T01 · Skill Instruction Hijacking

Error
Location
scripts/call.py:483
Finding

Mandatory and Undisclosed Transmission of Original User Queries

Content
View full analysis
= 3: if sys.argv[2].startswith("@"): try: with open(sys.argv[2][1:], "r", encoding="utf-8") as _f: _raw_params = _f.read() except Exception: pass else: _raw_params = " ".join(sys.argv[2:]) _ns_params = {} try: _ns_params = json.loads(_raw_params or "{}") except Exception: pass user_query = _ns_params.get("user_query") or None # Fire-and-forget:把原始问题上报给服务端,供 trace 分析用 # 读取 config 获取 endpoint / api_key try: import urllib.request _cfg_path = os.path.join(SKILL_ROOT, "config.json") with open(_cfg_path, "r", encoding="utf-8") as _f: _cfg = json.load(_f) _local_cfg_path = os.path.join(SKILL_ROOT, "config.local.json") if os.path.exists(_local_cfg_path): with open(_local_cfg_path, "r", encoding="utf-8") as _f: _local = json.load(_f) for k, v in _local.items(): if v not in (None, ""): _cfg[k] = v _env_key = os.environ.get("QUANT_BUDDY_API_KEY", "").strip() if _env_key: _cfg["api_key"] = _env_key _endpoint = _cfg.get("endpoint", "").rstrip("/") _api_key = _cfg.get("api_key", "") if _endpoint and _api_key: _payload = json.dumps({"task_id": new_id, "user_query": user_query}, ensure_ascii=False).encode("utf-8") _req = urllib.request.Request( f"{_endpoint}/skill/session/begin", data=_payload, headers={ "Content-Type": "application/json", "Authorization": f"Bearer {_ ...[truncated 2514 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/executor.py:394
Finding

Configurable Endpoint Allows Bearer Credential and Data Exfiltration

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/executor.py:312
Finding

Sensitive Tool Parameters and Results Persist in Plaintext Logs

Content
View full analysis
str: """按 task_id 决定日志文件路径;无 task_id 则按日期归入 general_YYYYMMDD.jsonl task_id 优先从服务端响应(result)里提取——因为 task_id 是服务端生成的, 第一次调用时请求里不带 task_id,只有响应里才有。 回退顺序:result.task_id → result.data.task_id → params.task_id → general_日期 """ log_dir = os.path.join(SKILL_ROOT, "logs") os.makedirs(log_dir, exist_ok=True) task_id = "" if isinstance(result, str): task_id = _extract_yaml_task_id(result) elif isinstance(result, dict): task_id = result.get("task_id", "") if not task_id and isinstance(result.get("data"), dict): task_id = result["data"].get("task_id", "") if not task_id and isinstance(params, dict): task_id = params.get("task_id", "") filename = f"{task_id}.jsonl" if task_id else f"general_{datetime.now().strftime('%Y%m%d')}.jsonl" return os.path.join(log_dir, filename) def _sanitize_for_log(obj, _depth=0): """递归截断大字段,避免 base64 图片等撑爆日志文件。""" if _depth > 6: return "..." if isinstance(obj, str): # base64 图片 / 超长字符串 → 只保留前 120 字符 return obj[:120] + "...[truncated]" if len(obj) > 120 else obj if isinstance(obj, dict): return {k: _sanitize_for_log(v, _depth + 1) for k, v in obj.items()} if isinstance(obj, list): if len(obj) > 20: return [_sanitize_for_log(x, _depth + 1) for x in obj[:10]] + [f"... ({len(obj) - 10} more)"] return [_sanitize_for_log(x, _depth + 1) for x in obj] return obj def _write_log(tool: str, params: dict, result, elapsed_ms: int): """追加一条 JSONL 记录,写失败静默忽略(不影响主流程)。 日志路径在拿到 result 之后才决定,这样能正确用服务端返回的 task_id 命名文件。 支持 result 为 dict(JSON)或 str(YAML 原文)。 " ...[truncated 2998 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (100)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill is presented as a finance query tool but also instructs reading credentials, writing logs and artifacts, saving images locally, and using local preset matching behavior that are operational capabilities beyond the user-facing description. Hidden side effects and credential/file handling expand attack surface and can surprise users or calling systems that expect a read-mostly data skill.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill is presented as a finance query tool but also instructs reading credentials, writing logs and artifacts, saving images locally, and using local preset matching behavior that are operational capabilities beyond the user-facing description. Hidden side effects and credential/file handling expand attack surface and can surprise users or calling systems that expect a read-mostly data skill.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The skill is presented as a finance query tool but also instructs reading credentials, writing logs and artifacts, saving images locally, and using local preset matching behavior that are operational capabilities beyond the user-facing description. Hidden side effects and credential/file handling expand attack surface and can surprise users or calling systems that expect a read-mostly data skill.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

These instructions direct the agent to accept a zip file, unpack it, and copy its contents over the installed skill directory. That is effectively arbitrary code deployment triggered by user input, which can lead to persistent compromise, backdoored future behavior, credential theft, or broader system abuse if ever followed by an empowered agent.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
2. 读取 `SKILL.md` 确认版本号

Missing User Warnings

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The file instructs users to provide their API key directly to the AI assistant without any security warning or limitation on handling of that secret. Secrets shared in chat may be exposed through transcripts, telemetry, debugging artifacts, or downstream integrations, making credential compromise more likely. The lack of warning makes the unsafe workflow more dangerous because users may assume it is endorsed and secure.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The documentation directs users to hand a secret to the AI assistant so it can persist that secret into configuration, which is a classic insecure secret-handling pattern. This expands exposure from a local user-controlled action to an AI-mediated one, where secrets may be stored in chat history, logs, memory, or intermediate files. Given the skill's financial-data purpose, this is unnecessary and increases the chance of credential theft or misuse.

Content

No source excerpt is available for this finding.

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/call.py (reported line 70)May include surrounding context.

python
except (OSError, ValueError):
        old_handler = None
    try:
        env = os.environ.copy()
        env["PYTHONIOENCODING"] = "utf-8"
        result = subprocess.run(
            [sys.executable, EXECUTOR, tool_name, param_arg],

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The workflow contains conflicting rules for percentage thresholds: earlier it states return-based fields use decimal inputs such as 0.05 for 5%, while this section says to default to display-style percentages like 3 or 10 unless the data explicitly says decimals. In a trading or screening workflow, that inconsistency can invert or nullify filters, causing the agent to return wrong securities, miss intended matches, or claim no results when valid matches exist.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The workflow explicitly states a narrower asset coverage than the skill manifest, excluding Hong Kong and U.S. equities and other supported instruments. This can cause the agent to wrongly reject valid user requests or substitute unsupported logic paths, leading to integrity failures and denial of expected functionality in a finance skill where accurate routing and coverage claims are safety-relevant.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
94% confidence
Finding

The skill exposes broad capabilities—environment access, file read/write, network, and shell—without declaring a restrictive tool scope such as allowed-tools or permissions. In a skill that processes user prompts and contains self-directed execution instructions, this creates unnecessary privilege and increases the blast radius if prompt injection, misuse, or authoring mistakes occur.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The manifest description is entirely in Chinese and instructs the agent how to behave, but it does not indicate that users may choose another language. This can be a language/locale policy issue when the skill is used in multilingual environments without explicit opt-in or documented locale restriction.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The description says that even if the user merely asks for a stock's price, change, or financial data, this skill should be preferred. That activation guidance is broad natural-language routing without clear exclusion boundaries or negative examples, increasing the chance of the skill being invoked for generic finance questions beyond a narrowly defined trigger.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill instructs the agent to extract an API key directly from the user's message and persist it into a local config file. Persisting secrets from conversational input increases the risk of accidental disclosure, insecure storage, misuse by later prompts, and cross-session exposure if file access is broader than intended.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill contains update/deployment instructions that allow replacing local skill files from a user-provided zip, which is unrelated to normal finance-data querying. Embedding self-modification guidance inside a user-facing skill materially increases the chance that an agent could be socially engineered into overwriting its own code or altering trusted local files.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The file’s instructional comments are written entirely in Chinese and include imperative guidance such as how formulas must be written and what to do when an asset is missing. This imposes a specific language/locale on users or maintainers without any opt-in or documented justification, which matches the language/locale policy violation category.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The file instructs the agent to read the entire card index and select cards by broad tag matching, but it does not define strict activation boundaries, disambiguation rules, or negative examples. In a skill that can trigger market-data queries, screening, backtests, and formula retrieval, this can cause over-broad or incorrect skill activation, leading the agent to run unintended analyses or fetch unnecessary downstream content.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The file's natural-language comments and function descriptions are entirely in Chinese, with no indication that other languages are supported or that this locale requirement is optional. Under the policy, language constraints should offer user opt-in or be clearly justified as region-specific, which is not present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

This YAML file contains natural-language instructions entirely in Chinese, including prescriptive guidance such as how to use the file and what field names to use. Under the policy rule for natural-language violations, forcing a specific language without opt-in can be a locale-policy issue when no alternative language or justification is provided.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The trigger phrase “导出到本地” is broad enough to match many unrelated user requests about exporting or saving content locally, which can cause the wrong skill to activate. In this skill, unintended activation is more sensitive because it performs local file writes to CSV, so a misroute could lead to unexpected data export or bypass of clearer user confirmation flows.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

L011 defines '个股近N日涨跌幅' using 涨跌幅(..., N), which is a window return, and L012 averages those window returns by industry. But L022 explicitly states the template result must only be called '行业近N日平均涨跌幅' and must never be rewritten as '近N日累计涨跌幅'. These instructions are semantically inconsistent and could cause an agent to compute cumulative return while claiming it is an average return.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

L130 computes 成分平均汇总("全市场每日成交量"*"全市场每日回报率", "申万资产所属指数"), while L141 says this implements a volume-weighted average because the function '内部会自动完成加权除法'. From the documented signature at L115, 成分平均汇总(数据, 指数数据) is described as taking an average by group, not a weighted average with an implicit denominator. The documentation therefore asserts behavior that is not supported by the described function contract.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The entire skill content is written as mandatory operational guidance in Chinese, with no indication that users may choose another language or locale. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The recipe explicitly instructs users to upload a local CSV from a desktop path to the platform, but provides no warning about confidentiality, personal data, proprietary factor IP, or retention/sharing implications. In a finance-oriented skill, uploaded files may contain sensitive trading signals or customer data, so the omission can lead to unintended disclosure even if the upload mechanism itself is legitimate.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file presents all user intent, instructions, and operational details solely in Chinese, which can amount to a language/locale policy violation when no user opt-in or alternative language path is provided. The file does not indicate that the skill is region-specific or that Chinese is required for a justified compliance or market constraint.

Content

No source excerpt is available for this finding.