Back to skill

Security audit

积极心理学工具箱

Security checks for vulnerabilities and agentic risk

Overview

The skill is coherent as a Chinese positive-psychology assistant, but its bundled scripts persist sensitive emotional and personality data locally without clear opt-in, deletion, or protection controls.

Review before installing if the skill may be used on a shared, managed, backed-up, or indexed machine. The main instructions are not deceptive and no remote exfiltration was found, but the bundled scripts can leave sensitive mental-wellbeing records and assessment results in plaintext local files unless the user avoids those scripts or deletes the generated files.

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/emotion_tracker.py:20
Finding

Emotion records are stored in a predictable plaintext file with default permissions

Content
View full analysis

Vulnerability Details

File Location: scripts/emotion_tracker.py, lines 20-43
Vulnerability Type: Plaintext storage of sensitive psychological data
Risk Level: Medium

Vulnerable Code

python
DATA_FILE = "emotion_log.jsonl"


def get_data_path():
    script_dir = os.path.dirname(os.path.abspath(__file__))
    return os.path.join(script_dir, DATA_FILE)


def log_emotion(emotion, intensity, trigger="", body_feeling="", context=""):
    entry = {
        "timestamp": datetime.now().isoformat(),
        "date": datetime.now().strftime("%Y-%m-%d"),
        "emotion": emotion,
        "intensity": int(intensity),
        "trigger": trigger,
        "body_feeling": body_feeling,
        "context": context,
    }
    path = get_data_path()
    with open(path, "a", encoding="utf-8") as f:
        f.write(json.dumps(entry, ensure_ascii=False) + "\n")
    return entry

Technical Analysis

The tracker persistently records emotions, intensity levels, triggering events, bodily sensations, free-form context, and timestamps in scripts/emotion_log.jsonl. This information can constitute sensitive psychological and behavioral data.

The file is:

  • Stored at a predictable location inside the installed skill directory.
  • Written in unencrypted JSON Lines format.
  • Created using the process's default permission behavior rather than explicit owner-only permissions.
  • Retained indefinitely without configurable expiration or deletion controls.
  • Written without first obtaining explicit consent for persistent storage.

The effective permissions depend on the runtime environment and its umask. In a shared or permissively configured environment, another local account, service, backup process, indexing tool, or process with access to the project directory could read the accumulated records. Storing mutable user data inside the skill installation directory also mixes executable package conte ...[truncated 1633 chars]

Remediation
View remediation

Remediation Suggestions

  1. Make persistent storage opt-in and obtain explicit user consent before saving emotion records.
  2. Default to memory-only processing where long-term retention is not required.
  3. Store runtime data in a dedicated per-user application-data directory rather than inside the skill installation directory.
  4. Create the data file with owner-only permissions, such as mode 0600, using a secure file-opening method that does not depend solely on the ambient umask.
  5. Verify and correct the permissions of existing files before appending data.
  6. Consider authenticated encryption at rest when the threat model includes administrators, backups, or filesystem compromise. Encryption keys must be managed separately from the data file.
  7. Add configurable retention periods, record-level deletion, complete-history deletion, and export controls.
  8. Minimize collection of free-form trigger, body-sensation, and context information unless it is necessary for the requested functionality.
  9. Clearly disclose the storage location, retained fields, retention period, and deletion procedure to the user.
  10. Handle malformed or partially written records safely without exposing their contents through diagnostic output.

T09 · Insecure Skill Coding Practices

Note
Location
scripts/via_survey.py:277
Finding

VIA personality assessment results are automatically saved in plaintext

Content
View full analysis

Vulnerability Details

File Location: scripts/via_survey.py, lines 277-289 and 304-305
Vulnerability Type: Automatic plaintext persistence of personality-profile data
Risk Level: Low

Vulnerable Code

python
def save_result(results):
    from datetime import datetime
    script_dir = os.path.dirname(os.path.abspath(__file__))
    path = os.path.join(script_dir, "via_result.json")
    data = {
        "date": datetime.now().strftime("%Y-%m-%d"),
        "timestamp": datetime.now().isoformat(),
        "results": results,
    }
    with open(path, "w", encoding="utf-8") as f:
        json.dump(data, f, ensure_ascii=False, indent=2)
    return path
python
path = save_result(results)
print(f"\n  结果已保存到:{path}")

Technical Analysis

After completing the assessment, the script automatically invokes save_result and stores the full ranked personality-strength profile in scripts/via_result.json. The user is informed only after persistence has occurred and is not offered a choice to decline storage.

The result file is:

  • Stored at a predictable location.
  • Written in plaintext JSON.
  • Created with permissions determined by the runtime environment and its umask.
  • Located inside the skill installation directory rather than a private user-data directory.
  • Overwritten on each assessment without retention, deletion, or history-management controls.

Personality-strength results are less sensitive than detailed clinical records, but they still represent personal psychological profile information. In a shared installation or permissive filesystem environment, another local user or process may be able to read the file.

This finding does not provide code execution, privilege escalation, or remote compromise. Exploitation requires existing local or service-level read access to the generated file.

Attack Path

  1. A user completes the VIA assessment.
  2. The main ...[truncated 986 chars]
Remediation
View remediation

Remediation Suggestions

  1. Ask the user whether the result should be saved before writing it to disk.
  2. Make saving opt-in through an explicit command-line option such as --save.
  3. Store results in a dedicated private per-user application-data directory instead of the skill installation directory.
  4. Create the file with owner-only permissions, such as mode 0600, and verify permissions when replacing an existing file.
  5. Use atomic replacement to avoid partial or corrupted assessment files.
  6. Provide commands to view, export, and permanently delete stored assessment data.
  7. Document what is stored, where it is stored, and how long it is retained.
  8. Consider encryption at rest if results must be retained in a shared or centrally managed environment.
  9. Allow users to generate and display a report without creating any persistent file.
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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 (13)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill instructs the agent to read multiple local reference files, which implies file-read capability, yet it does not declare any explicit tool scope or permissions boundary. This can lead to over-privileged execution or ambiguous sandbox behavior, increasing the risk that the agent reads unintended files if the runtime grants broader file access than expected.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trigger conditions are very broad, including generic emotional-support and self-growth phrases that may appear in many ordinary conversations. This can cause unintended invocation in sensitive contexts, especially mental-health-adjacent discussions, leading the skill to steer conversations without clear user intent or appropriate triage.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The section title and framing explicitly target '中国用户' and present guidance as the default user context. Under the policy, locale-specific guidance should either offer user choice or clearly justify the constraint as region-specific; this file does not provide that opt-in framing.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This file provides self-guided mental-health exercises and only briefly cautions against recommending high-effort exercises during low mood, but it does not clearly instruct users to seek urgent professional help during severe distress, suicidality, or crisis states. In a psychology-support skill, that omission can lead vulnerable users to rely on journaling, reframing, or mindfulness when escalation to crisis resources or licensed care is more appropriate.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The script writes highly sensitive mental-health journaling data, including emotions, triggers, body sensations, timestamps, and context, to a local JSONL file without any user-facing notice, consent flow, retention controls, or protection measures. In the context of a positive-psychology skill, this data is especially privacy-sensitive because disclosure could reveal intimate emotional state and behavioral patterns to other local users, backups, or endpoint monitoring tools.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script automatically saves a user's VIA self-assessment results, date, and timestamp to a local JSON file without making persistence an explicit user choice. Because psychological self-assessment data can be sensitive, default storage creates unnecessary privacy risk, especially on shared devices or environments where other users or processes can read local files.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The code stores sensitive self-assessment output even though persistence is not necessary to perform the stated conversational assessment and reporting function. This data collection/storage mismatch increases privacy exposure without a clear functional need, which is especially concerning in a mental-wellbeing context where users may reasonably expect ephemeral handling.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The program writes potentially sensitive psychological assessment results to disk without prior warning or informed consent. Users are not told that their answers will be persisted locally, so they cannot make an informed decision about privacy, which can lead to unintended disclosure on shared systems or managed endpoints.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

文档写明“结合中国文化语境”,并在后文提供中文情绪词库和中国本地热线资源,但没有说明这是可选适配,也未给用户语言或地区上的选择空间。对于通用技能,这会形成默认语言/locale 偏向,属于自然语言层面的 locale policy 风险。

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

The file title, instructions, and example prompts are entirely in Chinese, which effectively forces a specific language for users of the skill. The policy allows locale constraints only when they are opt-in or clearly justified, neither of which is stated here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file presents all instructional content, prompts, and guidance exclusively in Chinese. Under the policy rule for language/locale constraints, forcing a single language without user opt-in can be a natural-language policy violation unless the regional limitation is explicitly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

Natural-language strings in the docstring, usage help, and report output are Chinese-only, which effectively forces a language choice on users. The file does not indicate that this is intentionally region-specific or provide any user opt-in or alternative locale.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
88% confidence
Finding

Natural-language text throughout the docstring, prompts, help text, and output is exclusively in Chinese. Under the policy, forcing a specific language without user opt-in can be a locale/language policy violation when no alternative or explicit justification is provided.

Content

No source excerpt is available for this finding.