Back to skill

Security audit

king-wen-hexagrams

Security checks for vulnerabilities and agentic risk

Overview

The skill matches its divination purpose, but it should be reviewed because it stores personal profile data, may print that data during install, and generates a cron command with unsafe shell quoting.

Install only if you are comfortable sharing lunar birthday, gender, optional birth hour, question context, and daily schedule data with a local skill. Avoid installing or running it in CI, shared machines, or logged environments until the postinstall output is redacted. Review any generated cron command before running it, and clear stored state with the provided clear command when you no longer want the profile retained.

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/init_profile.py:38
Finding

Shell Command Injection in Generated Cron Command

Content
View full analysis
str: return raw.replace("\\", "\\\\").replace('"', '\\"') def build_cron_command(state: dict) -> str | None: profile = state.get("profile") daily_fortune = state.get("daily_fortune") if not isinstance(profile, dict) or not isinstance(daily_fortune, dict): return None daily_time = daily_fortune.get("time") timezone = daily_fortune.get("timezone") or "Asia/Shanghai" lunar_birthday = profile.get("lunar_birthday") gender = profile.get("gender") if not daily_time or not lunar_birthday or not gender: return None if ":" not in daily_time: return None hour_text, minute_text = daily_time.split(":", 1) if not hour_text.isdigit() or not minute_text.isdigit(): return None hour = int(hour_text) minute = int(minute_text) if hour < 0 or hour > 23 or minute < 0 or minute > 59: return None birth_hour = profile.get("birth_hour") or "未提供" cron_expr = f"{minute} {hour} * * *" message = ( "请启用 king-wen-hexagrams 技能,为我生成今日运势。" f"命主资料如下:农历生日={lunar_birthday};性别={gender};出生时辰={birth_hour}。" "请结合今天的日期,起一卦看当日气机,只输出:今日卦势、气机偏向、宜、忌、一句收束。" "口吻保持庄重、简洁、克制,不要夸张渲染神秘。" ) return ( "openclaw cron add \\\n" ' --name "文王每日运势" \\\n' f' --cron "{cron_expr}" \\\n' f' --tz "{timezone}" \\\n' ' --session isolated \\\n' f' --message "{quote_message(message)}" \\\n' " --announce" ) ``` ### Technical Analysis The function generates a shell command containing values derived from user-controlled profile and scheduling fields. The custom `quote_message()` function escapes only backslashes and double quotation ma ...[truncated 1938 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/session_state.py:7
Finding

Personal Profile and Session Data Stored Without Explicit Owner-Only Permissions

Content
View full analysis
None: if hasattr(sys.stdout, "reconfigure"): sys.stdout.reconfigure(encoding="utf-8") def ensure_parent() -> None: STATE_PATH.parent.mkdir(parents=True, exist_ok=True) def read_state() -> dict: if not STATE_PATH.exists(): return {} return json.loads(STATE_PATH.read_text(encoding="utf-8")) def write_state(data: dict) -> None: ensure_parent() STATE_PATH.write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8") ``` The fields written by this function include profile and session information such as birthday, gender, birth hour, question summaries, hexagram state, daily execution time, and timezone. ### Technical Analysis `Path.write_text()` creates or overwrites a plaintext JSON file but does not explicitly enforce owner-only permissions. The resulting permissions depend on the operating system, parent-directory permissions, and process umask. In an environment with a permissive umask or shared home-directory configuration, other local users or processes may be able to read the file. The file may also retain existing permissive permissions when overwritten. No permission verification or correction is performed when reading or updating an existing state file. The stored information is not authentication material, but it contains personal profile information and potentially sensitive question history. Plaintext storage is not inherently invalid for local state, but explicit access controls are appropriate for this data. ### Attack Path 1. A user initializes a profile or records session details. 2. `write_state()` creates `~/.openclaw/king-wen-session.json` using en ...[truncated 843 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/postinstall_hint.py:13
Finding

Personal and Session Data Exposed in Installation and Initialization Logs

Content
View full analysis
None: configure_stdout() state = read_state() print("King Wen Hexagrams 已安装。") print() if has_profile(state): print("已检测到命主资料,你可以直接开始问卦或设置每日运势。") print("查看当前状态:python scripts/session_state.py --show") print("如需更新资料:python scripts/init_profile.py") print() print("当前已保存摘要:") print(json.dumps(state, ensure_ascii=False, indent=2)) return ``` From `scripts/init_profile.py`: ```python write_state(state) print() print("初始化完成,当前保存状态如下:") print(json.dumps(state, ensure_ascii=False, indent=2)) ``` The post-install script is registered as an npm lifecycle hook: ```json "scripts": { "postinstall": "python scripts/postinstall_hint.py", "init-profile": "python scripts/init_profile.py", "show-onboarding": "python scripts/postinstall_hint.py" } ``` ### Technical Analysis Both initialization and post-install paths print the complete persisted state as formatted JSON. Because `postinstall_hint.py` runs through the npm `postinstall` lifecycle, its output may be captured by package-manager logs, continuous-integration systems, deployment platforms, terminal recording software, or centralized logging services. The output is described as a summary, but it is not redacted or minimized. It can contain the complete profile, question summary, moving-line state, birthday, gender, birth hour, daily execution time, and timezone. This disclosure is unnecessary for the post-install hint function. The same information can be inspected intentionally through the separate `session_state.py --show` command. ### Attack Path 1. A user previously stores profil ...[truncated 1068 chars]
Remediation
View remediation
Vulnerability Patterns
  • 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
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (65)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

声明描述的是一个较完整的易经占卜/解读技能,核心应包括起卦后的解释与建议生成;而代码仅完成较底层的卦象查找、动爻翻转和变卦推导,输出为 JSON 数据结构。其主要功能更接近“卦象计算器/转换器”而非“解卦与咨询技能”。此外,声明提到首次登记命主资料、每日运势、定时追问等场景,但代码完全没有相关状态管理、时间逻辑或资料存储。虽然代码确实涉及六十四卦和起卦输入,和声明存在部分重叠,但整体能力范围明显比声明窄,且缺失最关键的解读类功能,因此属于描述与实际行为不匹配。

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

声明描述的是一个较完整的易经占卜/解卦技能,核心应包括根据用户问题起卦、生成卦象、解读卦义并给出建议,且覆盖多个交互场景。实际代码则只是一个离线数据查询脚本,读取本地 JSON 文件并根据 id 或名称等别名返回单条卦象记录,没有任何起卦、排卦、解释、用户资料管理、运势分析或追问调度逻辑。虽然“卦义查询”场景与基础信息检索略有相关,但代码能力远小于声明的主要目的,因此构成明显不匹配。

Content

No source excerpt is available for this finding.

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · scripts/init_profile.py (reported line 34)May include surrounding context.

python
def should_enable_daily_fortune(current_time: str | None = None) -> bool:
    return prompt_yes_no("是否同时设置每日运势时间?", default=bool(current_time))


def quote_message(raw: str) -> str:

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The natural-language entry states that on first enablement the flow will '默认优先询问' specific profile details, and the entire user-facing behavior described in this changelog is presented in Chinese with no indication that users can choose another language or locale. This suggests a language/locale default may be imposed without explicit user opt-in, which matches the policy category for locale/language violations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The natural-language content throughout the README is presented only in Chinese, including usage instructions, triggers, warnings, and installation guidance. Under the policy rule, forcing a specific language without user opt-in is a locale/language policy violation unless the constraint is explicitly justified or alternatives are offered.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
82% confidence
Finding

The skill advertises or references code-backed capabilities such as initialization scripts, asset generation, and local processing, but does not declare an explicit tool scope like allowed-tools or permissions. In agent environments, missing tool restrictions can cause the runtime to overgrant file read/write access, increasing the blast radius if prompts, linked docs, or future code paths trigger unintended filesystem operations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill instructs collection of personal profile data including lunar birth date, sex, and optionally birth time, which together can be sensitive profiling data, but provides no privacy notice, purpose limitation, retention rule, or handling constraints. In a conversational agent context, users may disclose this information without understanding where it is stored, who can access it, or whether it is reused across sessions.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The document directs collection and local storage of personal profile data including lunar birthday, gender, optional birth hour, preferred delivery time, and timezone, but provides no privacy notice, minimization guidance, retention limits, or access controls. In the context of a scheduled automation feature, this can lead to unnecessary persistence of sensitive personal data and accidental exposure through local files, logs, shell history, or shared environments.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

SQP-3 applies to all file types and covers language or locale policy violations. This JSON dataset embeds all user-facing interpretive text in Chinese only, but does not document that the skill is China/Chinese-language specific or that users can opt into this locale, which can force a specific language experience.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The guide instructs users to provide personal attributes such as lunar birthday, gender, and optionally birth hour to support ongoing readings, but it gives no privacy notice, purpose limitation, retention guidance, or warning about the sensitivity of this data. In a non-essential divination context, collecting profile data without transparent handling increases privacy risk and can normalize unnecessary disclosure of personal information.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The guide promotes daily scheduled readings tied to execution time and timezone without warning users that this creates a recurring automated action based on personal scheduling metadata. That can lead to unexpected persistence, repeated processing, and ongoing collection or use of behavioral/profile data without informed consent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

This markdown file presents its title and usage description only in Chinese, and there is no accompanying note that the skill is intentionally Chinese-only or that users may choose another language. Under the stated policy, 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
92% confidence
Finding

This markdown file contains user-facing natural-language guidance exclusively in Chinese, and there is no indication that the user can choose another language or that the skill is intentionally limited to a Chinese-speaking audience. Under the language/locale policy, forcing a specific language without user opt-in is a policy concern.

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 content appears to require Chinese as the only interaction language, and there is no indication that users may choose another language or that the skill is intentionally limited to a Chinese-only regional or compliance context. Under the language/locale policy, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown file presents all user-facing instructions and interpretations exclusively in Chinese, and nowhere indicates that the user can opt into another language or that the skill is intentionally limited to a Chinese-speaking audience. Under the policy, 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
96% confidence
Finding

This markdown file presents all user-facing instructions and guidance exclusively in Chinese, which constitutes a language/locale constraint. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation unless the locale restriction is explicitly justified, 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
90% confidence
Finding

This file is natural-language skill content, and all user-facing instructions and explanations are presented only in Chinese. The policy requires flagging language or locale constraints when the skill forces a specific language without user opt-in or clear justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The entire skill file is written in Chinese and provides no indication that users may request another language or locale. Under the policy rule for natural-language violations, this is a language-policy issue when a specific language is imposed without opt-in or documented justification.

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-facing guidance exclusively in Chinese, which can constitute a language/locale policy issue when no opt-in or alternative language choice is provided. The file does not state that it is intended only for a Chinese-speaking or region-specific context, so the language restriction is not clearly justified.

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 all user-facing natural-language guidance in Chinese, and there is no indication that users can opt into another language or that the skill is intentionally limited to a Chinese-speaking audience. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The onboarding flow asks users to provide sensitive personal profile data such as lunar birthday, gender, and optionally birth hour, and later references saving and viewing the current stored content, but it does not clearly disclose how this data is stored, retained, protected, or used. In a divination-style skill, users may be especially willing to share intimate details, so collecting profile data without an explicit privacy notice and consent language increases the risk of privacy harm and non-compliant data handling.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

All listed activation phrases are in Chinese, and the manifest does not indicate that language selection is optional or limited to a region-specific deployment. This creates a language-policy concern because the skill appears to require a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger phrase "帮我占一下" is broad, conversational, and likely to appear in ordinary user dialogue requesting general help with divination, which can cause the skill to activate unintentionally. In a workflow skill that may collect profile data or drive follow-up actions, accidental invocation can lead to confusing behavior, unwanted data handling, or unauthorized skill routing.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The user-facing prompts in input dialogs are written only in Chinese, and the affirmative parser also recognizes a Chinese-specific response. This enforces a specific language/locale experience without user opt-in, which matches the policy-violation category for language or locale restrictions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains user-facing natural-language strings in Chinese for the argument parser description, help messages, and error output. Because the skill does not offer a language/locale option or document that it is intentionally limited to Chinese users, it may violate the language/locale policy for natural-language behavior.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.