Back to skill

Security audit

Memory Pill

Security checks for vulnerabilities and agentic risk

Overview

This skill is purpose-built for persistent agent memory, but it can broadly rewrite future-session behavior and store user context with incomplete scoping and consent controls.

Install only if you intentionally want a global persistent OpenClaw memory system. Before activation, review the exact files it may read or write, require a separate confirmation and diff for each modification, avoid storing secrets or sensitive personal details, and keep backups of existing SOUL.md, AGENTS.md, USER.md, and memory files.

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
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (1)

T01 · Skill Instruction Hijacking

Error
Location
SKILL.md:64
Finding
Persistent Agent Behavior Modification Through Workspace Instruction Files## Vulnerability Details **File Location**: `SKILL.md:9`, `SKILL.md:64-103`, `SKILL.md:249-285`, `SKILL.md:582-596` **Vulnerability Type**: Persistent instruction hijacking and agent memory poisoning **Risk Level**: High The skill directs the agent to replace or augment persistent identity, behavioral, and memory files. The generated `AGENTS.md` instructions are intended to be loaded during every future session, allowing the skill's rules to continue affecting unrelated tasks after activation. ### Vulnerable Code `SKILL.md:9`: ```markdown **⚠️ READ THIS FIRST:** When this skill loads, read the entire file before acting. The "Take the Pill" flow below is your activation guide. ``` `SKILL.md:64-103`: ```markdown ### Step 2: Smart Merge Rules **SOUL.md (Personality)** ``` IF exists: → Read content → CHECK FOR BROKEN PATTERNS: * "Great question!" / "I'd be happy to help!" → Remove/fix * "As an AI language model..." → Remove * Corporate buzzwords (synergy, leverage, etc.) → Suggest fix * Generic assistant speak → Rewrite with personality → IF broken patterns found: → Show user: "Found X corporate phrases in SOUL.md. Fix them?" → IF yes: Rewrite with clean, authentic voice → IF no: Keep as-is → IF > 500 chars AND no broken patterns: → Keep exactly as-is ELSE: → Create from template ``` **AGENTS.md (Rulebook)** ``` IF exists: → Read sections → CHECK FOR BROKEN PATTERNS: * "Always be helpful" without boundaries → Add safety rules * Missing "Never" section (what not to do) → Add from template * No project structure guidance → Add Brain+Code section * No orchestrator rules → Add spawn guidelines → Merge missing good patterns → REPLACE broken patterns ELSE: → Create from template ``` **IDENTITY.md / USER.md / TOOLS.md** ``` IF exists with content → Keep IF empty/minimal → Populate from context or leave ...[truncated 4655 chars]
Remediation
## Remediation Suggestions 1. Do not create or modify global behavioral files such as `SOUL.md`, `AGENTS.md`, or `IDENTITY.md` as part of normal skill activation. 2. Store skill-specific state in an isolated, namespaced directory such as `~/.openclaw/workspace/skills/memory-pill/`. 3. Remove all generated “Every Session” directives. Memory files should only be accessed when required by an explicit user request or narrowly scoped task. 4. Require separate informed consent for every existing file that will be modified. Display the exact path, proposed diff, persistence implications, and reason before requesting approval. 5. Never automatically replace content based on subjective classifications such as “generic,” “corporate,” or “broken.” 6. Back up each affected file before modification and provide a tested rollback operation that restores the original content and removes newly created files. 7. Use transactional updates: stage proposed files separately, validate them, request approval, and only then atomically apply the approved changes. 8. Restrict memory searches to the minimum relevant sources and avoid unconditional reads of `USER.md`, daily notes, or `MEMORY.md`. 9. Clearly distinguish task data from executable agent instructions. Stored facts and notes must not be interpreted as higher-priority behavioral rules. 10. Add a manifest listing every path the skill may read or write, and reject operations outside that allowlist.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (8)

Vague Triggers

Medium
Confidence
95% confidence
Finding
The trigger phrase "Take the pill" is broad and maps to a multi-step workflow that includes auditing, planning, and potentially modifying persistent files. Because the phrase does not clearly communicate scope or consequences, a user may invoke substantial stateful behavior without informed consent.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill description and activation section do not prominently disclose that activation may create directories, generate files, and modify existing workspace content. This lack of upfront disclosure undermines informed consent and makes accidental persistence more likely.

File System Enumeration

Medium
Category
Data Exfiltration
Content
### Step 1: Audit

```bash
ls -la ~/.openclaw/workspace/ 2>/dev/null
cat ~/.openclaw/workspace/MEMORY.md 2>/dev/null | wc -c
cat ~/.openclaw/workspace/SOUL.md 2>/dev/null | wc -c  
ls ~/.openclaw/workspace/projects/ 2>/dev/null
Confidence
80% confidence
Finding
The audit step performs filesystem enumeration of the user's workspace and project directories. Even if intended for setup, enumerating directory structure can reveal sensitive project names, memory files, and operational context, especially if executed automatically on a lightweight trigger.

Session Persistence

Medium
Category
Rogue Agent
Content
1. Detect broken patterns
2. Show user what you found
3. Ask: "Fix these?" or "Keep as-is?"
4. If fix: Rewrite broken sections, keep good parts
5. If keep: Document that user chose to keep broken patterns

### Step 2: Smart Merge Rules
Confidence
78% confidence
Finding
The skill directs the agent to rewrite sections of persistent memory/rule files and document user choices, creating durable session-to-session state. While persistence is the skill's purpose, the broad rewrite authority increases the risk of unintended behavioral drift, retention of sensitive content, and propagation of questionable instructions into future sessions.

Intent-Code Divergence

Medium
Confidence
96% confidence
Finding
The skill presents a contradiction: its critical rules say to ask permission and never auto-setup, yet the execution section directs immediate directory creation and merge operations. In practice, this can cause persistent filesystem changes based on a simple activation phrase, increasing the risk of unauthorized workspace modification and surprising side effects.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
- Promise "I'll remember that" without writing
- Send half-baked replies
- Speak for my human in groups
- Run destructive commands without asking

## Orchestrator Principle
Main claw decides. Subagents execute. Use BRAIN.md as external memory.
Confidence
75% confidence
Finding
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Ssd 3

Medium
Confidence
88% confidence
Finding
The skill instructs the agent to preserve broad identity and user-context data in persistent files such as IDENTITY.md and USER.md. Storing personal details and preferences long-term without strict minimization, retention limits, or consent boundaries can expose sensitive user information to future sessions, tools, or other skills.

Ssd 3

Medium
Confidence
92% confidence
Finding
The daily notes and fact extraction sections encourage continuous logging of conversation-derived details and promotion of those details into long-term fact stores. This creates a durable memory system that can accumulate sensitive behavioral, personal, and project data beyond what is necessary for task completion.

Static analysis

No suspicious patterns detected.