Back to skill

Security audit

Fu Mu Gong Ke

Security checks for vulnerabilities and agentic risk

Overview

This parenting psychology skill is mostly coherent, but it needs review because several scripts can retain sensitive family and emotional data locally without consistent opt-in disclosure.

Review before installing. The skill does not show exfiltration or destructive behavior, but it is used for sensitive parenting and emotional-health conversations and some helper scripts can write plaintext local records. Only enable or run the Python helpers if you are comfortable with local retention under the skill's data directory, and avoid storing identifiable crisis, child, or family details unless you have a clear deletion and privacy process.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/system_integrator.py:211
Finding

Path Traversal Through Unvalidated Session Identifiers

Content
View full analysis

Vulnerability Details

File Location: scripts/system_integrator.py:211-228 and scripts/system_integrator.py:784-804
Vulnerability Type: Path traversal in local state save/load operations
Risk Level: Medium

Vulnerable Code

python
def save(self, path=None):
    save_path = path or (DATA_DIR / f"state_{self.session_id}.json")
    try:
        with open(save_path, "w", encoding="utf-8") as fh:
            fh.write(json.dumps(self.to_dict(), ensure_ascii=False, indent=2))

@classmethod
def load(cls, session_id, path=None):
    load_path = path or (DATA_DIR / f"state_{session_id}.json")
    if not Path(load_path).exists():
        return cls(session_id=session_id)
    try:
        with open(load_path, "r", encoding="utf-8") as fh:
            data = json.loads(fh.read())

The same issue exists in StateManager:

python
def save(self, path=None):
    save_path = path or (DATA_DIR / f"state_manager_{self.session_id}.json")
    try:
        data = {
            "session_id": self.session_id,
            "conversation_state": self.conversation_state.to_dict(),
            "mode_transitions": self.mode_transitions[-20:],
        }
        with open(save_path, "w", encoding="utf-8") as fh:
            fh.write(json.dumps(data, ensure_ascii=False, indent=2))

def load(self, path=None):
    load_path = path or (DATA_DIR / f"state_manager_{self.session_id}.json")
    if not Path(load_path).exists():
        return
    try:
        with open(load_path, "r", encoding="utf-8") as fh:
            data = json.loads(fh.read())

Technical Analysis

The session_id value is interpolated directly into a filesystem path without validation, canonicalization, or containment checking. Path separators and parent-directory components are therefore accepted.

The fixed state_ and state_manager_ prefixes make exploitation conditional: the first prefixed directory ...[truncated 1994 chars]

Remediation
View remediation

Remediation Suggestions

  1. Restrict session identifiers to a conservative allowlist:
python
import re

SESSION_ID_PATTERN = re.compile(r"^[A-Za-z0-9_-]{1,64}$")

def validate_session_id(session_id: str) -> str:
    if not SESSION_ID_PATTERN.fullmatch(session_id):
        raise ValueError("Invalid session identifier")
    return session_id
  1. Resolve every generated path and verify containment:
python
def state_path(prefix: str, session_id: str) -> Path:
    safe_id = validate_session_id(session_id)
    base = DATA_DIR.resolve()
    candidate = (base / f"{prefix}{safe_id}.json").resolve()
    if candidate.parent != base:
        raise ValueError("State path escapes the data directory")
    return candidate
  1. Reject all path separators, absolute paths, null bytes, and . or .. components.
  2. Do not allow externally supplied path arguments in untrusted interfaces. If custom paths are required, apply the same containment check.
  3. Use atomic writes through a securely created temporary file in DATA_DIR, followed by os.replace.
  4. Add regression tests for identifiers containing /, \, .., absolute paths, Unicode separator variants, and excessively long values.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/heartflow_defense_upgrade.py:1661
Finding

Undeclared Persistence Bypasses the Documented Opt-In Control

Content
View full analysis

Vulnerability Details

File Location: scripts/heartflow_defense_upgrade.py:1278-1285, scripts/heartflow_defense_upgrade.py:1376-1391, scripts/heartflow_defense_upgrade.py:1661-1667; scripts/system_integrator.py:25-26, scripts/system_integrator.py:211-215, and scripts/system_integrator.py:784-793; declaration at SKILL.md:845-849
Vulnerability Type: Unexpected plaintext persistence and incomplete consent enforcement
Risk Level: Medium

Vulnerable Code

The defense engine assigns a persistence path by default, even when the caller does not request persistence:

python
def __init__(self, persist_path: Optional[str] = None):
    self.self_deception = DetectSelfDeception()
    self.pattern_detector = PatternDetector()
    self.q_learning = QLearningSelfHealing(
        persist_path=persist_path or str(
            Path(__file__).parent.parent / "data" / "defense_q_table.json"
        )
    )
    self.version = __version__

Learning results are then written whenever a persistence path is configured:

python
if self.persist_path:
    self._save()
python
def _save(self):
    if not self.persist_path:
        return
    try:
        path = Path(self.persist_path)
        path.parent.mkdir(parents=True, exist_ok=True)
        data = {
            "Q": self.Q,
            "history": [
                asdict(r) for r in self.history[-100:]
            ],
            "version": __version__,
            "timestamp": time.time(),
        }
        with open(path, "w", encoding="utf-8") as f:
            json.dump(data, f, ensure_ascii=False, indent=2)

The integration module also performs filesystem operations without checking the documented ALLOW_FILE_PERSISTENCE control:

python
SKILL_DIR = Path(__file__).parent.parent
DATA_DIR = SKILL_DIR / "data"
DATA_DIR.mkdir(parents=True, exist_ok=True)
python
save_path = path or
...[truncated 3338 chars]
Remediation
View remediation

Remediation Suggestions

  1. Make persistence disabled by default:
python
def __init__(self, persist_path: Optional[str] = None):
    self.self_deception = DetectSelfDeception()
    self.pattern_detector = PatternDetector()
    self.q_learning = QLearningSelfHealing(persist_path=persist_path)
  1. Centralize consent enforcement for every filesystem write:
python
import os

def persistence_enabled() -> bool:
    return os.environ.get("ALLOW_FILE_PERSISTENCE") == "1"

Require this check in the defense engine, ConversationState, StateManager, assessment tools, insight capture, visualization, and action planning.

  1. Do not create DATA_DIR at import time. Create it only immediately before an explicitly authorized write.
  2. Require an explicit application-level option in addition to the environment variable for sensitive state retention.
  3. Store only the minimum necessary fields. Avoid retaining crisis or psychological classifications unless essential.
  4. Apply restrictive permissions, such as directory mode 0700 and file mode 0600, where supported.
  5. Use atomic writes, validate file ownership, and reject symbolic links before replacement.
  6. Define and implement retention limits, secure deletion, user export, and user-requested erasure.
  7. Correct SKILL.md so every write-capable module, data type, destination, trigger, and consent requirement is accurately disclosed.
  8. Add tests proving that no directory or file is created when persistence consent is absent.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (141)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The Chinese description repeats detailed assurances about structured support, emotion recognition, scenario matching, safety checks, and local-only storage, while the reported implementation is materially narrower. In a psychological support context, this mismatch can create false trust, delayed escalation, and unsafe reliance during sensitive or crisis situations.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The Chinese description repeats detailed assurances about structured support, emotion recognition, scenario matching, safety checks, and local-only storage, while the reported implementation is materially narrower. In a psychological support context, this mismatch can create false trust, delayed escalation, and unsafe reliance during sensitive or crisis situations.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The document records a serious mismatch between the skill's stated behavior and its actual behavior: users are told there is no file writing or persistence, while scripts reportedly store user-related data under ~/.hermes/still_growing/. In a parenting and psychological support context, this is especially dangerous because users may disclose sensitive emotional, family, and child-related information under a false expectation of ephemerality and privacy.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The audit notes that crisis cases are supposed to stop normal analysis, but self-harm or suicide conversations may continue in analytic mode. In a mental-health-adjacent parenting support skill, this can delay escalation to crisis resources, produce unsafe advice, or give the appearance of therapeutic handling beyond the tool's safety boundary.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

These entries address child self-harm and suicidal statements with suggested phrasing, but they do not clearly instruct the agent or end user to immediately seek urgent professional, crisis, or emergency support instead of relying on the wording alone. In a parenting mental-health support skill, omission of explicit escalation guidance can delay lifesaving intervention and create unsafe overreliance on conversational support.

Content

No source excerpt is available for this finding.

YARA rule 'exploit_framework': Exploit framework components and payloads [hacktools]

High
Category
YARA Match
Confidence
80% confidence
Finding

YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Content

Scanner excerpt · scripts/test_reasoning_engine.py (reported line 153)May include surrounding context.

python
self.assessor.assess("我很焦虑", crisis)
        self.assertEqual(result.level, EmotionLevel.BLACK)

    def test_response_depth_mapping(self):
        result = self.assessor.assess("崩溃了")
        self.assertEqual(result.response_depth, ResponseDepth.CRISIS)


class TestScenarioMatcher(unittest.TestCase):
    def setUp(self):
        self.matcher = ScenarioMatcher()

    def test_score_drop(self):
        result = self.matcher.match("孩子成绩下降了,考试不及格")
        self.assertIsNotNone(result)
        self.assertEqual(result.name, "孩子成绩下降")

    def test_school_refusal(self):
        result = self.matcher.match("孩子不想去学校,厌学")
        self.assertIsNotNone(result)
        self.assertEqual(result.name, "孩子不想上学")

    def test_phone_addiction(self):
        result = self.matcher.match("孩子沉迷游戏,天天玩手机")
        self.assertIsNotNone(result)
        self.assertEqual(result.name, "孩子沉迷手机游

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The changelog describes a maintenance script that can automatically check for changes, commit, push, and publish, which are actions that may modify repository state and transmit data to remote services. Even though environment variables are mentioned, the documentation excerpt does not clearly warn users about the consequences, review requirements, or the risk of accidentally exfiltrating sensitive repository content.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The changelog notes a new insight capture mechanism with file persistence controls, implying that user-derived insights may be written to disk. In a parenting/psychological support skill, those insights can contain highly sensitive personal or family information, so undocumented or weakly disclosed persistence creates a privacy and consent risk.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The changelog describes automatic capture of effective conversation insights, effectiveness tracking, candidate libraries, and periodic review reports, all of which strongly imply retention of user conversation content or derived summaries. In a mental-health-adjacent parenting skill, retained conversation data may include intimate family dynamics, child behavior, crisis details, or health-related disclosures, making the privacy risk materially higher than in ordinary applications.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This changelog entry explicitly states that parent/child emotions, interaction types, and triggers are tracked and stored locally in a JSON file. Such records are highly sensitive behavioral and psychological data about families and children; if stored insecurely or without clear consent, they can expose private household patterns, emotional states, and potentially crisis-related information.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The goal-tracking entry indicates persistence of family education goals, milestones, and progress records. Although less acute than crisis dialogue logs, these records still reveal private family circumstances, parenting concerns, and child-development issues, so persistent storage without strong privacy controls creates a genuine sensitive-data retention risk.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The document is written entirely in Chinese and presents mandatory processing rules for the AI ('必须按以下 6 层顺序依次执行'), implying the skill operates in Chinese by default. There is no indication that users may choose another language or that the Chinese-only constraint is a justified region-specific requirement.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill content is entirely in Chinese and does not offer a user language choice or document a clear locale restriction, which can exclude or mislead users who expect multilingual support. In a mental-health-adjacent parenting skill, language mismatch can materially degrade comprehension of crisis guidance, safety boundaries, and referral instructions.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill advertises optional scripts with file persistence and environment-gated behavior, but the manifest does not declare explicit tool scope or allowed permissions. In agent environments, undeclared file/env capabilities weaken least-privilege controls and can let a seemingly content-only skill access local files or persistence features unexpectedly.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The description and all user-facing instructions are presented exclusively in Chinese, and the file does not offer multilingual support or ask the user for preferred language. Because the policy requires avoiding forced language or locale constraints without opt-in or justification, this is a natural-language policy issue.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The markdown enumerates broad phrases such as “帮帮我”, “我不知道怎么办”, and “我崩溃了” as trigger-like signals for the skill. These expressions are common across many unrelated conversations, so without clearer scope limits or exclusion examples they could cause unintended invocation outside the parenting-psychology context.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This section explicitly targets distressed minors, including users expressing self-harm risk or desire to run away, but the surrounding guidance mostly emphasizes conversational validation and self-protection advice without consistently foregrounding urgent escalation to trusted adults, crisis resources, or emergency services. In a mental-health support skill, that omission can normalize continued chat-based handling of situations that may require immediate real-world intervention, increasing the chance of delayed help during a crisis.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The entire skill guidance 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-language or region-specific context. Under the 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
85% confidence
Finding

该审计文档全文以中文撰写,未见提供其他语言选项、用户选择机制,或说明该技能/流程为何必须限定为中文。按照语言/地区策略,若无用户选择或明确合理依据,强制单一语言属于自然语言层面的政策风险。

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The file describes a contradiction between a no-network declaration and documentation referencing OpenAlex API usage. Even if only documentary, this discrepancy creates an integrity and privacy risk because users and reviewers cannot reliably determine whether external transmission of sensitive conversation content may occur.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file presents all operational guidance, warnings, and examples only in Chinese. Under the stated policy, forcing a specific language without user opt-in or documented justification 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
93% confidence
Finding

The document is written entirely in Chinese and describes the skill and integration behavior as if Chinese-language inputs, keywords, and operation are assumed by default. There is no indication that users may opt into another language or that the locale restriction is explicitly justified as a region-specific tool, which fits the language/locale policy violation category.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This document guides emotionally sensitive parent-child conversations and includes probing prompts that can surface trauma, abuse dynamics, shame, or acute distress. Although it contains some internal exclusions for crisis scenarios, it lacks a clear, prominent user-facing boundary that the content is not appropriate for crisis, abuse, self-harm, or imminent safety situations and does not consistently direct users to emergency or professional support at the point of use.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The entire skill is written in Chinese and presents all guidance, labels, and scripts exclusively in that language. There is no indication that the skill is region-specific, no user opt-in for Chinese, and no alternative language path, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.