Back to skill

Security audit

功夫财经

Security checks for vulnerabilities and agentic risk

Overview

The skill appears purpose-aligned, but it handles persistent credentials, account-changing finance workflows, an unrestricted optional search endpoint, and a self-update path that should be reviewed before installation.

Install only if you trust kungfu-trader with your A-share finance API usage and account-scoped data. Prefer provisioning KUNGFU_OPENKEY through a secure secret manager instead of the config-openkey flow, avoid enabling research search unless the endpoint is HTTPS and trusted, review any subscription or bucket mutation before running it, and require explicit approval before applying updates.

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 (3)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/flows/run_config_openkey_flow.mjs:32
Finding

OpenKey Credential File Is Written Without Restrictive Permissions

Content
View full analysis
{ if (line.startsWith("KUNGFU_OPENKEY=")) { replaced = true; return `KUNGFU_OPENKEY=${openkey}`; } return line; }); if (!replaced) { updated.push(`KUNGFU_OPENKEY=${openkey}`); } const finalContent = updated.join("\n").replace(/\n{3,}/g, "\n\n").trimEnd() + "\n"; writeFileSync(OPENCLAW_ENV_PATH, finalContent, "utf-8"); ``` ### Technical Analysis The configuration flow stores `KUNGFU_OPENKEY` as plaintext in `~/.openclaw/.env`. Persisting this credential is part of the declared configuration functionality, but the file is created without an explicit owner-only permission mode. `writeFileSync()` therefore relies on the process umask. Under a common `022` umask, a newly created file can receive mode `0644`, making it readable by other local users. If the file already exists with permissive permissions, the implementation also does not correct those permissions. The containing directory is likewise created without an explicit `0700` mode. Although an existing `~/.openclaw` directory may already be protected, the code does not enforce that security boundary. The flow also performs a check followed by a path-based write without checking whether the destination is a symbolic link. In a locally compromised or shared environment, this can enable redirection of the write to another file writable by the victim account. ### Attack Path 1. A user runs the documented `config-openkey` command with a valid credential. 2. The Skill validates the credential against the ...[truncated 1137 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/flows/charts/indicator_chart_renderer.mjs:202
Finding

Unvalidated Annotation Color Enables SVG Attribute Injection

Content
View full analysis
{ const dateIdx = bars.findIndex(b => b.d === a.date); if (dateIdx < 0) return ""; const x = scaleX(dateIdx, bars.length, xStart, xEnd); const price = toNumber(a.price ?? bars[dateIdx]?.c); if (price === null) return ""; const y = scaleValue(price, priceRange, { yTop, yBottom }); const color = a.color ?? "#f59e0b"; const symbol = a.type === "buy" ? "▲" : a.type === "sell" ? "▼" : "●"; const offsetY = a.type === "sell" ? 16 : -10; return `${symbol} ${a.label ? `${escapeXml(a.label)}` : ""}`; }).join("\n"); } ``` The resulting SVG is written to disk and passed to Inkscape: ```js writeFileSync(svgPath, svgContent, "utf-8"); try { await runInkscape(svgPath, pngPath); } catch { return { svg_path: svgPath, png_path: null }; } ``` ### Technical Analysis The annotation label is escaped with `escapeXml()`, but `a.color` is directly interpolated inside ...[truncated 2045 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/flows/research_shared/search_runtime.mjs:119
Finding

Optional Search Credential Can Be Sent to an Unrestricted or Insecure Endpoint

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
Findings (126)

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

The metadata declares required environment credentials and local writes to ~/.openclaw/.env, indicating the skill can access and persist authentication material. Combined with outbound network access and config flows, this creates a meaningful credential exposure surface even though the document claims the token is only sent to one host.

Content

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

md
description: Mainland China A-share stock and sector analysis tool (中国A股个股与板块分析). Current repo build focuses on stable deterministic products for stock snapshots, basic finance indicators, chip/price levels, sector detail lookup, plus bucket, phase-2 strategy, researcher, bayesian monitor, and preview stock/sector deep research flows.
user-invocable: true
disable-model-invocation: false
metadata: {"openclaw":{"skillKey":"kungfu_finance","always":false,"requires":{"bins":["node"],"optionalBins":["inkscape"],"env":["KUNGFU_OPENKEY"]},"primaryEnv":"KUNGFU_OPENKEY","install":{"node":{"packageManager":"none","bundledScripts":true}},"runtime":"bundled-node-scripts","networkSurface":["tianshan-api.kungfu-trader.com","push2.eastmoney.com","push2his.eastmoney.com","qt.gtimg.cn","ifzq.gtimg.cn","wry-manatee-359.convex.site","clawhub.ai"],"fileWrites":["~/.openclaw/workspace/finance-master/charts/","~/.openclaw/.env"],"subprocesses":["inkscape (execFileSync, fixed args, SVG→PNG conversion only)"],"homepage":"https://github.com/kungfu-trader/kungfu-skills","publisher":{"name":"kungfu-trader","contact":"https://github.com/kungfu-trader"}}}
---

# 功夫财经 | KungfuFinance

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 · scripts/flows/run_config_openkey_flow.mjs (reported line 2)May include surrounding context.

js
// Config OpenKey flow — validates an OpenKey then writes it to ~/.openclaw/.env.
// File I/O: reads ~/.openclaw/.env (to preserve existing entries), writes updated content back.
// Network: ONE POST to tianshan-api.kungfu-trader.com to verify the key BEFORE writing.
// The file content is NEVER sent over the network — only the user-supplied key is POSTed
// for validation. The readFileSync call reads the local .env to merge the new key value.

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 · scripts/flows/run_config_openkey_flow.mjs (reported line 5)May include surrounding context.

js
// Config OpenKey flow — validates an OpenKey then writes it to ~/.openclaw/.env.
// File I/O: reads ~/.openclaw/.env (to preserve existing entries), writes updated content back.
// Network: ONE POST to tianshan-api.kungfu-trader.com to verify the key BEFORE writing.
// The file content is NEVER sent over the network — only the user-supplied key is POSTed
// for validation. The readFileSync call reads the local .env to merge the new key value.

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 · scripts/flows/run_config_openkey_flow.mjs (reported line 12)May include surrounding context.

js
const OPENCLAW_ENV_PATH = join(
  process.env.HOME || "/tmp",
  ".openclaw/.env"
);

export async function runConfigOpenKeyFlow(values) {

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The README asserts a 'complete list' of contacted hosts while omitting documented update-check destinations elsewhere in the same file. In a security-sensitive skill, inaccurate network-boundary claims can mislead reviewers and operators into granting trust based on incomplete egress disclosure, undermining informed consent and auditability.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The trust notes claim the code contacts no other hosts, but later sections document both update-check hosts and a user-configurable research search endpoint. This contradiction weakens the reliability of the skill's security documentation and can cause defenders to underestimate data-exfiltration paths or permit the skill under false assumptions.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
86% confidence
Finding

The skill documents persistent local writes, including storing KUNGFU_OPENKEY in ~/.openclaw/.env and writing chart artifacts to a workspace directory. Persisting credentials and generated content beyond the active session increases exposure to local theft, accidental reuse across sessions, or unintended disclosure through filesystem access, backups, or shared environments.

Content

Scanner excerpt · README.md (reported line 147)May include surrounding context.

md
- `scripts/flows/research_shared/public_api.mjs` — EastMoney/Tencent public API client (no auth, contacts only `push2.eastmoney.com`, `push2his.eastmoney.com`, `qt.gtimg.cn`, `ifzq.gtimg.cn`)
- `scripts/flows/research_shared/search_runtime.mjs` — Optional search client (contacts only user-configured `KUNGFU_RESEARCH_SEARCH_ENDPOINT`, gated by `KUNGFU_ENABLE_RESEARCH_SEARCH=1`)

**File write locations (complete list):**

- `scripts/flows/run_indicator_chart_flow.mjs` — writes SVG/PNG to `~/.openclaw/workspace/finance-master/charts/`
- `scripts/flows/run_health_flow.mjs` — writes `KUNGFU_OPENKEY` to `~/.openclaw/.env` (config-openkey command only)

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

md
Default behavior:

- only operate on the current authenticated user's own buckets
- do not create or delete buckets in the current release build
- when adding a batch, resolve instruments first and filter invalid ones before writing
- when required information is missing or ambiguous, return a structured `needs_input` response so the host can continue the dialogue
- if all inputs are invalid, return `needs_input` for corrected instruments instead of calling the write API

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger examples are broad and overlap with normal finance conversation, which can cause the skill to activate for generic user requests without a strong boundary. In a skill that has network access, authenticated actions, file writes, and update/config flows, overbroad invocation increases the chance of unintended side effects or routing into sensitive operations.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill exposes a credential configuration flow that accepts an OpenKey and writes it to ~/.openclaw/.env. This is sensitive secret-handling and local persistence functionality that is not necessary for answering finance questions, and it increases the blast radius by enabling secret capture, replacement, or persistence through the skill interface.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill includes a self-update path that tells the agent to execute a shell command returned from a remote registry. Even though the command shown is fixed in documentation, delegating command execution to update metadata is outside the core finance-analysis function and expands the skill into software management, creating a supply-chain and arbitrary-command execution risk if the update source or returned command is compromised.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The file begins with and consistently mandates Chinese-only instructions, establishing a fixed output language. Under the policy rule, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

This markdown template begins with a Chinese-only task framing and the rest of the instructions are written to enforce Chinese report output, but it does not offer any user opt-in or alternative language path. That creates a natural-language locale policy issue because the skill effectively mandates a specific language regardless of user preference.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

At L1573-L1577 the instructions state that subsection titles must use descriptive titles and explicitly forbid numeric ordering. Immediately afterward, L1588-L1595 requires step titles like “### 第1步:...” and substep titles like “#### 1.1 ...”, which directly contradicts the earlier formatting prohibition.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

L1804-L1998 defines section 7 as steps 1 through 5, with step 5 being the scenario/price comparison. But later checklist text at L2240-L2248 and L2463 describes a different ordering, referring to a 5-dimension/three-scenario sequence that does not match the earlier canonical step structure, creating contradictory implementation guidance.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

L2223-L2233 fixes the required chapter 5 title as “### ⚡ 运营效率与执行力”. Earlier, the detailed framework at L1263 labels chapter 5 as “### 五、运营效率战略执行力(张新民资产质量分析核心应用)”, which conflicts with the exact-match requirement and would cause impossible-to-satisfy instructions.

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 contains natural-language requirements entirely in Chinese and mandates a Chinese output format and terminology, but it does not offer any user language choice or explain a justified region-specific constraint. That creates a language/locale policy issue under the rule for forced language without opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The system prompt is entirely prescriptive in Chinese and requires specific Chinese output structures and wording, but it does not provide any opt-in or alternative language option. Per the policy, forcing a specific language without user choice is a natural-language policy violation unless clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The prompt simultaneously forbids investment advice and future-oriented guidance while mandating an 'opportunities' section with concrete price levels. In a financial-analysis skill, this contradiction can push the model to produce de facto actionable trading guidance despite the stated compliance guardrails, creating regulatory, safety, and misuse risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The instruction text is entirely in Chinese and directs the model to produce the analysis report in that language, but it does not provide any opt-in or alternative language choice. Per the policy, forcing a specific language without user choice is a natural-language policy violation unless the constraint is explicitly justified.

Content

No source excerpt is available for this finding.

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
93% confidence
Finding

The README discloses a developer-specific absolute local filesystem path to a skill directory under /Users/jc34/.codex/skills/stock-analysis-v2/SKILL.md. While not directly exploitable on its own, this is an information disclosure issue because it reveals internal environment structure, usernames, and the existence and naming of adjacent skill assets that could aid targeted reconnaissance or social-engineering against the development workflow. In this skill context, the danger is somewhat elevated because the repository explicitly discusses migration from external skill sources and runtime orchestration, so enumerating local skill paths gives an attacker useful clues about trusted inputs and operator setup.

Content

Scanner excerpt · references/research-flows/README.md (reported line 68)May include surrounding context.

md
The orchestration-level protocol and shared-context skeleton came from:

- `/Users/jc34/.codex/skills/stock-analysis-v2/SKILL.md`
- `/Users/jc34/.codex/skills/sector-analysis/SKILL.md`

## Current Use

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
93% confidence
Finding

The README exposes another absolute local path, /Users/jc34/.codex/skills/sector-analysis/SKILL.md, which leaks workstation layout and the presence of a related sector-analysis skill. This is a true information disclosure finding because it helps enumerate internal tooling and file naming conventions; although the immediate impact is limited, such details can be chained with other disclosures to craft more convincing phishing, prompt-injection lures, or attacks against build and migration processes. Because this repository documents preview runtimes and auditable orchestration metadata, revealing trusted external comparison inputs makes the operational context more useful to an adversary.

Content

Scanner excerpt · references/research-flows/README.md (reported line 69)May include surrounding context.

md
The orchestration-level protocol and shared-context skeleton came from:

- `/Users/jc34/.codex/skills/stock-analysis-v2/SKILL.md`
- `/Users/jc34/.codex/skills/sector-analysis/SKILL.md`

## Current Use

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The reason fields include Chinese text alongside English in a general-purpose manifest, which can force a specific language on users or maintainers who do not read that language. The file does not provide an opt-in, translation, or justification that this manifest is intentionally region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

These reason values again mix Chinese with English in organizational metadata, creating the same language-policy issue elsewhere in the file. Because the manifest gives no indication that it is a region-specific artifact, this is a natural-language policy concern rather than a formatting preference.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The document content is written entirely in Chinese, including operational instructions and evaluation criteria, with no indication that language choice is optional or that the file is intentionally restricted to a Chinese-language context. Under the policy for natural-language violations, a skill artifact that effectively enforces a specific language without opt-in can be a locale-policy issue.

Content

No source excerpt is available for this finding.