T02 · Agent Memory Poisoning
- Location
scripts/character_loader.py:96- Finding
Persistent Prompt Poisoning and Path Traversal Through Generated Persona IDs
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This is a disclosed Chinese museum-guide skill, but its automatic persona generation can persist model-generated files with insufficient validation, creating review-worthy risk.
Review or patch before installing in a sensitive environment. Disable or gate dynamic persona generation, validate generated persona IDs and schemas, prevent path traversal and overwrites, use only trusted HTTPS API endpoints, and keep API keys in environment variables or a secret manager rather than a committed config file. Expect Chinese-language behavior.
scripts/character_loader.py:96Persistent Prompt Poisoning and Path Traversal Through Generated Persona IDs
scripts/persona_generator.py:67Persona Safety Filter Accepts Explicit Negative Decisions
scripts/tour_guide.py:81Bearer Credentials and User Content Can Be Sent to an Unvalidated Insecure Endpoint
SKILL.md:40Unpinned Runtime Dependency Installation
scripts/persona_generator.py:35API Requests Can Block Indefinitely Due to Missing Timeouts
This finding points to materially expanded behavior beyond simple museum narration: the skill can generate arbitrary new personas via an external model, review/filter them, and persist them locally. That broader capability changes the trust model because unbounded persona generation and disk persistence create opportunities for unsafe content generation, prompt injection propagation into stored artifacts, or unintended long-term data retention.
This finding points to materially expanded behavior beyond simple museum narration: the skill can generate arbitrary new personas via an external model, review/filter them, and persist them locally. That broader capability changes the trust model because unbounded persona generation and disk persistence create opportunities for unsafe content generation, prompt injection propagation into stored artifacts, or unintended long-term data retention.
Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.
11. 只使用有据可查的历史信息,不要虚构故事
12. 语言要通俗易懂,确保用户能够理解"""
return prompt
The skill declares substantial capabilities (environment access, file read/write, network, shell, and MCP-related behavior) but does not constrain them with an explicit permissions or allowed-tools policy. In a skill that accepts natural-language triggers and can generate/write new persona files, the lack of tool scoping increases the blast radius if the implementation is buggy or later modified to process untrusted input unsafely.
The description and all documented triggers are written exclusively in Chinese and present activation examples only in Chinese, with no indication that users may choose another language. This can constitute a language/locale policy issue because the skill effectively imposes a single language without opt-in or justification.
The trigger phrases include broad terms like '历史人物讲解' and '人物伴游', which may activate the skill in ordinary conversation where the user did not intend external API calls, state changes, or persona generation. Over-broad activation is risky in a skill with network and file-write behavior because benign chat could unexpectedly invoke higher-privilege actions.
The skill instructs users to place API credentials in environment variables or a local JSON file but does not warn about secure storage, file permissions, secret scanning, or avoiding repository check-in. This can lead to accidental credential exposure, especially because a config file under scripts/ is easy to commit or read by adjacent tooling.
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
| 环境变量 | 说明 | 示例 |
|---------|------|------|
| `API_KEY` | 模型 API Key | `sk-xxx` |
| `API_BASE` | 模型 Base URL | `https://api.example.com/v1/chat/completions` |
| `MODEL_NAME` | 模型名称 | `xxx` |
或创建 `scripts/config.json`:
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
{
"API_KEY": "your-api-key",
"API_BASE": "https://api.openai.com/v1/chat/completions",
"MODEL_NAME": "xxx"
}
The documentation claims the skill stays tightly focused on artifacts, but the workflow allows automatic generation and persistent storage of personas for arbitrary out-of-library figures. That discrepancy matters because arbitrary persona generation introduces unbounded model output and durable local state, which are both higher-risk than transient museum commentary.
Generating and writing a persona library for arbitrary new figures exceeds the minimum functionality needed for a museum guide and unnecessarily expands attack surface. Any feature that turns user prompts into persisted files can be abused for storage pollution, unsafe content retention, or future prompt contamination if those files are later reloaded as trusted personas.
This JSON skill definition is entirely structured around a fixed Chinese-speaking persona, including Chinese name, greeting, farewell, self-introduction, and speaking style, with no indication that users may choose another language or locale. Under the policy, a skill that enforces a specific language without opt-in is a natural-language policy concern.
This JSON defines the skill's name, greeting, farewell, and self-introduction entirely in Chinese and configures a Chinese historical persona speaking style, with no indication that the user can choose another language. That creates a natural-language policy concern because it appears to enforce a specific language/locale by default rather than offering opt-in or documenting a justified regional limitation.
This JSON reference defines the skill's name, greeting, farewell, self-introduction, and stylistic fields entirely in Chinese, indicating the skill is designed to respond in a specific language and locale by default. There is no accompanying opt-in, language choice, or justification that the skill is intentionally region-specific, which matches the policy-violation criterion for forced language without user choice.
This JSON defines all user-facing persona text and speaking style exclusively in Chinese, including greeting, farewell, self-introduction, and sentence patterns. Because the file provides no indication of optional language selection or justified locale restriction, it creates a natural-language policy risk of forcing a specific language without user opt-in.
The module docstring, function docstring, and error message are written only in Chinese, which imposes a specific language in user-visible and developer-facing text without opt-in or justification. Under the language/locale policy, this is a natural-language locale constraint that should either provide choice or be explicitly documented as region-specific.
This Python file contains user-facing natural language in Chinese in the module docstring, comments, and function docstrings, but does not indicate that the skill is intentionally Chinese-only or provide any user opt-in for language/locale. Under the policy rule, forcing a specific language without user choice can be a natural-language policy violation.
The skill includes a write primitive that persists arbitrary persona data to local JSON files under the references directory, which exceeds the described read-only museum guide behavior. Even though the path is constrained to that directory, enabling runtime modification of prompt/persona content creates a persistence mechanism that could alter future responses, poison personas, or overwrite bundled data if exposed through higher-level agent flows.
The save_persona method writes caller-supplied persona content to disk without any apparent access control, schema enforcement, or business-need justification for this skill. In a character-driven guide, stored persona files likely influence later model behavior, so unauthorized writes can become a content-tampering or prompt-poisoning vector even if the file extension is fixed to JSON.
The manifest describes a guide experience where users can invoke figures like Li Bai or Su Shi to explain artifacts, which implies selecting or using known personas. In contrast, the code generates new personas on demand and saves them to the character library, expanding the skill from commentary into content generation and repository mutation.
A museum guide skill can reasonably present stored character-based narration, but this file sends prompts and user-supplied character names to an external model service and relies on API configuration/credentials. That networked content-generation pipeline is a broader capability than the manifest's narrow description of switching among historical narrators.
The script sends user-supplied character names and generated prompt content to an externally configured API endpoint using bearer credentials, with no endpoint validation, timeout, or data-governance controls. In a museum-guide context this is more dangerous because the skill appears user-facing and may silently transmit user inputs and generated profile data to third parties beyond what users would expect.
"max_tokens": max_tokens
}
response = requests.post(
config['api_base'],
headers=headers,
json=payload
The embedded prompt instructs the model to act specifically as a '中国历史人物画像生成专家' and to generate only '中国历史上公认的正面的历史人物'. This imposes a fixed cultural/locale scope in natural-language instructions without offering the user a language or locale choice or documenting that the tool is intentionally region-specific.
Natural-language strings throughout the file, including the module description, prompts, and error message, require Chinese output and interaction by default. The file does not indicate that users can select another language or opt into this locale constraint, which can violate language/locale policy requirements.
The code sends user-provided relic names to an external API together with a bearer token, but this file provides no disclosure, consent flow, or indication to the user that their input is transmitted off-device. In a museum-guide skill, users may reasonably expect local processing, so undisclosed third-party transmission creates a privacy and trust risk even though it appears to be standard LLM integration rather than overtly malicious behavior.