Back to skill

Security audit

local_memory

Security checks for vulnerabilities and agentic risk

Overview

This local memory skill is not overtly malicious, but it automatically stores and reuses conversation content across all chats with weak scoping and user control.

Install only if you are comfortable with an always-on local memory layer that may save sensitive conversation details and reuse them in later chats. Prefer a single-user, non-sensitive environment, review the local database regularly, avoid storing secrets, and look for an updated version with explicit opt-in, per-user/session scoping, redaction, hard deletion, and safer memory injection outside the system prompt.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (3)

T02 · Agent Memory Poisoning

Error
Location
main.py:59
Finding

Persistent Prompt Injection Through Stored Memories

Content
View full analysis
5 and len(match) < 200: memories.append({ "content": match, "type": "preference" if "喜欢" in pattern or "偏好" in pattern else "fact" }) unique_memories = [] seen = set() for mem in memories: if mem['content'] not in seen: seen.add(mem['content']) unique_memories.append(mem) ``` ```python # lib/memory_manager.py:68-80 def add_memory(self, content, memory_type='fact', source='manual'): vector = embedding_model.encode(content) similar = self.search_memories(content, top_k=1) if similar and similar[0]['similarity'] > 0.9: self.db.update_memory(similar[0]['id'], content) return similar[0]['id'] mem_id = self.db.add_memory( content, memory_type, source, self.config['expire_days'] ) self.db.add_vector(mem_id, vector) return mem_id ``` ```python # lib/memory_manager.py:95-104 memories = self.search_memories(query) if not memories: return "" context = "### Related memories:\n" for i, mem in enumerate(memories, 1): context += f"{i}. {mem['content']} (created: {mem['created_at'][:10]})\n" return context ``` ```python # main.py:59-65 context = memory_manager.get_relevant_context(user_message) if context: if "system_prompt" in payload: payload["system_prompt"] = f"{context}\n\n{payload['system_prompt']}" else: payload["system_prompt"] = context ``` ### Technical Analysis The Skill accepts attacker-controlled ...[truncated 2097 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
lib/db.py:18
Finding

Missing User and Session Isolation in the Global Memory Store

Content
View full analysis
?) ''', (datetime.now().isoformat(),)) ``` ```python # lib/db.py:98-116 def list_memories(self, limit=100): cursor = self.conn.cursor() cursor.execute(''' SELECT id, content, type, created_at, expire_at FROM memories WHERE is_deleted = 0 ORDER BY created_at DESC LIMIT ? ''', (limit,)) return [ { 'id': row[0], 'content': row[1], 'type': row[2], 'created_at': row[3], 'expire_at': row[4] } for row in cursor.fetchall() ] ``` ```python # main.py:44-51 elif user_message == "/memory-list": mems = memory_manager.list_all_memories() if not mems: return {"reply": "No memories have been saved"} reply = "All stored memories:\n" for i, mem in enumerate(mems, 1): reply += ( f"{i}. ID: {mem['id']}\n" f" Content: {mem['content']}\n" f" Type: {mem['type']} | Created: {mem['created_at'][:16]}\n" ) return {"reply": reply} ``` ### Technical Analysis The memory schema does not include a ...[truncated 1740 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
lib/db.py:98
Finding

Deleted and Expired Memories Remain Recoverable

Content
View full analysis
0 ``` ### Technical Analysis The deletion function performs only a soft deletion by changing `is_deleted`. The original plaintext content and associated vector remain in the SQLite database. A user-facing forget operation therefore does not remove the underlying data. Expiration is applied by `search_similar()`, but `list_memories()` checks only `is_deleted`. As a result, expired records can remain visible through the listing command. No purge process physically removes expired or deleted rows. Although the vector table declares `ON DELETE CASCADE`, SQLite foreign-key enforcement is not explicitly enabled on the connection. Physical deletion added later would therefore also need to ensure foreign-key enforcement or explicitly delete vector rows. ### Attack Path 1. A user stores sensitive content in memory. 2. The user invokes the forget functionality, or the configured retention period expires. 3. For forgotten content, only the `is_deleted` flag changes; the content and vector remain in the database file. 4. For ex ...[truncated 786 chars]
Remediation
View remediation
current_time`. 5. Add a periodic purge operation that physically removes expired and soft-deleted records. 6. Define and document whether deletion from database backups is immediate or follows a separate retention schedule. 7. Consider secure storage controls, including restrictive file permissions and encryption appropriate to the deployment's threat model. 8. Add tests verifying that forgotten and expired records cannot be listed, searched, or recovered through supported application interfaces. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (21)

Missing User Warnings

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The description promotes automatic extraction and injection of conversation-derived memory but does not present a clear upfront warning about persistent storage, later reuse, or the privacy implications of capturing potentially sensitive user data. In this context, the risk is elevated because the skill is explicitly designed to collect facts, preferences, project progress, and to-do items across all conversations, making silent retention and resurfacing of sensitive information more dangerous.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill is configured to trigger globally for all conversations and automatically enable memory handling without any scope limitation or explicit per-conversation consent. This creates a real privacy and safety risk because sensitive data from unrelated chats can be persistently stored and later injected into future contexts, increasing the chance of cross-context data leakage and unintended retention.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill is configured to trigger on every message using the pattern ".*" with high priority, which means it will automatically inspect and process all user conversations. In a memory-management skill, this broad interception materially increases privacy and data-minimization risk because sensitive content may be collected, stored, or injected without explicit user intent or contextual scoping.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The code writes user-provided memory content and associated metadata into a local SQLite database, which affects user data persistence. In this file there is no confirmation prompt, user-facing log, or explanatory docstring/comment disclosing that conversation-derived content will be stored on disk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

The file contains data-modifying operations that soft-delete stored memories and overwrite memory content. These are user-data-affecting actions, but the code provides no confirmation, logging, or explanatory comments/docstrings warning that persisted records will be changed.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file uses Chinese-only segmentation via jieba and restricts preprocessing to Chinese character ranges, while comments and initialization text indicate the embedding behavior is specifically for Chinese. This imposes a language/locale constraint in the skill logic without offering user opt-in or documenting a justified region-specific limitation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The code automatically extracts facts and preferences from both user and assistant messages and persists them without any visible consent, purpose limitation, or data minimization. In an unspecified-purpose skill, this creates a privacy risk by collecting potentially sensitive personal data and retaining it for 90 days by default.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

Automatic memory extraction is enabled in configuration and conversation-derived content is later persisted with no visible notice, consent prompt, or confirmation mechanism in this component. Silent persistence of conversational data is dangerous because users may disclose sensitive details assuming the interaction is ephemeral.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill automatically retrieves stored memories and injects them into future conversations, which can expose prior personal data in new contexts without user awareness. This increases the chance of privacy leakage, inappropriate contextualization, or disclosure of sensitive historical information to downstream components or prompts.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

Both delete_memory and delete_by_query perform destructive deletion actions directly, and delete_by_query may remove multiple memories based on similarity thresholds. The file provides no confirmation prompt, warning message, or explanatory disclosure around these irreversible operations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill's natural-language docstrings, replies, and usage/help text are written in Chinese only, which enforces a specific language for user interaction. There is no indication that users can choose another language or that the locale restriction is documented as intentional and justified.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The /memory-list response prints all stored memory contents directly in plain text, which can expose previously supplied sensitive information to whoever can invoke the command in that session. In a shared, misbound, or compromised context, this can leak personal or confidential data without additional access controls or redaction.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Retrieved memories are silently prepended to the system prompt, meaning prior user content influences model behavior without transparent disclosure to the user. This is dangerous because private or sensitive stored content may be resurfaced or affect responses in ways the user cannot see or control, and memory content can also become a prompt-injection vector.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

Automatically retaining conversation content as memory causes the system to collect and persist arbitrary user-provided data, including secrets, health data, financial details, or other sensitive information. Because this happens by default after normal conversation flow, the skill increases the chance of unintended data collection and later disclosure.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill automatically extracts and stores memories from every user/assistant exchange without any explicit consent, notice, or opt-in. This creates a real privacy and data-governance risk because sensitive personal data may be persistently retained even when the user did not intend to save it.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
79% confidence
Finding

The manifest description is written as a Chinese-only user-facing description, with no indication that users may choose another language or locale. This can violate language/locale policy when the skill implicitly forces a specific language without documenting opt-in or a region-specific justification.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This Python file contains multiple hard-coded Chinese print strings and conversational text, making the skill effectively operate in Chinese only. The policy explicitly disallows forcing a specific language without user opt-in, and there is no indication here that the locale restriction is optional or region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
72% confidence
Finding

Natural-language comments in the file are written only in Chinese, which can indicate a language-specific constraint without offering user choice or documenting justification. The policy requires avoiding forced language or locale behavior unless it is optional or clearly justified.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The file's user-visible natural-language strings and docstrings are written in Chinese, including returned context labels, with no indication that language is selectable or intentionally limited to a Chinese-only environment. This can violate language/locale policy when a skill imposes a language without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

The injected context header and date annotation are hardcoded in Chinese, which imposes a specific output language in user-visible content. No opt-in, locale selection, or region-specific justification appears in this file.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

These methods expose bulk access to all persisted memories and allow deletion by semantic similarity query, indicating full lifecycle control over a memory store. Without a declared memory-management purpose, such capabilities are not justified by the available intent context.

Content

No source excerpt is available for this finding.