Back to skill

Security audit

新帆线索池运营

Security checks for vulnerabilities and agentic risk

Overview

This internal lead-management skill is mostly disclosed, but it needs review because it uses a logged-in browser session for production actions and can publish unlabeled mock business metrics.

Install only for a controlled internal Xinfan environment after review. Before production use, fix exact-origin browser target validation, avoid page-overridable fetch where possible, remove or harden auth set-token, and clearly label or disable the mock conversion metrics in daily reports. Users should explicitly confirm any write action or plaintext contact lookup.

Vulnerability Patterns
  • Tool Hijacking and SpoofingModifies or replaces tools so legitimate-looking calls execute attacker logic
  • 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 (2)

T07 · Tool Hijacking and Spoofing

Error
Location
lib/browserSession.js:64
Finding

Unanchored Browser Target Matching Allows CDP Request Spoofing

Content
View full analysis
t.type === "page" && typeof t.url === "string" ); // Prefer a page matching the target domain const match = pages.find((p) => p.url.includes(domain)); return match || null; } ``` ```js async function evaluateFetchInPage(wsUrl, baseUrl, requestSpec) { const cdp = await openCdp(wsUrl); try { await cdp.send("Runtime.enable"); const { method, path, bodyObj } = requestSpec; const url = `${baseUrl}${path}`; const expr = ` (async () => { try { const r = await fetch(${JSON.stringify(url)}, { method: ${JSON.stringify(method)}, credentials: 'include', headers: { 'Content-Type': 'application/json', 'Accept': 'application/json' }, body: ${JSON.stringify(JSON.stringify(bodyObj ?? {}))} }); const text = await r.text(); return JSON.stringify({ status: r.status, contentType: r.headers.get('content-type') || '', text }); } catch (e) { return JSON.stringify({ __fetchError: String(e && e.message || e) }); } })() `; const result = await cdp.send("Runtime.evaluate", { expression: expr, awaitPromise: true, returnByValue: true, }); ``` ### Technical Analysis The browser target is selected using `p.url.includes(domain)`. T ...[truncated 2576 chars]
Remediation
View remediation
isTrustedTarget(page.url, domain)); ``` 2. Consider requiring the expected application path in addition to the exact hostname. 3. Reject malformed URLs, embedded credentials, unexpected ports, non-HTTPS schemes, and subdomains unless they are explicitly allowlisted. 4. Revalidate the page URL and execution context immediately before each `Runtime.evaluate` call to reduce time-of-check/time-of-use risk. 5. Execute requests in an isolated CDP world where practical, instead of relying on the page's mutable JavaScript globals. 6. Avoid calling a page-overridable `window.fetch`. Use a trusted browser mechanism or a captured native implementation that cannot be replaced by application scripts. 7. Verify that the final response URL and origin remain within an explicit allowlist. 8. Add negative tests for attacker-controlled URLs containing the trusted domain in query strings, fragments, paths, and deceptive hostnames. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
lib/auth.js:22
Finding

Unused Authentication Token Is Exposed Through Process Arguments and Plaintext Storage

Content
View full analysis
"); auth.setToken(token); process.stdout.write( `token saved to ${auth.CREDENTIALS_PATH} (${auth.maskToken(token)})\n` ); return; } ``` ```js const CRED_DIR = path.join(os.homedir(), ".xinfan-lead-cli"); const CRED_FILE = path.join(CRED_DIR, "credentials.json"); function readCredentials() { if (!fs.existsSync(CRED_FILE)) return null; try { return JSON.parse(fs.readFileSync(CRED_FILE, "utf8")); } catch { return null; } } function writeCredentials(data) { fs.mkdirSync(CRED_DIR, { recursive: true, mode: 0o700 }); fs.writeFileSync(CRED_FILE, JSON.stringify(data, null, 2)); fs.chmodSync(CRED_FILE, 0o600); } // Fallback: manually save a cookie value. export function setToken(token) { if (!token || !token.trim()) { throw new Error("token cannot be empty"); } writeCredentials({ token: token.trim(), capturedAt: new Date().toISOString() }); } export function maskToken(token) { if (!token) return "(not set)"; return token.length <= 18 ? token : `${token.slice(0, 18)}…`; } ``` ### Technical Analysis The `auth set-token ` command accepts a sensitive authentication value as a command-line argument and writes it to a plaintext JSON file. Passing secrets through command-line arguments can expose them through shell history, process listings, audit logs, terminal capture, or command telemetry. The token is also partially printed to standard output. For tokens of 18 characters or fewer, `maskToken()` returns and prints the entire token. Longer tokens expose their first 18 characters. Although the credential file is changed to mode `0600`, it remains plaintext and is access ...[truncated 1959 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (20)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill context indicates access to lead details may expose plaintext contact information and that certain detail-retrieval flows can trigger follow-up status changes as a side effect. Sensitive-data exposure plus hidden write side effects violates least surprise and can cause unauthorized disclosure or accidental modification of real production lead records.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The skill context indicates access to lead details may expose plaintext contact information and that certain detail-retrieval flows can trigger follow-up status changes as a side effect. Sensitive-data exposure plus hidden write side effects violates least surprise and can cause unauthorized disclosure or accidental modification of real production lead records.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The skill context indicates access to lead details may expose plaintext contact information and that certain detail-retrieval flows can trigger follow-up status changes as a side effect. Sensitive-data exposure plus hidden write side effects violates least surprise and can cause unauthorized disclosure or accidental modification of real production lead records.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The skill context indicates access to lead details may expose plaintext contact information and that certain detail-retrieval flows can trigger follow-up status changes as a side effect. Sensitive-data exposure plus hidden write side effects violates least surprise and can cause unauthorized disclosure or accidental modification of real production lead records.

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 12)May include surrounding context.

md
通过本目录下的零依赖本地 CLI(`bin/cli.js`,仅用 Node 内置 `fetch`)调用新帆后台的线索管理接口。10 个接口一一对应 10 个独立子命令,**每个子命令都自带 `--schema`(JSON Schema)和 `--help`(人类可读说明),字段/取值范围现查即可**,不需要预读本文档。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- 执行内容:在本 skill 目录运行 `node scripts/private-daily-report.js`;若提示登录状态失效,**先按「登录失效时的自愈规则」自己重试恢复**,重试成功后再重新跑一次脚本,不要一遇到登录失效就直接跳过本次推送去通知用户——只有自愈重试后依然失效才允许跳过并通知用户。脚本正常

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 · lib/auth.js (reported line 22)May include surrounding context.

js
// ─────────────────────────────────────────────────────────────────────────────

const CRED_DIR = path.join(os.homedir(), ".xinfan-lead-cli");
const CRED_FILE = path.join(CRED_DIR, "credentials.json");

function readCredentials() {
  if (!fs.existsSync(CRED_FILE)) return null;

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The script intentionally injects fabricated business metrics into a user-facing daily report, while presenting them in the same format as real operational data. This can mislead operators and managers into making business decisions based on false information, undermining trust, reporting integrity, and potentially causing downstream financial or operational harm.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
84% confidence
Finding

The skill declares no explicit tool/permission boundaries even though it is designed to use network access, environment variables, and browser-session reuse. Without scoped permissions, a host agent may grant broader-than-necessary capabilities, increasing the blast radius if the skill is misused or modified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The document mandates how the agent must speak to users in Chinese business language and all examples and required phrasing are Chinese-only. There is no indication that users may choose another language or that this locale restriction is optional, which creates a natural-language policy issue for language choice.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The CLI usage text is presented entirely in Chinese, and the rest of the file continues this pattern for errors and status messages. This imposes a specific language on all users without any opt-in, language selection, or justification that the tool is intended only for a Chinese-speaking or region-specific audience.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This code persists authentication material to a local credentials file via writeCredentials and setToken, which is a safety-relevant file write involving sensitive data. While comments describe the fallback behavior, there is no confirmation prompt, user-facing log/print, or explicit disclosure to the user at the point this sensitive token is stored.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module explicitly attaches to a live Chrome DevTools Protocol session, locates an already logged-in Xinfan page, and executes fetch requests inside that page context so the user's cookies and injected auth headers are used automatically. That creates a confused-deputy risk: privileged actions can be performed as the logged-in user without an explicit runtime consent step, visible confirmation, or per-action authorization boundary, which is especially sensitive because this skill can claim/release leads and update follow-up state.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This file contains multiple user-facing natural-language strings in Chinese, including validation errors and help output, but provides no indication that the user can choose another language or that the tool is intentionally region-specific. That creates a locale-policy concern because the skill effectively forces a specific language on all users.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This file embeds Chinese-language labels and commentary, and the generated user-facing metric labels such as "站内粉丝DGMV" and "近1年站外GMV" are fixed rather than selectable by locale. That creates a natural-language policy concern because the skill appears to force a specific language without opt-in or a documented justification for being Chinese-only.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script presents all runtime errors and generated report content in Chinese, including login failures, parse failures, and report headings. This imposes a fixed language on users without opt-in or any indication that the skill is intentionally region-specific.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This code aggregates private lead data and prints a full daily report to stdout, including lead names and derived business insights. There is no visible warning, confirmation, or disclosure in the script that running it will expose potentially sensitive business data in terminal output or downstream logs.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

The explanatory comments are entirely in Chinese, which imposes a specific language for maintainers or auditors without offering any language choice or justification. Under the stated policy, forcing a specific language without opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

All explanatory natural-language content in the file is written only in Chinese, with no indication of language choice or opt-in. Under the stated policy, forcing a specific language without user choice can be a locale/language policy violation when natural-language instructions or disclosures are present.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file’s natural-language comments are entirely in Chinese, which imposes a specific language choice on maintainers or users reading the skill internals without offering any alternative or opt-in. This matches the policy category for language or locale constraints expressed in natural language.

Content

No source excerpt is available for this finding.