Back to skill

Security audit

股票筛选工具

Security checks for vulnerabilities and agentic risk

Overview

This skill is a straightforward stock-data API wrapper with disclosed API-key use and some state-changing preset tools, but no evidence of hidden persistence, local credential theft, or deceptive behavior.

Install only if you trust the configured stock API endpoint and need these stock-analysis and preset-management tools. Use HTTPS for remote API servers, keep the API key least-privileged, and be careful with preset delete/update commands because they change server-side data.

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
src/config.js:8
Finding
API Key Can Be Transmitted to an Arbitrary Plaintext Endpoint<![CDATA[ ## Vulnerability Details **File Location**: `src/config.js:8-23`, `src/api-client.js:14-19`, `README.md:30-31` **Vulnerability Type**: Unrestricted destination and insecure transport for API credentials **Risk Level**: Medium ### Vulnerable Code `src/config.js:8-23`: ```js export const API_BASE_URL = (process.env.STOCK_API_BASE_URL || "").replace(/\/+$/, ""); export const API_KEY = process.env.STOCK_API_KEY || ""; export const API_TIMEOUT = Number(process.env.STOCK_API_TIMEOUT || "30") * 1000; export const API_PREFIX = "/api/v1"; export function getApiUrl(path) { if (!API_BASE_URL) { throw new Error("未设置 STOCK_API_BASE_URL 环境变量"); } return `${API_BASE_URL}${API_PREFIX}${path}`; } export function getAuthHeaders() { const headers = { "Content-Type": "application/json", Accept: "application/json" }; if (API_KEY) headers["X-API-Key"] = API_KEY; return headers; } ``` `src/api-client.js:14-19`: ```js const res = await fetch(url, { method, headers: getAuthHeaders(), body: body ? JSON.stringify(body) : undefined, signal: controller.signal, }); ``` `README.md:30-31`: ```bash export STOCK_API_BASE_URL="http://localhost:8000" export STOCK_API_KEY="your-api-key-here" ``` ### Technical Analysis The application accepts `STOCK_API_BASE_URL` as an unrestricted string and directly uses it to construct every API URL. It does not parse the value as a URL, enforce HTTPS, verify the destination hostname, reject embedded credentials, or apply an endpoint allowlist. At the same time, `getAuthHeaders()` attaches `STOCK_API_KEY` to every request through the `X-API-Key` header. Consequently, whoever controls or influences `STOCK_API_BASE_URL` controls the destination to which the credential is sent. If a non-loopback endpoint uses plaintext HTTP, an on-path attacker can observe or modify the request and recover the API key. If configuration is changed to an attacker-controlled endpoint, invoking any registered tool sends the key directly t ...[truncated 1541 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Parse the configured endpoint with `new URL()` and reject malformed URLs before any request is made. 2. Require the `https:` protocol for all non-loopback destinations. 3. If local development requires HTTP, permit it only for explicitly recognized loopback hosts such as `localhost`, `127.0.0.1`, and `[::1]`. 4. Reject URL schemes other than `https:` and the narrowly scoped loopback `http:` exception. 5. Reject URLs containing embedded usernames or passwords. 6. Where deployment topology is known, enforce an administrator-controlled hostname or origin allowlist. 7. Bind credential transmission to the validated origin so redirects or future request changes cannot forward `X-API-Key` to another host. 8. Consider disabling automatic cross-origin redirects or stripping authentication headers whenever the redirect origin changes. 9. Document that remote API endpoints must use valid TLS certificates and that endpoint configuration must be treated as security-sensitive. 10. Rotate the API key if it may previously have been sent to an untrusted or plaintext remote endpoint. 11. Apply least-privilege server-side authorization so read-only consumers cannot perform factor creation, modification, sorting, or deletion. ]]>
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (34)

Credential Access

High
Category
Privilege Escalation
Content
export STOCK_API_TIMEOUT="30"
```

### 方式二:.env 文件

```bash
cp .env.example .env
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
export STOCK_API_TIMEOUT="30"
```

### 方式二:.env 文件

```bash
cp .env.example .env
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
### 方式二:.env 文件

```bash
cp .env.example .env
# 编辑 .env 填写实际配置
```
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
node src/main.js <tool_name> '<JSON 参数>'
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Credential Access

High
Category
Privilege Escalation
Content
import { fileURLToPath } from "url";

const __dirname = dirname(fileURLToPath(import.meta.url));
loadDotenv({ path: resolve(__dirname, "..", ".env") });

export const API_BASE_URL = (process.env.STOCK_API_BASE_URL || "").replace(/\/+$/, "");
export const API_KEY = process.env.STOCK_API_KEY || "";
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The README states that simply mentioning broad phrases like '股票筛选', '热门因子', '股票分析', or '抖音热点' will cause the agent to automatically invoke tools. This creates an overbroad trigger surface where normal conversation can unintentionally activate network-capable actions, increasing the risk of prompt-triggered tool use without clear user intent.

Lp3

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding
The skill requires environment variables and makes network-backed CLI calls, but the manifest does not declare any explicit permission scope such as allowed tools or permissions boundaries. That increases the chance the host agent invokes it with broader-than-necessary capabilities, making accidental data exposure or unintended outbound requests more likely.

Static analysis

No suspicious patterns detected.