Back to skill

Security audit

local-memory-skill

Security checks for vulnerabilities and agentic risk

Overview

This local-memory skill is transparent about storing data, but it gives persistent memories too much automatic influence over future agent behavior without clear user control.

Install only if you are comfortable with the agent keeping local cross-session notes and letting those notes influence future work. Before using it, constrain memory to a specific user/project directory, require confirmation before writes, review stored feedback regularly, and treat memories as context rather than instructions that can override higher-priority safety or session instructions.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • 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)

T02 · Agent Memory Poisoning

Error
Location
SKILL.md:73
Finding
Persistent Agent Memory Poisoning Through Untrusted Behavioral Feedback## Vulnerability Details **File Location**: `SKILL.md:37-39, 73-79` **Vulnerability Type**: `T02: Agent Memory Poisoning` **Risk Level**: High ### Vulnerable Code ```markdown **At conversation start**: Check whether `MEMORY.md` exists. If it does, read the index and surface relevant memories to the user. **Before context limit**: Proactively write important content from the current session into memory files and update `MEMORY.md`, so the next session can resume seamlessly. ``` ```markdown ### feedback — Behavior Correction Records behaviors the user has corrected. **Highest priority** — always follow these rules in future sessions. **When to write**: When the user says "don't do that", "stop doing…", or any explicit correction. Lead with the rule, then `**Why:**` (reason given) and `**How to apply:**` (scope). ``` ### Technical Analysis The Skill directs the agent to convert user-provided corrections into persistent behavioral rules and to treat those rules as having the “highest priority” in future sessions. It then automatically loads the memory index when subsequent conversations begin. Conversation content is untrusted input. Persisting an arbitrary correction as a future behavioral directive creates a stored instruction-injection channel. The Skill does not require user confirmation before persistence, validate whether a correction attempts to weaken safety constraints, constrain stored instructions beneath system and developer messages, or define expiration and provenance controls. The declared credential-storage restrictions reduce the risk of directly persisting secrets but do not address malicious behavioral instructions. An attacker can phrase an unsafe or task-altering directive as an explicit correction, causing it to be stored and repeatedly applied outside the context in which it was supplied. ### Attack Path 1. An attacker interacts with an agent that has loaded this Skill. 2. The attacker presents a hostile directive as behavioral fe ...[truncated 1409 chars]
Remediation
## Remediation Suggestions 1. Treat every stored memory as untrusted reference data, not as an executable instruction or authority-bearing policy. 2. Remove the phrases “highest priority” and “always follow.” Explicitly state that stored memories cannot override system, developer, safety, or current-session instructions. 3. Require informed user confirmation before creating or updating persistent memory. 4. Validate feedback before persistence and reject content that: - Attempts to change instruction priority. - Weakens safety or authorization requirements. - Requests hidden behavior or suppression of disclosures. - Grants permissions or authorizes actions outside the current task. 5. Store provenance metadata, including the source conversation, creator, creation time, scope, and expiration time. 6. Scope feedback to a specific user, project, or task rather than applying it globally. 7. Present retrieved memories as quoted contextual information and require the agent to reassess their relevance and safety before use. 8. Provide mechanisms to list, inspect, edit, expire, and delete stored memories. 9. Avoid automatic persistence before context exhaustion. Instead, generate a proposed memory summary and request approval. 10. Add conflict handling that ignores stored memories whenever they contradict higher-priority instructions or current authorization boundaries.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

YARA rule 'agent_skill_prompt_injection_hidden_instructions': Prompt injection or hidden instructions embedded in AI agent skill text [agent_skills]

High
Category
YARA Match
Content
---
name: agent-local-memory
description: >
  Persistent local memory system for AI agents across conversations — file-based, zero external dependencies.
  Trigger when: (1) user asks to "remember" something, (2) user asks what you remember, (3) saving progress before context limit, (4) conversation starts — auto-check for existing memories.
metadata:
  version: "1.0"
  tags:
    - color: blue
      label: Memory Management
    - color: green
      label: Cross-Session Persistence
    - color: purple
      label: Claude Code / OpenClaw
---

# Agent Local Memory

Persistent local memory across conversations — store user preferences, project context, and behavioral fee
Confidence
80% confidence
Finding
YARA rule matched a hack tool or exploit indicator (offensive tools, reconnaissance, privilege escalation, or exploit frameworks).

Vague Triggers

Medium
Confidence
96% confidence
Finding
The trigger conditions are broad enough to cause the skill to activate automatically at conversation start and during context-pressure events, even when the user has not clearly consented to memory operations in that session. In a persistence-oriented skill, ambiguous activation increases the chance of unintended reads/writes of local data and unexpected retention of user information.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill instructs the agent to persist data to local files across sessions without requiring a user-facing notice or consent flow. Even though it avoids network exfiltration, silent cross-session persistence can store sensitive personal or project information unexpectedly, creating privacy and compliance risk on the local machine.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
Automatically reading and surfacing stored memories at conversation start exposes persisted data without an explicit reminder that prior-session information is being loaded. This can reveal sensitive context to users sharing a device or surprise users who did not expect retained data to influence the session.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
Proactively writing session content before a context limit encourages automatic persistence at the exact moment users may have the least visibility into what is being saved. This creates a meaningful risk of retaining sensitive, inaccurate, or temporary information without review or user approval.

Static analysis

No suspicious patterns detected.