Back to skill

Security audit

以史为鉴

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent for Chinese-history decision analysis, but it needs review because its persistent case library is under-guarded and its CLI can write outside the stated data file.

Install only if you are comfortable with a Chinese-language decision-analysis skill that can persist new historical cases locally. Review any added cases before reuse, avoid storing sensitive or instruction-like text in the case library, and do not pass custom --user-cases-path values unless you intentionally want to write that specific JSON file.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • 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
  • 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 (2)

T02 · Agent Memory Poisoning

Warning
Location
src/case_store.py:183
Finding

Persistent prompt injection through the user-maintained case library

Content
View full analysis
dict: normalized = self.normalize_case(case) existing_cases = self.load_all_cases() existing_ids = {item["id"] for item in existing_cases} if normalized["id"] in existing_ids: raise CaseValidationError(f"案例 id 已存在: {normalized['id']}") user_cases = self.load_user_cases() user_cases.append(normalized) self.user_cases_path.write_text( json.dumps(user_cases, ensure_ascii=False, indent=2) + "\n", encoding="utf-8", ) return normalized ``` `src/retriever.py:20-23` automatically loads the persistent records: ```python def __init__(self, cases_path: Path, user_cases_path: Path | None = None) -> None: self.cases_path = cases_path self.user_cases_path = user_cases_path ...[truncated 3217 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
src/main.py:34
Finding

Arbitrary output path permits writes outside the documented Skill data directory

Content
View full analysis
None: if not self.user_cases_path.exists(): self.user_cases_path.write_text("[]\n", encoding="utf-8") ``` `src/case_store.py:130-142` subsequently rewrites the selected file: ```python def add_case(self, case: dict) -> dict: normalized = self.normalize_case(case) existing_cases = self.load_all_cases() existing_ids = {item["id" ...[truncated 2909 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (47)

Vague Triggers

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The trigger conditions are intentionally expansive, including vague phrases like general decision questions, strategy, internal conflict, and even cases where history is not mentioned. This can cause the skill to activate for broad classes of ordinary conversations, leading to over-application of its framing and possible misrouting away from more appropriate domain-specific skills or neutral handling.

Content

No source excerpt is available for this finding.

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
89% confidence
Finding

The explicit merge of os.environ into the subprocess environment exposes all inherited environment variables to src/main.py during verification. In this repository context, the verifier is intended to run before the skill is trusted, so handing full environment access to project code can leak secrets such as CI tokens, cloud credentials, or API keys.

Content

Scanner excerpt · scripts/verify_install.py (reported line 49)May include surrounding context.

python
text=True,
        encoding="utf-8",
        errors="replace",
        env={**os.environ, "PYTHONIOENCODING": "utf-8"},
        check=False,
    )
    if result.returncode != 0:

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
89% confidence
Finding

This second subprocess repeats the same full-environment exposure pattern for another invocation of the untrusted local entrypoint. Even though the arguments are fixed, the child process still receives all parent secrets and can access them, so the risk remains high in automated install or CI environments.

Content

Scanner excerpt · scripts/verify_install.py (reported line 66)May include surrounding context.

python
text=True,
        encoding="utf-8",
        errors="replace",
        env={**os.environ, "PYTHONIOENCODING": "utf-8"},
        check=False,
    )
    if template_result.returncode != 0:

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · tests/test_cli.py (reported line 28)May include surrounding context.

python
text=True,
            encoding="utf-8",
            errors="replace",
            env={**os.environ, "PYTHONIOENCODING": "utf-8"},
            check=False,
        )
        self.assertEqual(result.returncode, 0, msg=result.stderr)

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · tests/test_cli.py (reported line 54)May include surrounding context.

python
text=True,
            encoding="utf-8",
            errors="replace",
            env={**os.environ, "PYTHONIOENCODING": "utf-8"},
            check=False,
        )
        self.assertEqual(result.returncode, 0, msg=result.stderr)

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
60% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · tests/test_cli.py (reported line 101)May include surrounding context.

python
text=True,
            encoding="utf-8",
            errors="replace",
            env={**os.environ, "PYTHONIOENCODING": "utf-8"},
            check=False,
        )
        self.assertEqual(result.returncode, 0, msg=result.stderr)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The README explicitly encourages the host agent to transform user natural-language input into structured data and write it into a persistent local case library, but it does not warn that this operation mutates local state or persists potentially sensitive user content. In an agent setting, silent persistence can create privacy, integrity, and prompt/data-poisoning risks because future analyses may rely on attacker- or user-supplied entries that were saved without clear confirmation and provenance controls.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The metadata explicitly sets the language to zh-CN and uses zh-CN locale tags, but the file does not state that this is optional or limited to a justified region-specific use case. This can violate language/locale policy when the skill is invoked for users who did not opt into Chinese output.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This JSON dataset stores all titles, summaries, tags, principles, and keywords exclusively in Chinese, which creates a de facto language constraint for any skill consuming it. Because there is no indication in the file that the Chinese-only locale is intentional, optional, or region-specific, this can violate a language/locale policy requiring user choice 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 the skill example, inputs, and expected outputs only in Chinese. Under the policy rule for language or locale violations, forcing a specific language without user opt-in is a natural-language policy concern unless the locale constraint is explicitly justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill explicitly frames an organizational conflict as a 'power control game' and recommends tactics modeled on coups and forced consolidation ('高平陵政变、玄武门之变、杯酒释兵权') without any safety framing, ethical boundaries, or de-escalation guidance. That can normalize manipulative or coercive real-world conduct in workplaces and encourage abuse of authority, retaliation, or unlawful internal power grabs.

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 contains user-facing instructional content entirely in Chinese and does not indicate that language selection is optional or constrained for a documented regional purpose. 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.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill explicitly directs the agent to persist user-provided content into a local JSON file, but it does not require any user confirmation, warning, or guardrails around modifying durable local state. Persistent writes are security-relevant because they can be abused for unwanted data insertion, poisoning of future retrieval results, or storage of sensitive or malicious content that affects later runs.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The manifest description defines activation conditions far beyond the narrowly named Chinese-history sandbox, extending to generic organization, business, team strategy, leadership replacement, competitive timing, and alliance questions. This can cause the skill to trigger in many normal strategic conversations and inject its framing or instructions where the user did not explicitly request a historical-analogy tool, increasing the chance of prompt-scope hijacking or unintended influence over sensitive decision-making.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The manifest sets the language to 'zh-CN', which can indicate a fixed locale requirement, but the file does not state that this is optional, user-selected, or justified as region-specific. Under the policy, forcing a specific language or locale without opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The prompt explicitly directs the agent to write data into the local repository via a script, but it does not require an explicit user confirmation that a persistent write will occur or any safety checks on the content being stored. In an agent setting, this can cause unintended modification of local state or repository contents from ambiguous or lightly specified user requests, increasing the risk of unauthorized persistence and workflow abuse.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file's operational instructions, trigger guidance, and output requirements are entirely in Chinese, which imposes a language constraint on use of the skill. The policy allows locale constraints only when users are given a choice or when the limitation is explicitly justified, neither of which appears here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file's natural-language instructions exclusively require Chinese-language operation and refer specifically to selecting Chinese historical cases, but it does not state that this locale/language constraint is optional or user-selected. Under the policy, forcing a specific language without opt-in is a natural-language policy violation unless clearly justified and documented as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill content is written entirely in Chinese and prescriptively instructs the agent how to respond, without any mechanism to respect or adapt to the user's preferred language. In a multi-language agent environment, this can cause unauthorized language switching, reduce user comprehension, and make it easier for hidden instructions to bypass normal user expectations or review.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill prompt is written entirely in Chinese and provides no language selection or opt-in, which can cause users or upstream agents to misunderstand constraints, outputs, or decision-path guidance. In a decision-synthesis skill, this creates a meaningful safety and reliability risk because incorrect interpretation can lead to poor or unintended strategic advice being produced or acted upon.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

This code hard-requires Chinese strings in SKILL.md and emits user-facing validation errors only in Chinese, including mandatory description markers such as '请用/使用/调用' and '以史为鉴'. That enforces a specific language/locale policy on the skill metadata without any visible opt-in or documented region-specific justification in this file.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/verify_install.py (reported line 38)May include surrounding context.

python
print("skill.json 中的 slug 不正确。", file=sys.stderr)
        return 1

    result = subprocess.run(
        [
            sys.executable,
            str(repo_root / "src" / "main.py"),

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The script launches untrusted or at least not-yet-verified project code while passing through the full parent environment via os.environ. If sensitive tokens, API keys, or CI secrets are present, the invoked program can read and exfiltrate them during the verification step, making this materially more dangerous in a skill-install context where code is being assessed before trust is established.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/verify_install.py (reported line 56)May include surrounding context.

python
print(result.stderr, file=sys.stderr)
        return result.returncode

    template_result = subprocess.run(
        [
            sys.executable,
            str(repo_root / "src" / "main.py"),

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The description defines activation triggers so broadly that the skill may be invoked for generic business, team, and strategy questions rather than only for explicit historical-analogy requests. In an agent setting, overbroad routing can hijack normal decision-support conversations, causing the model to apply this skill outside user intent and potentially bias outputs with inappropriate historical analogies.

Content

No source excerpt is available for this finding.