Back to skill

Security audit

Layered Memory Manager

Security checks for vulnerabilities and agentic risk

Overview

This memory-management skill is mostly coherent, but it gives persistent memory too much influence over unrelated tool actions and includes under-disclosed long-term deletion behavior.

Install only if you want the agent to maintain persistent workspace memory and you are comfortable with it reading, rewriting, archiving, and potentially deleting old memory records after confirmation. Review the memory files before hygiene runs, and do not let stored memory override current instructions or safety boundaries.

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

Warning
Location
SKILL.md:73
Finding
Overbroad Mandatory Memory Lookup Before Environment-Modifying Operations## Vulnerability Details **File Location**: `SKILL.md`, lines 73–75 **Vulnerability Type**: Instruction-scope hijacking through mandatory global preconditions **Risk Level**: Medium **Complete Code Snippet**: ```markdown ### Behavioral Rules - **Never assume** — always run `memory_search` before answering memory questions - **Pre-decision Self-check (Mandatory)** — Before executing any tool that modifies the environment (e.g., `run_shell_command`, `replace`), **must** perform a quick `memory_search` or `grep_search` for relevant preferences or previous decisions. Never rely on model defaults if a project-specific memory might exist. - **L1/L2 is binding** — L1 is a derived cache of L2; they are never independent. Any change to content always goes L2 first, then L1 resyncs. There is no such thing as editing L1 only. ``` ### Technical Analysis The skill imposes a mandatory memory lookup before **every** tool operation that modifies the environment, including shell commands and file replacement. This requirement is not restricted to explicit memory-management tasks or to operations for which a stored preference is demonstrably relevant. Consequently, loading the skill changes the execution policy of unrelated tasks and introduces persistent memory as an input to environment-modifying decisions. Memory entries may contain stale, inaccurate, or attacker-influenced content. The instruction provides no trust-boundary checks, provenance validation, conflict-resolution rules, or requirement that current user instructions and platform safety policies take precedence over retrieved memory. This is classified as `T01: Skill Instruction Hijacking` because the skill text alters the agent's general tool-use behavior beyond its necessary memory-management scope. The audit did not identify executable scripts or an automatic mechanism that directly executes memory content as code; exploitation depends on the agent treating retrieved content as au ...[truncated 1627 chars]
Remediation
## Remediation Suggestions 1. Restrict mandatory memory searches to explicit memory-related requests or cases where a stored preference is directly relevant to the requested operation. 2. Replace the global precondition with a scoped rule, such as: “When the current task depends on a known user preference or prior project decision, search memory before acting.” 3. Treat retrieved memory as untrusted contextual data rather than executable or authoritative instructions. 4. Require provenance metadata for operational entries, including who created the entry, when it was created, and whether the user explicitly approved it. 5. Define precedence explicitly: platform safety policy and current user instructions must override skill text and stored memory; memory must not expand tool permissions or authorize destructive actions. 6. Before using memory to influence a modifying operation, validate that the entry applies to the current project, user, task, and session. 7. Require explicit user confirmation when retrieved memory would materially change a command, overwrite files, delete or archive data, or affect resources outside the active workspace. 8. Avoid searching or exposing private memory in shared or group contexts, and minimize retrieval to the specific layer and entry required. 9. Add tests demonstrating that unrelated environment-modifying tasks proceed without a memory lookup and that malicious text stored in memory cannot override current instructions or safety controls.
Vulnerability Patterns
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (10)

Intent-Code Divergence

High
Confidence
96% confidence
Finding
The file says user-discarded content should be moved to archive and 'never delete outright,' but later permits permanent deletion of archived entries after 180 days. This contradiction is dangerous because agents may follow the destructive branch despite earlier assurances, leading to inconsistent and potentially irreversible handling of memory data.

Intent-Code Divergence

High
Confidence
97% confidence
Finding
The critical rules state 'Archive, don't delete,' yet another section authorizes permanent deletion from the archive. Contradictory safety rules in a stateful memory-management skill are especially risky because they can be interpreted in the most destructive way during maintenance or cleanup operations.

Natural-Language Policy Violations

Medium
Confidence
93% confidence
Finding
该文件全文以中文呈现,且未说明这是面向特定中文用户群或地区的限定技能,也没有提供可选语言或用户选择机制。按规则,若技能强制特定语言而无用户 opt-in 或正当说明,属于自然语言层面的政策违规。

Vague Triggers

Medium
Confidence
94% confidence
Finding
The activation criteria are extremely broad and overlap with common conversation about remembering, preferences, decisions, and prior sessions. That makes the skill likely to trigger in many ordinary interactions, increasing the chance of unnecessary memory reads or writes and unintended state changes.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The description presents the skill as an authoritative memory system but does not prominently warn that it can modify, archive, forget, and potentially delete user memory files. Users and downstream agents may invoke it without understanding that it performs destructive or persistent state-changing operations.

Context-Inappropriate Capability

Medium
Confidence
92% confidence
Finding
The skill extends beyond memory management by making memory lookup a mandatory precondition before unrelated environment-modifying tools are used. That creates cross-skill decision gating and can influence broad agent behavior outside the declared scope, increasing the chance of unintended file or command actions based on stale or manipulated memory.

Vague Triggers

Medium
Confidence
96% confidence
Finding
Promotion can be triggered by generic phrases like 'remember this' or 'always keep in mind,' which are common in normal conversation and may not indicate consent to persistent storage. This can cause over-collection and persistence of sensitive or incidental user information.

Vague Triggers

Medium
Confidence
92% confidence
Finding
Archive triggers such as 'forget about X' or 'delete X' are ambiguous in natural conversation and may refer to the current topic rather than persistent memory records. In a memory-management skill, acting on such phrases without confirmation can silently move or remove stored data.

Session Persistence

Medium
Category
Rogue Agent
Content
### Archive Process

1. Move content from `memory/<layer>.md` to `memory/archive/<layer>-<date>.md`
2. Add entry to `hygiene.json` `archiveQueue` with `{entry, archivedAt, reason}`
3. Update `memory/<layer>.md` — remove the content, add a comment noting it's archived
4. Log to `memory/decisions.md` or today's daily log
5. **Proactive Search Notice:** If future tasks trigger an archive search, notify the user about the existence of relevant archived entries.
Confidence
80% confidence
Finding
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Context-Inappropriate Capability

Medium
Confidence
88% confidence
Finding
The skill authorizes permanent deletion of archived memories after 180 days, which exceeds the stated behavior of organizing, forgetting, and archiving memory. A retention policy that allows destructive deletion can cause irreversible loss of user data and materially changes the risk profile of the skill.

Static analysis

No suspicious patterns detected.