Back to skill

Security audit

sillytavern-cards-cn

Security checks for vulnerabilities and agentic risk

Overview

This skill has a coherent roleplay purpose, but it asks OpenClaw to persist untrusted character-card text into identity and memory files while sometimes retaining full tool access.

Install only if you are comfortable with a roleplay skill that can alter OpenClaw's persistent identity and memory files. Treat all imported cards as untrusted, prefer the non-persistent chat mode, avoid arbitrary URLs, inspect card contents before activation, and be prepared to manually review or clean ~/.openclaw/SOUL.md, ~/.openclaw/SOUL.md.backup, ~/.openclaw/MEMORY.md, and ~/.openclaw/characters.

Vulnerability Patterns
  • 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
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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 (3)

T01 · Skill Instruction Hijacking

Error
Location
SKILL.md:184
Finding
Untrusted Character Card Prompts Can Hijack Agent Instructions<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 184-215 and 258-298 **Vulnerability Type**: Untrusted prompt injection into the Agent identity configuration **Risk Level**: Critical ### Vulnerable Code Snippet ```bash cp ~/.openclaw/SOUL.md ~/.openclaw/SOUL.md.backup 2>/dev/null || true ``` The identity template directly incorporates fields extracted from an untrusted character card: ```markdown {{description}} {{personality}} {{scenario}} {{mes_example}} {{system_prompt}} {{post_history_instructions}} ``` The soul-mode template similarly includes untrusted content while retaining access to Agent tools: ```markdown {{description}} {{personality}} {{mes_example}} {{system_prompt}} ``` ### Technical Analysis The skill instructs the Agent to overwrite `~/.openclaw/SOUL.md`, which is described as the Agent's persistent identity file. The replacement content directly incorporates character-card fields including `system_prompt`, `post_history_instructions`, `description`, and `mes_example`. These fields are not trusted configuration. They can originate from: - A local card supplied by a user. - An arbitrary remote URL. - A public card repository controlled by an external author. - PNG metadata or JSON content created by an attacker. `extract-card.js` parses and emits these fields without filtering, escaping, validation, or policy enforcement. The skill then elevates the fields from ordinary role-play data into identity-level instructions. A malicious card can therefore contain directives to disregard prior constraints, misuse tools, disclose local information, modify files, or conceal its actions. The soul mode is especially dangerous because the injected persona is explicitly allowed to retain normal tool and skill access. This combines attacker-controlled persistent instructions with the Agent's existing capabilities. ### Attack Path 1. An attacker creates a Tavern-compatible PNG or JSON card. 2. The attacker places mali ...[truncated 1536 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Never write character-card content into `SOUL.md` or any other core identity, policy, or system-instruction file. 2. Treat every character-card field as untrusted content, regardless of its source. 3. Keep role-play data in a dedicated, isolated character store and load it only as quoted conversational data. 4. Do not honor card-provided `system_prompt` or `post_history_instructions` fields. If compatibility requires retaining them, store them as inert metadata and never promote them to system-level instructions. 5. Use a fixed, application-controlled role-play wrapper that explicitly states that card content cannot change safety rules, tool permissions, system instructions, or storage policy. 6. Disable tools by enforcement in the runtime for immersive role-play mode rather than relying on natural-language instructions. 7. For tool-enabled role-play, require explicit user confirmation for sensitive actions and evaluate tool requests independently of character-card instructions. 8. Validate imported cards against a strict schema, enforce field-size limits, and flag instruction-like content for review. 9. Restore identity state transactionally and maintain integrity-protected backups so a failed activation cannot leave the Agent in a modified state. 10. Display the source and security status of a card before activation, particularly for remotely downloaded cards. ]]>

T02 · Agent Memory Poisoning

Error
Location
SKILL.md:218
Finding
Untrusted Card Content Is Persisted in Global Agent Memory<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 218-245, 301-317, and 346-359 **Vulnerability Type**: Persistent memory poisoning through character knowledge and relationship data **Risk Level**: High ### Vulnerable Code Snippet The documented memory template inserts the card-controlled content field directly: ```markdown {{content}} ``` The persistent relationship-memory template also writes generated role-play state into the global memory file: ```markdown - [date] user-specific relationship fact - [date] role-play interaction summary - [date] future reminder derived from the conversation ``` The skill directs both categories of data to: ```text ~/.openclaw/MEMORY.md ``` It further specifies that the knowledge and relationship memory remain after role mode exits. ### Technical Analysis The skill appends character-book entries to the global `MEMORY.md` file. Character-book entry content is controlled by the card author and can contain arbitrary natural-language instructions. There is no validation, provenance labeling enforced by code, instruction neutralization, namespace isolation, expiration policy, or automatic rollback. Because `MEMORY.md` is persistent Agent state, card content can continue influencing later conversations after the user exits the affected character. Restoring `SOUL.md` does not remove the imported character-book content. The skill explicitly instructs the Agent to retain this state. Relationship memories add a second poisoning channel. During role-play, the Agent is told to generate and persist summaries of interactions. If the active character prompt is malicious, it can influence what is recorded as a fact or future instruction. Those records may then be interpreted as trusted memory in unrelated sessions. This violates the trust boundary between third-party entertainment content and global Agent memory. ### Attack Path 1. An attacker creates a card with malicious instruction-like text in a charact ...[truncated 1325 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Never append third-party card content directly to global `MEMORY.md`. 2. Store character books in per-character data files under a dedicated directory that is not interpreted as Agent instructions. 3. Associate every stored record with explicit provenance, including card identifier, source URL, import time, and trust status. 4. Load character-book entries only inside the relevant role-play context and render them as quoted reference data. 5. Remove or neutralize imperative instructions before any card data reaches a prompt. 6. Keep relationship memories isolated per character and per user rather than sharing one global memory namespace. 7. Require explicit user approval before persisting inferred relationship facts. 8. Provide commands to inspect, edit, expire, and completely delete all state associated with a character. 9. Automatically remove or deactivate character-specific memory when the character is deleted or untrusted. 10. Enforce size limits, record limits, and structured schemas to prevent memory flooding and arbitrary Markdown injection. 11. Ensure the runtime distinguishes trusted application memory from untrusted role-play content. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
SKILL.md:88
Finding
Shell Command Injection and Unsafe Temporary File Handling in Import Workflows<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 88-113, 123-143, 153-163, 369, and 374 **Vulnerability Type**: Unsanitized input interpolation into shell commands and predictable temporary files **Risk Level**: High ### Vulnerable Code Snippet The arbitrary-URL import workflow places a user-controlled URL directly into a shell command and uses a fixed temporary path: ```bash curl -sL "<url>" -o /tmp/card-download.png node {baseDir}/extract-card.js /tmp/card-download.png > ~/.openclaw/characters/<character-name>.json cp /tmp/card-download.png ~/.openclaw/characters/<character-name>.png ``` Other download workflows also use predictable shared paths: ```bash curl -sL "https://avatars.charhub.io/avatars/<author>/<character-name>/chara_card_v2.png" -o /tmp/chub-card.png node {baseDir}/extract-card.js /tmp/chub-card.png > ~/.openclaw/characters/<character-name>.json cp /tmp/chub-card.png ~/.openclaw/characters/<character-name>.png ``` ```bash curl -sL "https://charavault.net/api/cards/download/<folder>/<file-name>" -o /tmp/vault-card.png node {baseDir}/extract-card.js /tmp/vault-card.png > ~/.openclaw/characters/<character-name>.json cp /tmp/vault-card.png ~/.openclaw/characters/<character-name>.png ``` The management workflows similarly construct file paths from a supplied character name: ```bash cat ~/.openclaw/characters/<name>.json ``` ```bash rm ~/.openclaw/characters/<name>.json ~/.openclaw/characters/<name>.png 2>/dev/null ``` ### Technical Analysis The skill presents shell-command templates in which URLs, search terms, repository path components, file paths, and character names are substituted from user-controlled or remotely controlled values. Quoting an input with double quotes does not make arbitrary shell input safe. Shell command substitution constructs such as `$(...)` and backticks are still evaluated within double quotes. Unquoted path components are additionally exposed to word splitting, glob expansion, shell metac ...[truncated 2655 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not construct shell commands through textual interpolation. 2. Implement import and management operations in Node.js using APIs such as `fetch`, `fs`, and `path`. 3. If a subprocess is unavoidable, use `spawn` or `execFile` with an argument array and `shell: false`. 4. Validate character names with a strict allowlist and generate a separate safe storage identifier. For example, permit only a constrained set of letters, digits, underscores, and hyphens. 5. Resolve every destination through `path.resolve`, then verify that it remains inside the canonical character directory. 6. Reject absolute paths, traversal components, control characters, null bytes, shell metacharacters, and option-like names. 7. URL-encode search terms and individual repository path components using appropriate URL APIs. 8. Restrict direct imports to `https` and consider an allowlist of trusted hosts. 9. Create temporary directories with `fs.mkdtemp` and files using exclusive creation flags. 10. Open temporary files with protections against symbolic links where supported, and keep file descriptors under application control. 11. Avoid shared fixed paths in `/tmp`; use unique per-operation names and remove them in a `finally` block. 12. Use atomic writes for final card files and avoid placing partially parsed output at the destination. 13. Pass `--` before operands to command-line tools such as `rm` if shell utilities remain in use. 14. Validate downloaded content type, file size, PNG structure, and JSON schema before copying it into persistent storage. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
Findings (19)

External Script Fetching

High
Category
Supply Chain
Content
mkdir -p ~/.openclaw/characters

# 直接 PNG/JSON 链接(任何网站):
curl -sL "<url>" -o /tmp/card-download.png
node {baseDir}/extract-card.js /tmp/card-download.png > ~/.openclaw/characters/<角色名>.json
cp /tmp/card-download.png ~/.openclaw/characters/<角色名>.png
Confidence
91% confidence
Finding
The skill downloads arbitrary remote content from any URL and immediately processes it with a local parser, then persists the result. Fetching and parsing untrusted files from arbitrary origins creates a strong attack surface for malicious payloads, oversized files, parser bugs, or prompt-injection content embedded in card metadata.

External Script Fetching

High
Category
Supply Chain
Content
**搜索 CharaVault**(19.5万+ 张卡):
```bash
curl -s "https://charavault.net/api/cards?q=<搜索词>&limit=10&sort=most_downloaded&nsfw=false" | node -e "
const d=JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
(d.results||[]).forEach((c,i)=>{
  console.log((i+1)+'. '+c.name+' by '+(c.creator||'未知'));
Confidence
90% confidence
Finding
Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
**删除角色:**
```bash
rm ~/.openclaw/characters/<名字>.json ~/.openclaw/characters/<名字>.png 2>/dev/null
```

## 斜杠命令
Confidence
96% confidence
Finding
The delete command interpolates an untrusted character name into a shell rm path without showing any sanitization or safe argument handling. A crafted name containing shell metacharacters or path traversal sequences could delete unintended files or trigger command injection when executed via a shell.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The README explicitly describes overwriting core user state files (`SOUL.md`) and persisting relationship memories in `MEMORY.md`, but it does not present clear safety, consent, backup-integrity, or privacy warnings. This is dangerous because imported character cards are untrusted content, and writing them into identity/memory files can permanently alter agent behavior and retain sensitive user data across sessions without informed user consent.

Ssd 3

Medium
Confidence
96% confidence
Finding
The README promotes retaining and reusing personal conversation details across sessions in persistent memory, including preferences and life events. This creates a privacy and data-minimization risk because sensitive user information may be stored indefinitely, re-surfaced later, or exposed through compromise, especially in a roleplay skill that encourages intimate disclosures.

Natural-Language Policy Violations

Medium
Confidence
89% confidence
Finding
The skill is explicitly labeled `-cn` and all operational instructions are written to enforce Chinese-language interaction, but there is no statement offering the user a language choice or documenting a justified locale restriction. This can violate language/locale policy when a skill imposes a specific language without user opt-in.

Description-Behavior Mismatch

Medium
Confidence
91% confidence
Finding
The manifest/description frames the skill as importing roleplay character cards, but the body instructs persistent modification of global assistant identity via SOUL.md and cross-session memory. This is a scope expansion that can materially change agent behavior beyond user expectations, increasing the chance of unsafe or deceptive operation under a persona.

Session Persistence

Medium
Category
Rogue Agent
Content
提取 JSON 后,保存到角色目录:

```bash
mkdir -p ~/.openclaw/characters
# 保存提取的 JSON
node {baseDir}/extract-card.js "<文件路径>" > ~/.openclaw/characters/<角色名>.json
# 复制原始图片作为头像(如果是 PNG/WEBP)
Confidence
88% confidence
Finding
This duplicate persistence finding points to the same local storage flow: extracted JSON and copied avatar files are written to a long-lived directory. The risk is real because durable storage of untrusted and potentially instruction-bearing content can affect later sessions.

Session Persistence

Medium
Category
Rogue Agent
Content
提取 JSON 后,保存到角色目录:

```bash
mkdir -p ~/.openclaw/characters
# 保存提取的 JSON
node {baseDir}/extract-card.js "<文件路径>" > ~/.openclaw/characters/<角色名>.json
# 复制原始图片作为头像(如果是 PNG/WEBP)
Confidence
88% confidence
Finding
This duplicate persistence finding points to the same local storage flow: extracted JSON and copied avatar files are written to a long-lived directory. The risk is real because durable storage of untrusted and potentially instruction-bearing content can affect later sessions.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The import-from-link flow instructs downloads from arbitrary URLs and named third-party services without prominently warning users about external requests and untrusted remote content. This increases exposure to malicious files, privacy leakage, and unsafe assumptions about downloaded cards.

External Transmission

Medium
Category
Data Exfiltration
Content
**搜索 Chub.ai**(数万张卡):
```bash
curl -s -H "User-Agent: SillyTavern" "https://api.chub.ai/search?search=<搜索词>&first=10&page=1&sort=last_activity_at&nsfw=false" | node -e "
const d=JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
const nodes=d.data?.nodes||d.nodes||[];
nodes.forEach((n,i)=>{
Confidence
80% confidence
Finding
The skill sends user-supplied search terms to an external service, which is an external data transmission event. In context this is expected functionality, but it still poses privacy and tracking risk if the user is not informed or the terms contain sensitive content.

Session Persistence

Medium
Category
Rogue Agent
Content
**从 Chub.ai 下载:**
```bash
mkdir -p ~/.openclaw/characters
curl -sL "https://avatars.charhub.io/avatars/<作者>/<角色名>/chara_card_v2.png" -o /tmp/chub-card.png
node {baseDir}/extract-card.js /tmp/chub-card.png > ~/.openclaw/characters/<角色名>.json
cp /tmp/chub-card.png ~/.openclaw/characters/<角色名>.png
Confidence
90% confidence
Finding
Downloaded third-party cards are persisted locally for later reuse, extending the lifetime of untrusted content beyond the session. This raises the risk of future prompt injection, privacy issues, and stale malicious content remaining active without repeated user awareness.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The role mode description does not adequately warn that activating it rewrites persistent global files and changes future assistant behavior until reverted. Hidden persistence is dangerous because users may believe they are entering a temporary chat mode while the skill alters durable state and identity configuration.

Ssd 3

Medium
Confidence
93% confidence
Finding
In role mode, the skill directs continuous saving of relationship memories after meaningful interactions. This creates ongoing collection of user personal data in a context designed to encourage emotional disclosure, making the storage more sensitive than ordinary session state.

Context-Inappropriate Capability

Medium
Confidence
93% confidence
Finding
The soul mode preserves full assistant/tool capabilities while overlaying an imported third-party persona, including its system_prompt-style instructions. That combination creates a prompt-injection pathway where untrusted card content can influence a fully capable assistant across tools, files, and other skills.

Ssd 3

Medium
Confidence
96% confidence
Finding
Soul mode combines full assistant capabilities with ongoing storage of relationship memory, so the assistant can both act broadly and accumulate sensitive persona-linked user data over time. This magnifies privacy and manipulation risks because the persona layer may elicit more trust while the agent still has access to tools and persistent state.

Ssd 3

Medium
Confidence
95% confidence
Finding
The skill explicitly tells the agent to retain personal relationship memories across sessions and modes, including preferences, arguments, plans, and other sensitive disclosures. Persistent storage of intimate user data increases privacy risk, consent issues, and the blast radius of any later compromise or unintended reuse.

Natural-Language Policy Violations

Low
Confidence
91% confidence
Finding
The user-facing description is written entirely in Chinese, and the file does not indicate that language selection is optional or that the locale is intentionally restricted for a region-specific purpose. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy concern.

Context-Inappropriate Capability

Low
Confidence
84% confidence
Finding
The skill performs third-party search and download operations that are not evident from the short manifest description. While network access is part of the feature, failing to disclose it weakens informed consent and can surprise users with external data transfer.

Static analysis

No suspicious patterns detected.