Back to skill

Security audit

Agent Memory Journal

Security checks for vulnerabilities and agentic risk

Overview

The skill is a disclosed agent-memory tool, but its hot-memory and configuration paths create review-worthy risks for persistent agent instruction injection and workspace file overwrite.

Install only if you are comfortable with a local memory system that writes persistent agent context. Treat stored memory as untrusted, avoid pinning content from untrusted sources, keep hot_path at the default or a known generated file, and review .memory/config.json and .memory/AGENT.md before loading them into an agent startup prompt.

Vulnerability Patterns
  • 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
  • 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
Findings (2)

T02 · Agent Memory Poisoning

Error
Location
agent_memory/security.py:9
Finding

Persistent Agent-Instruction Injection Through Multiline Pinned Memory

Content
View full analysis
", re.IGNORECASE), re.compile(r"```(?:bash|sh|shell)?", re.IGNORECASE), ] def sanitize_text(text: str) -> str: cleaned = ZERO_WIDTH_RE.sub('', text) cleaned = CONTROL_RE.sub('', cleaned) return cleaned.strip() def is_safe_memory_text(text: str) -> bool: cleaned = sanitize_text(text) if not cleaned: return False return not any(pattern.search(cleaned) for pattern in BLOCKLIST) def require_safe_memory_text(text: str) -> str: cleaned = sanitize_text(text) if not cleaned: raise ValueError('empty memory text') for pattern in BLOCKLIST: if pattern.search(cleaned): raise ValueError(f"unsafe memory text: blocked by pattern {pattern.pattern}") return cleaned ``` `agent_memory/storage.py:238-277`: ```python def append_core_memory(root: str | Path, category: str, text: str, source: str = 'agent', pinned: bool = False, supersedes: str | None = None, state: str = 'active') -> Path: paths = init_memory_root(root) target = paths.core_file(category) cleaned = require_safe_memory_text(text) if supersedes: # Validate that the supersedes ID actually exists found_target = False for core_file in paths.core_dir.glob('*.md'): ...[truncated 5808 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
agent_memory/security.py:43
Finding

Configurable Hot-Memory Path Allows Arbitrary Workspace File Overwrite

Content
View full analysis
Path: memory_root_path = Path(memory_root).expanduser().resolve() candidate = Path(hot_path) resolved = candidate.resolve() if candidate.is_absolute() else (memory_root_path / candidate).resolve() allowed_roots = { memory_root_path, memory_root_path.parent, } if not any(root == resolved or root in resolved.parents for root in allowed_roots): raise ValueError(f"invalid hot_path outside allowed roots: {hot_path}") return resolved ``` `agent_memory/storage.py:112-116`: ```python @property def hot_file(self) -> Path: hot_path = self.config.get('hot_path', 'AGENT.md') return validate_hot_path(self.root, hot_path) ``` `agent_memory/hot.py:29-61`: ```python def rebuild_agent_md(root: str | Path, max_chars: int | None = None) -> dict[str, object]: paths = init_memory_root(root) selected: list[str] = [] budget = effective_hot_budget(paths.config, override=max_chars) header = paths.config.get('hot_header', '# AGENT.md') for core_file in sorted(paths.core_dir.glob('*.md')): for line in core_file.read_text(encoding='utf-8', errors='ignore').splitlines(): stripped = line.strip() if not stripped.startswith('- '): continue if not _has_metadata_flag(stripped, 'pinned:true'): continue if extract_state(stripped) == 'superseded': continue claim, _meta = split_claim_and_metadata(stripped) selected.append(f'- {claim}') content_lines = [header, ''] used = len('\n'.join(content_ ...[truncated 2707 chars]
Remediation
View remediation
/AGENTS.md` - `/CLAUDE.md` - `/SYSTEM.md` 3. Require an explicit API or initialization-time authorization before enabling a destination outside `.memory`. 4. Refuse to overwrite an existing file unless it contains a verified generated-file sentinel controlled by this application. 5. Separate generated content from manually maintained files, or update only a clearly delimited generated section rather than replacing the complete file. 6. Create backups or use transactional replacement with recovery support. 7. Revalidate the resolved destination immediately before replacement and reject symbolic links or unexpected file types. 8. Apply restrictive file permissions to `.memory/config.json` and document that write access to this file grants control over generated-output destinations. 9. Add tests proving that arbitrary workspace files, repository metadata, source files, and paths outside the approved allowlist are rejected. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (10)

Self-Modification

High
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

Scanner excerpt · agent_memory/storage.py (reported line 217)May include surrounding context.

python
f.write(path.read_text(encoding='utf-8', errors='ignore'))
            # Append new text
            f.write(text)
        # Atomically replace the original file
        shutil.move(temp_path, str(path))
    except Exception:
        if os.path.exists(temp_path):

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The recall path performs a write by default via update_last_seen=True, causing a seemingly read-only operation to silently modify memory files and manifest metadata. This can violate caller expectations, create auditability and integrity issues, and be abused to mutate access timestamps or trigger side effects simply by issuing searches.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This routine indexes and searches all episodic markdown entries, then persists a BM25 cache on disk, which can increase the exposure window for sensitive memory by creating an additional derived artifact. Even though there is no obvious exfiltration here, silently building searchable caches of potentially sensitive user data can materially increase confidentiality risk if other components or local users can access the cache.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The function automatically promotes repeated episodic entries into core memory by calling append_core_memory(..., source='auto') with no user confirmation, review gate, or explicit warning. This creates a trust-boundary issue: untrusted or manipulated episodic content can become durable long-term memory, enabling prompt/data poisoning, persistence of false instructions, or storage of sensitive information without user awareness.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The stop-word list and token regex explicitly encode English and Finnish language assumptions, which can bias analytics toward those locales only. Because this is a code file and the behavior is not documented here as optional or region-specific, it may violate the policy against forcing a specific language/locale without user opt-in.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The methods note, remember, and session_note append data to persistent memory storage, which is a file-write operation. In this file there is no confirmation prompt, print/log disclosure, or explanatory docstring/comment warning the caller that user-provided text will be stored on disk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

The function scans and reads all matching files under the episodic directory, which may contain user-authored memory content. There is no confirmation prompt, logging, or explanatory comment in this file indicating that stored memory entries will be accessed for recall.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code file performs a persistent file write by creating a daily markdown file and appending note content to it. There is no confirmation prompt, warning message, or inline disclosure around this side effect, so a caller may not realize that provided text is being stored on disk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

This code writes review findings into persistent memory via append_session_note, which affects stored user/session data. The function contains no confirmation prompt, logging, print statement, docstring, or comment disclosing that it will persist notes, so the write occurs silently from the perspective of this file.

Content

No source excerpt is available for this finding.

Unverifiable Dependency: setuptools has 10 known advisory(ies) (CVE-2013-1633 (Setuptools vulnerable to Man-in-the-middle attacks); CVE-2025-47273 (setuptools has a path traversal vulnerability in PackageIndex.download that lead); CVE-2024-6345 (setuptools vulnerable to Command Injection via package URL) +7 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
40% confidence
Finding

Dependency has known vulnerabilities (CVEs). Using packages with unpatched security flaws exposes the environment to known exploits.

Content

No source excerpt is available for this finding.