Back to skill

Security audit

Bankai Skill

Security checks for vulnerabilities and agentic risk

Overview

The skill is a disclosed banking-document drafting helper, but its CLI can send any chosen environment variable and banking draft content to any chosen model endpoint.

Review before installing in any environment with sensitive secrets. Use only a dedicated DeepSeek or private-model API key, avoid --key-env for unrelated variables, and only use trusted HTTPS or approved internal endpoints. Do not send customer, account, regulatory, or confidential banking data to the public DeepSeek endpoint unless your organization has approved that data flow.

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

Error
Location
scripts/bankai_write.mjs:31
Finding

Arbitrary Environment Credential Exfiltration to a User-Controlled Endpoint

Content
View full analysis

Vulnerability Details

File Location: scripts/bankai_write.mjs, lines 31–34 and 96–110
Vulnerability Type: Unrestricted credential and sensitive-data transmission
Risk Level: High

Vulnerable Code

js
else if (t === '--key-env') a.keyEnv = argv[++i];
else if (t === '--base-url') a.baseUrl = argv[++i];
js
const apiKey = process.env[args.keyEnv];
if (!apiKey) fail(`未找到 API Key:环境变量 ${args.keyEnv} 为空(或用 --mock 离线测试)`);

const base = args.baseUrl || DEFAULT_BASE;
const body = JSON.stringify({
  model: args.model,
  messages,
  temperature: TEMP,
  max_tokens: MAX_TOKENS,
  stream: false
});

resp = await fetch(base, {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: `Bearer ${apiKey}`
  },
  body,
  signal: ctrl.signal,
});

Technical Analysis

The CLI permits callers to control both the name of the environment variable used as an API credential and the destination URL receiving that credential.

No allowlist restricts --key-env to a dedicated BankAI credential, and no validation restricts --base-url to trusted HTTPS endpoints. Consequently, any environment variable accessible to the Node.js process can be selected and transmitted in the HTTP Authorization header to an arbitrary server.

The request body also contains messages, which incorporates user-provided banking-document data. Therefore, exploitation can disclose both an unrelated environment secret and confidential document content. Because the URL scheme is not validated, selecting an unencrypted HTTP endpoint can also expose these values to network interception.

Attack Path

  1. The victim runs the Skill in an environment containing a sensitive variable, such as a cloud credential, deployment token, or unrelated API key.
  2. An attacker influences the command invocation through malicious instructions, compromised automation, or direct local access.
  3. The attacker selects the sensitive variable and an attacker-contro ...[truncated 1454 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove unrestricted environment-variable selection. Read only a dedicated variable such as DEEPSEEK_API_KEY, or enforce a strict allowlist of Skill-specific credential names.
  2. Do not automatically forward the DeepSeek credential to custom endpoints. Require a distinct, endpoint-specific credential variable for private or third-party endpoints.
  3. Validate custom URLs with the standard URL parser and permit only approved protocols and destinations.
  4. Require HTTPS for remote endpoints. If local development requires HTTP, limit it to explicitly approved loopback addresses and require an opt-in insecure-development flag.
  5. Introduce a trusted-host allowlist or require explicit interactive confirmation before transmitting credentials or document content to a non-default host.
  6. Reject URLs containing embedded credentials, unexpected ports, redirects to untrusted hosts, or ambiguous host representations.
  7. Disable automatic redirect following or validate every redirect destination so credentials cannot be forwarded to a different origin.
  8. Warn users clearly when public-cloud endpoints will receive potentially sensitive banking data, and default sensitive workflows to approved private endpoints.
  9. Apply data minimization and redaction before constructing the request body. Avoid transmitting fields not required for generation.
  10. Add automated security tests verifying that unrelated environment variables cannot be selected, HTTP endpoints are rejected, unapproved hosts are blocked, and authorization headers are not forwarded across origins.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (19)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/bankai_write.mjs --type 通知 --input @req.json --base-url https://your-intranet-endpoint/v1/chat/completions

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/bankai_write.mjs --type 通知 --input @req.json --base-url https://your-intranet-endpoint/v1/chat/completions

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/bankai_write.mjs --type 通知 --input @req.json --base-url https://your-intranet-endpoint/v1/chat/completions

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/bankai_write.mjs --type 通知 --input @req.json --base-url https://your-intranet-endpoint/v1/chat/completions

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/bankai_write.mjs --type 通知 --input @req.json --base-url https://your-intranet-endpoint/v1/chat/completions

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/bankai_write.mjs --type 通知 --input @req.json --base-url https://your-intranet-endpoint/v1/chat/completions

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/bankai_write.mjs --type 通知 --input @req.json --base-url https://your-intranet-endpoint/v1/chat/completions

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> 完整字段定义与提示词见 `references/scenarios.mjs`(从线上源码提取,请勿手改)。运行 `--list` 可看全部 id。

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The README states '禁止 Markdown,中文全角标点', which imposes a specific language/locale formatting requirement as part of the skill behavior. Because the document does not present this as an optional mode or user-selectable preference, it appears to enforce a locale/language policy without opt-in.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill advertises use of an API key via environment variables and outbound model calls, but declares no explicit tool/permission scope. In an agent platform, that creates hidden access to sensitive env data and network egress, making it harder for users or policy engines to constrain what the skill can read or where it can send data.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

文档声明“强制中文全角标点”,属于明确的语言/locale 强制要求,但未说明这是仅针对中文银行公文场景的受限能力,也未提供用户选择或 opt-in 机制。按规则,强制特定语言/区域格式且缺少选择或充分限定时,构成自然语言政策风险。

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The dialogue trigger examples are broad natural-language requests such as '帮我写...' that overlap with ordinary conversation. In assistant environments that auto-route to skills, this can cause unintended activation, sending sensitive banking drafting context to the skill or external model endpoint without the user's explicit intent to invoke it.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The visible titles and descriptions for configuration fields are presented in Chinese only, which imposes a specific language on users without offering an alternative or opt-in. This is a natural-language policy concern because it constrains locale/language choice in user-facing skill content.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The natural-language instructions require strict alignment to Chinese GB/T document standards and present the product as uniformly following that standard. Because this .mjs file embeds user-facing prompt text, it effectively constrains output to a specific language/locale regime without any opt-in or alternative path.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The instruction '禁止使用英文半角标点,必须使用中文全角标点' is a direct locale-specific requirement in natural language. The rule allows locale constraints only when clearly documented and justified; here the file does not present this as an optional or explicitly scoped user choice.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
93% confidence
Finding

The script sends user-provided drafting inputs and system prompt content to an external DeepSeek API endpoint. In a banking-writing context, those inputs may contain sensitive internal business data, customer information, or regulated financial details, so transmitting them to a third-party service can create confidentiality and compliance exposure if not strictly controlled.

Content

Scanner excerpt · scripts/bankai_write.mjs (reported line 17)May include surrounding context.

js
const __dirname = dirname(fileURLToPath(import.meta.url));
const { SCENARIOS } = await import(pathToFileURL(join(__dirname, '..', 'references', 'scenarios.mjs')).href);

const DEFAULT_BASE = 'https://api.deepseek.com/chat/completions';
const DEFAULT_MODEL = 'deepseek-chat';
const TEMP = 0.7;
const MAX_TOKENS = 8192;

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The system prompt explicitly says '严禁 Markdown 格式... 仅使用中文全角标点', which imposes a specific language/locale formatting requirement on all outputs. Under the policy, locale constraints should either be optional for the user or clearly justified as region-specific; this file does not provide user opt-in or an explicit compliance rationale in the instruction itself.

Content

No source excerpt is available for this finding.

Vague Triggers

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

This manifest-style JSON describes configuration fields but provides no clear activation phrases, scope limits, or exclusion conditions for when the skill should be invoked. For manifest files, missing trigger specificity can lead to unintended invocation because users and orchestrators have no bounded description of when the skill applies.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The file’s instructional content is presented only in Chinese, and there is no indication that users may choose another language or that the skill is intentionally limited to a Chinese-speaking audience. Under the stated policy, forcing a specific language without user opt-in can constitute a natural-language policy violation.

Content

No source excerpt is available for this finding.