Back to skill

Security audit

Agent Memory Temp

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent local memory tool, but it encourages persistent storage of conversation-derived personal context without enough consent, retention, deletion, or local file-permission safeguards.

Review before installing if this agent may handle personal, confidential, regulated, or business-sensitive information. Use a dedicated database path with restrictive permissions, avoid storing secrets or sensitive personal details, set expirations where possible, and periodically inspect or delete stored memories. This is not evidence of exfiltration or malware, but it needs stronger privacy and persistence controls.

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

T09 · Insecure Skill Coding Practices

Warning
Location
src/memory.py:103
Finding
Persistent Agent Memory Is Stored Without Explicitly Restrictive Permissions## Vulnerability Details **File Location**: `src/memory.py`, lines 103–105 and 112 **Vulnerability Type**: Plaintext sensitive data stored with umask-dependent permissions **Risk Level**: Medium ### Vulnerable Code ```python if db_path is None: db_dir = Path.home() / ".agent-memory" db_dir.mkdir(exist_ok=True) db_path = str(db_dir / "memory.db") self.db_path = db_path self._init_db() ``` The database is subsequently created or opened without enforcing its permissions: ```python conn = sqlite3.connect(self.db_path) ``` ### Technical Analysis The default directory is created without an explicit restrictive mode, and the SQLite database is opened without verifying or enforcing file ownership and permissions. Their effective permissions therefore depend on the process umask and any pre-existing filesystem object at the path. The database stores conversation-derived facts, lessons, personal entities, preferences, and arbitrary attributes in plaintext. In a multi-user environment with a permissive umask or incorrectly configured parent directory, another local account may be able to read this persistent context. If write access is available, that account may also tamper with the database and influence information recalled by the agent in later sessions. The implementation also does not reject a pre-existing symbolic link at the default database path. Under an environment where an attacker can modify the memory directory, this may enable redirection to an attacker-controlled database or another writable target. Exploitation requires local filesystem access and inadequate surrounding permissions; no remote exploitation path is present in the reviewed code. ### Attack Path 1. An agent invokes `AgentMemory()` with the default path. 2. The application creates `~/.agent-memory` and `memory.db` using permissions derived from the process umask. 3. The agent stores sensitive conversation facts, behavioral lessons, preferences, or entity attributes in th ...[truncated 1233 chars]
Remediation
## Remediation Suggestions 1. Create the default directory with owner-only permissions: ```python db_dir.mkdir(mode=0o700, parents=True, exist_ok=True) db_dir.chmod(0o700) ``` 2. Securely create the database file with mode `0600` before connecting, or immediately enforce that mode after creation: ```python import os fd = os.open(db_path, os.O_CREAT | os.O_RDWR, 0o600) os.close(fd) os.chmod(db_path, 0o600) ``` 3. Use `lstat()` and reject symbolic links for the default database path. Verify that both the directory and database are owned by the expected user. 4. Apply equivalent validation to custom database paths or clearly document that callers are responsible for securing them. 5. Document that secrets, credentials, authentication tokens, and other highly sensitive values should not be stored in plaintext memory. 6. Where local-user isolation is insufficient, use an encrypted storage design with keys obtained from an operating-system keychain or another protected secret store. 7. Add tests that initialize the default storage under different umasks and assert directory mode `0700`, database mode `0600`, expected ownership, and symbolic-link rejection.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (9)

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The README explicitly encourages storing persistent user preferences, relationship context, and named-entity details across sessions, but it does not warn about consent, minimization, retention, or sensitive-data handling. In an agent skill context, this can normalize collecting and retaining personal data indefinitely, increasing privacy, compliance, and misuse risks if operators deploy it without safeguards.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The skill explicitly promotes persistent storage of facts, experiences, and entity information across sessions, but provides no guidance on filtering sensitive data, obtaining consent, setting retention limits, or protecting the resulting database. In an agent context, this can lead to unintentional collection of user-derived personal, confidential, or regulated data and long-term exposure if the local database is accessed or reused later.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The session-end workflow tells agents to extract durable facts from conversations and update entity information, which directly encourages writing user-derived content to disk without any warning that the data may be sensitive or unnecessary to retain. Because this is framed as routine operational guidance, it increases the likelihood of systematic over-collection and persistence of personal or confidential information across sessions.

Missing User Warnings

Medium
Confidence
83% confidence
Finding
The `forget` command performs removal of stored facts, which is a destructive operation. While the parser help says 'Remove stale facts,' there is no confirmation prompt, cautionary comment/docstring, or stronger user-facing warning near the deletion path before execution.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
This code initializes a SQLite database under ~/.agent-memory and the skill is explicitly designed to remember facts about people, preferences, and other entities across sessions. While the module has internal docstrings, it provides no user-facing disclosure, confirmation, or warning that personal or sensitive data will be written persistently to disk by default.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The forget and forget_stale methods perform irreversible DELETE operations on stored facts. There is no confirmation prompt, user-visible log message, or warning in the surrounding documentation that invoking these methods can permanently remove memory records.

Intent-Code Divergence

Medium
Confidence
90% confidence
Finding
The forget() method deletes rows from the facts table but does not remove corresponding entries from the facts_fts full-text index. This can leave deleted content searchable or otherwise recoverable through recall paths, causing unintended retention and disclosure of sensitive memory data despite an API promise of permanent deletion.

Missing User Warnings

Low
Confidence
80% confidence
Finding
This code initializes a database-backed AgentMemory instance and immediately persists entity data via track_entity, update_entity, and link_fact_to_entity. While the CLI prints success messages after the fact, there is no prior user-facing disclosure in code comments or docstrings that these commands modify persistent storage, which may be relevant for user data safety.

Intent-Code Divergence

Low
Confidence
96% confidence
Finding
The top-level documentation states the skill can 'Search memories semantically', which implies meaning-based retrieval. In code, `recall()` uses an FTS5 `MATCH` query over text content and tags (L242-L251), and no semantic embedding generation or vector similarity search is implemented despite the unused `embedding` column in the schema (L128).

Static analysis

No suspicious patterns detected.