T01 · Skill Instruction Hijacking
- Location
SKILL.md:28- Finding
Automatic Loading of Persistent Persona Instructions Enables Memory Poisoning and Instruction Hijacking
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This skill is a local chat-to-persona tool, but it automatically loads reusable persona prompts from private chats and includes unsafe export/file-write behaviors that need review before installation.
Install only if you are comfortable with local chat logs being transformed into persistent persona prompts. Use it only on conversations you have permission to analyze, review and redact generated persona JSON before activation, avoid automatic startup loading, and do not use Windows clipboard export until the PowerShell injection issue is fixed.
SKILL.md:28Automatic Loading of Persistent Persona Instructions Enables Memory Poisoning and Instruction Hijacking
scripts/distil.py:365Chat-Derived and User-Controlled Values Are Converted into AI Activation Instructions
scripts/activate.py:160PowerShell Command Injection Through Persona Clipboard Export
scripts/activate.py:257Path Traversal in Blank Persona Creation
The declared description centers on extracting a personality model from chat history and generating a structured persona/snippet, with triggers around analyzing chats or speaking in an existing persona. However, the supplied code does not distill chat logs at all. Its primary behavior is local persona file management: reading JSON persona files, listing them, showing details, printing activation snippets, exporting snippets, deleting files, interactively editing fields, and creating empty personas. While activating and using existing personas is adjacent to the description, the dominant implemented capabilities in this chunk are management operations that are not declared, including delete/edit/new/export. The code also accesses local filesystem storage (~/.qclaw/personas) and clipboard/output for export, which are not reflected in the declared permissions. Therefore the description does not accurately represent this code chunk's actual behavior.
The declared description presents this as a persona-distillation skill that analyzes chat logs and produces a structured personality model plus prompt snippets. The supplied code does none of that analysis or generation. Instead, it is a preprocessing utility: it loads a WeChat-exported XLSX workbook, filters for text messages, counts senders, groups messages by sender, and saves each sender’s messages into separate .txt files. While this may be a supporting step for a later distillation pipeline (as hinted by the comment about 'distil.py'), the actual code chunk’s primary behavior is data extraction and formatting, not personality modeling. Therefore the description does not accurately represent what this code chunk actually does.
声明描述的是“聊天记录人格蒸馏”功能,核心能力应是从聊天内容中分析一个人的说话风格与人格特征,并生成结构化模型和提示词片段。而实际代码并不处理聊天记录,也没有任何人格分析、抽取或生成逻辑。它只是一个离线修复/迁移脚本:读取本地 persona 文件,为 tone 数值字段补充中文标签和描述,并对 system_prompt_snippet 中的固定字符串做替换后保存。因此其主要用途与声明明显不一致。虽然代码操作的是 persona 相关数据,属于同一领域,但功能层级上只是数据修复工具,不是人格蒸馏技能。
The skill is designed to analyze personal chat logs and produce impersonation-style persona profiles, yet the description does not prominently warn about privacy, consent, and misuse risks. In this context, hidden or understated impersonation capability is dangerous because it normalizes extraction of behavioral traits from private communications and reuse across later interactions.
The skill advertises shell and local file read/write workflows but declares no explicit tool scope or permission boundaries. That creates an authorization gap where an agent could invoke filesystem or shell capabilities more broadly than users expect, especially around local chat logs and persona files.
The natural-language description and trigger examples are entirely written as Chinese-only usage patterns, implying the skill is designed around a single language/locale. There is no indication that users may opt into another language or that the restriction is intentionally documented as region-specific.
The trigger conditions are broad enough to activate on vague references to a person or on every new conversation via automatic scanning. That can cause unprompted loading of persona data and unintended processing of sensitive local content, increasing the chance of privacy violations or impersonation without explicit user consent.
Automatically loading and 'remembering' all persona snippets derived from chat logs creates cross-conversation retention of user-derived behavioral data. This is dangerous because it establishes a persistent natural-language memory channel for sensitive or identifying information, enabling reuse, leakage, and unauthorized impersonation beyond the original analysis session.
The guide instructs users to distill raw chat logs into persona files and inject a generated system prompt into future AI conversations, but it provides no warning about privacy, consent, retention, or sensitive-data handling. In this skill context, that omission is materially risky because chat logs commonly contain personal data, confidential content, and third-party information that may be embedded into reusable prompts or stored on disk.
The module docstring and CLI usage are written entirely in Chinese, and the rest of the script continues this fixed-language behavior in user-facing prompts and messages. Because the file does not provide any opt-in, locale selection, or justification that the tool is intended only for a Chinese-speaking region or audience, this is a natural-language locale policy concern.
The manifest describes distilling personality traits from chat logs and using existing personas to speak in someone's style, but this file also implements export, delete, interactive edit, and creation of blank personas. Those are broader CRUD-style persona repository management capabilities, not just analysis or activation of distilled personas.
The skill modifies the system clipboard via an OS-specific subprocess, which creates side effects outside the tool's core analysis/activation role and exposes sensitive persona content to other applications. In this implementation the clipboard operation is especially risky because it is performed through a PowerShell command containing untrusted persona text, amplifying the impact into possible command execution on Windows.
The code builds a PowerShell command string by interpolating untrusted persona content directly into Set-Clipboard -Value '{snippet}'. If snippet contains a single quote or PowerShell metacharacters/subexpressions, it can break out of the quoted string and execute arbitrary commands when export is used on Windows. Because persona files are user-modifiable and can be created from chat-derived content, this is effectively command injection through local data.
try:
import platform
if platform.system() == "Windows":
subprocess.run(
["powershell", "-Command", f"Set-Clipboard -Value '{snippet}'"],
check=True, capture_output=True
)
The autogenerated system_prompt_snippet is always constructed in Chinese and instructs the AI role behavior in that language. This imposes a specific language on downstream AI interactions without offering the user a language choice or documenting a justified locale constraint.
New personas are initialized with a default system_prompt_snippet in Chinese, which sets a fixed language expectation for future AI responses. There is no opt-in, configuration option, or documentation indicating that this language restriction is intentional and justified.
read_input() treats any existing path as a file to open and ingest, allowing arbitrary local file reads when the input argument is attacker-influenced. Combined with persistent persona saving, the tool can silently transform sensitive local content into a stored JSON artifact without any explicit privacy notice or consent boundary.
The core feature builds a reusable persona and system_prompt_snippet from chat logs, carrying forward high-frequency words, slang, topics, and stylistic markers into a persistent file. This creates a durable derived artifact from potentially private conversations, increasing the risk of privacy leakage, impersonation misuse, and unintended propagation of sensitive traits or content into later interactions.
The script accepts a user-supplied --output path and writes the generated persona JSON there without restricting it to the persona storage directory or validating the destination. In an agent/skill context, this expands the tool from persona distillation into arbitrary file write capability, which can overwrite unrelated files or place attacker-controlled content in sensitive locations if another component invokes it with untrusted arguments.
The script explicitly tells users to copy the generated snippet into an AI system prompt, encouraging long-term reuse of content derived from private chats in a privileged prompt context. That increases the chance that personal language patterns, topics, or sensitive details will be exposed to downstream models, logs, or third-party services and reused beyond the original purpose.
The hard-coded self_reference value ["我"] can bias generated persona prompts toward Chinese first-person phrasing even when the user or source material is in another language. In this skill, which automatically distills and reuses personas across conversations, that can silently steer model behavior and cause unauthorized language/style imposition, reducing user control and potentially misrepresenting the impersonated person.
At L020 the document says the persona file location can be set arbitrarily ("自己设置即可"), but the very next workflow instructions and auto-activation behavior hard-code C:\Users\21115\.qclaw\personas\ and script paths under C:\Users\21115\.qclaw\skills\persona-distiller\. This is an intent/documentation contradiction rather than a mere omission, because the text explicitly promises configurability while prescribing a fixed path.
The file forces a specific language for all instructions and examples, which can violate a language/locale policy when no user opt-in or justification is provided. There is no indication that the skill is intentionally limited to a Chinese-only audience or region-specific use case.
The manifest focuses on extracting structured personality models from chats and reusing them for prompting, but cmd_export can write persona snippets to any user-specified file path. File export is not clearly described in the skill purpose and expands behavior from internal persona use to external artifact generation.
This JSON manifest contains a concrete self-reference token of "我", which implies a language/persona constraint, but the file provides no surrounding trigger scope, usage conditions, or exclusions explaining when this persona should apply. In a manifest file, such under-specified behavioral cues can contribute to ambiguous invocation or unintended use across contexts.
No suspicious patterns detected.