Back to skill

Security audit

magic-mirror

Security checks for vulnerabilities and agentic risk

Overview

This self-reflection skill is coherent in purpose, but it directs agents to persist detailed personal life history without clear user consent or safeguards.

Review this skill before installing if you expect private or sensitive reflection. It may save detailed life events, names, places, emotions, and session summaries across sessions in local plaintext files, and it does not define consent, retention, deletion, encryption, or per-user isolation. Use only in an environment where those files are protected, and avoid sharing details you would not want stored or resurfaced later.

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/generate_summary.sh:18
Finding
Arbitrary File Overwrite Through Unsanitized Output Path<![CDATA[ ## Vulnerability Details **File Location**: `scripts/generate_summary.sh`, lines 18-28 and 44 **Vulnerability Type**: Path traversal and arbitrary file overwrite **Risk Level**: Medium ### Complete Vulnerable Code ```bash OUTPUT_DIR="${2:-reflections}" if [ -z "$LABEL" ]; then echo "Usage: bash generate_summary.sh <session-label> [output-dir]" echo "Example: bash generate_summary.sh '2025-06-15-first-session'" exit 1 fi mkdir -p "$OUTPUT_DIR" OUTPUT_FILE="${OUTPUT_DIR}/${LABEL}.md" ``` The resulting path is later opened with truncating redirection: ```bash cat > "$OUTPUT_FILE" << EOFSYNOPSIS # 魔镜 Reflection: ${LABEL} **Date:** $(date '+%Y-%m-%d %H:%M') **Session Label:** ${LABEL} ``` ### Technical Analysis The script directly incorporates the attacker-controllable `LABEL` argument into `OUTPUT_FILE` without validating that it is a simple filename. A label can contain directory separators or traversal components such as `../`. The shell quoting prevents command injection, but it does not prevent filesystem path traversal. The `>` operator creates the selected file or truncates it if it already exists. It also follows symbolic links. Consequently, the script can overwrite any `.md` path writable by the account running it, provided the supplied traversal path resolves to that destination. The independently supplied `OUTPUT_DIR` also allows the caller to select a destination directory. Although that behavior is documented, combining it with an unrestricted label and unconditional truncation increases the risk of unintended file modification. ### Attack Path 1. An attacker gains control over, or persuades a user or automation process to use, the script's `session-label` argument. 2. The attacker supplies a traversal label, for example: ```bash bash scripts/generate_summary.sh "../../project/README" ``` 3. The script constructs a path equivalent to: ```text reflections/../../project/README.md ``` 4. `cat > "$OU ...[truncated 822 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Restrict `LABEL` to a safe basename: ```bash if [[ ! "$LABEL" =~ ^[A-Za-z0-9][A-Za-z0-9._-]{0,127}$ ]] || [[ "$LABEL" == *".."* ]]; then echo "Invalid session label" >&2 exit 1 fi ``` 2. Explicitly reject `/`, `\`, control characters, and traversal components. 3. Canonicalize the output directory and candidate parent path, then verify that the destination remains beneath the approved output directory. 4. Refuse to overwrite existing files unless the caller supplies a deliberate overwrite option: ```bash set -o noclobber : > "$OUTPUT_FILE" || { echo "Output file already exists" >&2 exit 1 } ``` 5. Check for symbolic links before writing, and use a safe file-creation mechanism that does not follow links where supported. 6. If arbitrary output directories are unnecessary, remove the second argument and use a fixed, application-controlled directory. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:73
Finding
Persistent Plaintext Storage of Sensitive Autobiographical Data Without Defined Safeguards<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 73-78 and 128; `references/timeline-schema.json`, lines 2-4 and 26-32 **Vulnerability Type**: Insecure storage and retention of sensitive personal data **Risk Level**: Medium ### Complete Vulnerable Code `SKILL.md` directs the Agent to identify returning users and retain detailed information: ```markdown 回访会话:基于 timeline,使用 sender id 识别用户。"上次你讲到XXXX——那之后怎么样了?" 三句话之内完成。每句都是邀请,不是问题。 ### Stage 2: 时光回溯 — 跟随+采样 采样:对方提到时间+事件时默默记录;一段讲完后轻轻确认模糊时间。 记录:保留用户原文情绪和用词,包括涉及人物和场所。 ``` It also defines persistent storage across sessions: ```markdown ### 生命周期 会话开始 → 读取 timeline.json → 对话中维护 working copy → 会话结束写入 ``` `references/timeline-schema.json` requests full narrative, people, places, and emotional information: ```json { "$description": "魔镜时间线记录模板 — AI 内部格式。不在对话中展示给用户。", "$version": "v2", "$instructions": "记录对话中用户提及的生命故事、关键事件、人物和场所。story 字段保留叙事的完整性,不压缩.", "entries": [ ``` The schema includes directly sensitive fields: ```json "people": [ "事件中涉及的重要人物名 + (角色/关系),如'领导(未挽留)'" ], "places": [ "事件发生的重要场所,如'办公室'、'楼下便利店'" ], "mood": ["用户在对话中流露的情绪标签,如'低落','解脱'"], ``` ### Technical Analysis The Skill is designed to collect and persist detailed autobiographical narratives across sessions. The stored model can include: - Verbatim or near-verbatim life stories. - Names and relationships of third parties. - Places associated with personal events. - Emotional states and inferred behavioral patterns. - Session summaries and cross-session conversational anchors. The project stores this state in `timeline.json`, an ordinary JSON file. No encryption, restrictive file-permission procedure, retention period, deletion workflow, redaction policy, or per-user isolation mechanism is defined. The instructions also characterize the record as internal and not shown to the user, while directing the Agent to associate returning sessions through sender identity. The cu ...[truncated 1709 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Obtain explicit, informed user consent before enabling persistent timeline storage. 2. Clearly disclose what fields will be retained, why they are needed, and how long they will remain. 3. Default to data minimization: - Do not preserve complete narratives or verbatim wording unless specifically requested. - Replace names and precise locations with pseudonyms or generalized descriptions. - Avoid storing third-party information unless necessary. 4. Add user-accessible controls to inspect, correct, export, and delete stored information. 5. Define a short retention period and automatically remove expired entries. 6. Store separate records per authenticated user and prevent sender identifiers from being the sole authorization mechanism. 7. Apply restrictive file permissions at creation, such as owner-only read and write access. 8. Encrypt sensitive records at rest where the host environment supports secure key management. 9. Exclude populated timeline files from source control, shared artifacts, logs, and unencrypted backups. 10. Document failure behavior so that the Agent does not persist data when secure storage or reliable user separation is unavailable. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (15)

Vague Triggers

Medium
Confidence
95% confidence
Finding
The description uses broad, everyday phrases like self-reflection, life decisions, and introspective conversations, which can cause the skill to activate in many normal chats. Unintended activation is risky here because the skill is designed to elicit sensitive personal disclosures and maintain session history, so accidental use can increase privacy exposure.

Natural-Language Policy Violations

Medium
Confidence
87% confidence
Finding
Much of the operational guidance and prescribed interaction language is written as Chinese-first phrasing, including required opening lines and conversation structure, without stating that users may choose their preferred language. This can create a locale or language policy issue when the skill is used with users who have not opted into Chinese.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
These instructions direct the system to retain prior disclosures and use sender ID to resume deeply personal conversations, but they do not clearly warn users that their reflections may persist across sessions. In a self-reflection skill, this creates a substantial privacy risk because users may reveal sensitive mental, relational, or biographical information without understanding it will be stored and resurfaced later.

Ssd 3

Medium
Confidence
96% confidence
Finding
The skill tells the agent to preserve detailed user disclosures and replay them in later sessions, which creates a resurfacing risk for sensitive personal information. In the context of introspective conversations, even seemingly benign recollections can expose emotional states, relationships, trauma, or identity-related details when shown again without renewed consent.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The skill instructs the agent to read and write timeline data to JSON files containing personal history, but does not require an explicit privacy warning or consent flow. Because the content being stored is intimate reflective material, file-based persistence materially increases the risk of unauthorized retention, later exposure, or unexpected reuse.

Ssd 3

Medium
Confidence
98% confidence
Finding
The lifecycle explicitly mandates reading, maintaining, and writing persistent timeline files that track personal history over time. This is especially dangerous in a self-reflection skill because it normalizes long-term collection of highly sensitive autobiographical data, increasing the blast radius of any unauthorized access, misrouting, or accidental resurfacing.

Ssd 3

Medium
Confidence
95% confidence
Finding
The skill explicitly instructs the agent to automatically produce a detailed end-of-session summary of sensitive user disclosures, including relationship history, psychological patterns, and named individuals. In an introspection skill, this concentrates highly personal data into a reusable artifact, increasing the chance of unintended retention, display, forwarding, or exposure beyond the immediate conversation.

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
All prompts, stage instructions, and example utterances are specified in Chinese, which implies the skill will conduct interactions in a single language. The file does not state that Chinese is optional, user-selected, or required for a documented region-specific purpose, so this appears to force a locale without opt-in.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The file explicitly instructs the system to 'save timeline' at close and later to 'save session records + update timeline' while guiding users through intimate life history, emotional pain, relationships, fears, and identity exploration. Storing this category of sensitive mental-health-adjacent data without clear user notice, consent, retention limits, or handling rules creates a real privacy and safety risk if the data is exposed, reused unexpectedly, or retained indefinitely.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
These sections encourage eliciting highly sensitive disclosures about bereavement, trauma, illness, relationships, fears, shame, 'inner child,' and core identity, but provide no user-facing warning, informed-consent step, or safety boundary before doing so. In a self-reflection skill, this increases the chance users will reveal mental-health-adjacent or otherwise sensitive personal information without understanding the depth of collection or potential downstream use.

Natural-Language Policy Violations

Medium
Confidence
89% confidence
Finding
SQP-3 applies to all file types and covers language or locale policy violations. This markdown file presents all guidance and example prompts only in Chinese, with no indication that the user opted into Chinese or that the skill is intentionally limited to a Chinese-speaking context.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
The title and all example prompts are written in Chinese, and the document presents the techniques as the expected conversation format without indicating that other languages are supported. This creates a natural-language locale constraint that appears mandatory rather than optional, which can violate language/locale policy when no user opt-in or justification is provided.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
The schema metadata and instructions are written entirely in Chinese and explicitly direct the AI to preserve and record sensitive autobiographical details in that language/locale without any indication of user preference. In an introspection skill handling deeply personal memories, forcing a specific locale can cause misunderstanding, reduce informed transparency, and lead to inaccurate capture or exposure of sensitive user data in an unexpected language context.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The script creates a persistent markdown file for highly sensitive introspective session material, but it gives no warning about local storage, file sensitivity, or access controls. In the context of a self-reflection skill, transcripts may include mental health details, trauma, relationships, or other personal data, so silent retention increases the risk of accidental disclosure on shared systems or backups.

Natural-Language Policy Violations

Low
Confidence
83% confidence
Finding
The script title uses Chinese-only user-facing labeling ("魔镜") while the rest of the script is otherwise in English, with no indication that language choice is configurable or intentional for a region-specific audience. This can violate language/locale policy when a skill imposes a language without user opt-in or documented justification.

Static analysis

No suspicious patterns detected.