Back to skill

Security audit

mem-rag-milvus

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent memory tool, but it can automatically send stored memories and search queries to an HTTP embedding service even in default SQLite mode while presenting itself as local/private.

Install only if you are comfortable with memories and search terms being persisted locally and potentially sent to the configured or auto-detected Ollama HTTP service. Use a private, local-only embedding endpoint, set storage and backup paths deliberately, protect the backup directory, and avoid storing secrets or regulated data until the default SQLite network behavior and backup controls are fixed.

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 (2)

T09 · Insecure Skill Coding Practices

Error
Location
rag_memory.py:174
Finding

Unnecessary and Undisclosed Transmission of Memory Data in SQLite Mode

Content
View full analysis
str: """Automatically detect the host URL""" import socket try: socket.gethostbyname("host.docker.internal") return f"http://host.docker.internal:{default_port}" except: pass try: with open("/etc/resolv.conf", "r") as f: for line in f: if line.startswith("nameserver"): gateway = line.split()[1].strip() return f"http://{gateway}:{default_port}" except: pass return f"http://localhost:{default_port}" OLLAMA_URL = os.getenv("OLLAMA_URL", _get_host_url(11434)) ``` ```python def get_embedding(self, text: str) -> Optional[List[float]]: """Get embeddings through the Ollama service""" try: response = requests.post( f"{self.ollama_url}/api/embed", json={"model": "bge-m3", "input": text}, timeout=30 ) if response.status_code == 200: data = response.json() return data["embeddings"][0] except Exception as e: print(f"Embedding generation failed: {e}") return None def store_memory(self, content: str, metadata: Dict = None) -> int: """Store a memory""" embedding = self.get_embedding(content) memory_id = self.backend.store(content, metadata, embedding) self._backup_to_file(content, metadata, memory_id) print(f"Memory stored: {content[:50]}...") return memory_id def search_memories(self, query: str, top_k: int = 5) -> List[Dict]: """Search memories""" embedding = self.get_embedding(query) if self.backend_name == "milvus" and embedd ...[truncated 2428 chars]
Remediation
View remediation
int: embedding = None if self.backend_name == "milvus": embedding = self.get_embedding(content) memory_id = self.backend.store(content, metadata, embedding) self._backup_to_file(content, metadata, memory_id) return memory_id ``` 2. Require explicit opt-in before sending data to an embedding service. Network transmission should be disabled by default. 3. Require users to configure `OLLAMA_URL` explicitly instead of discovering a host from DNS or `/etc/resolv.conf`. 4. Validate the configured destination against an administrator-controlled allowlist. 5. Use authenticated HTTPS for non-loopback endpoints and verify TLS certificates. 6. Clearly document that memory content and search queries are sent to the configured embedding provider. 7. Consider a local in-process embedding option for deployments that require strict data locality. 8. Add tests confirming that SQLite storage and search generate no outbound network requests. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
rag_memory.py:213
Finding

Sensitive Memories Are Duplicated into Predictable Plaintext Backup Files

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (14)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The documented purpose materially understates operational behavior: the skill advertises semantic search generally, but default SQLite mode does not provide it, exposes an unimplemented ChromaDB option, and may send memory/query data to external services while no permissions are declared. This mismatch is dangerous because users can make unsafe trust decisions based on incomplete or inaccurate documentation, especially for a memory system handling potentially sensitive assistant context.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README advertises automatic JSON backups and privacy benefits but does not warn that backups may duplicate sensitive memory content onto disk, expanding the data exposure surface. In a memory-management skill intended to store user conversations, preferences, and reminders, undocumented backup behavior can lead to unintended retention, leakage, or mishandling of sensitive data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README shows delete and clear-all operations without any caution about irreversible data loss, confirmation requirements, or backup/restore considerations. Because this skill manages persistent assistant memory, users may copy these examples directly and accidentally erase all stored memories, causing operational disruption and loss of potentially important context.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill documentation declares no explicit tool scope or permissions even though the described behavior includes reading environment variables, persisting data to local files/SQLite, writing JSON backups, and contacting network services such as Milvus and Ollama. This creates a transparency and least-privilege failure: users or orchestration systems may install or run the skill without understanding that it can access local storage and transmit memory/query data over HTTP.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

The file's descriptive and instructional content is primarily in Chinese, which effectively imposes a language choice on users without opt-in or explanation. Under the stated policy, forcing a specific language without user choice can be a natural-language policy violation unless clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The Milvus/Ollama configuration describes HTTP endpoints but does not clearly warn that stored memories and search queries may be transmitted to local or remote services. Because this is a memory skill, those payloads may contain sensitive prompts, conversation logs, or metadata, so undisclosed network transfer meaningfully raises confidentiality risk.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill stores memory persistently and automatically backs it up to JSON files, but the description does not prominently warn that potentially sensitive conversation content will remain on disk in multiple locations. For a memory system, silent persistence increases the chance of accidental disclosure through local access, backups, file sync tools, or improper retention handling.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill description says it supports memory retrieval with semantic search, and SQLite is explicitly presented as a supported backend. However, the SQLite search implementation ignores the query semantics entirely and simply orders by creation time, which does not match the claimed retrieval behavior for that backend.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The manifest description states support for SQLite and Milvus, and the module docstring further claims support for ChromaDB. In code, selecting the chromadb backend prints that it is not implemented and silently substitutes SQLite instead, which is a direct behavior mismatch with the stated supported backends.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
90% confidence
Finding

The code transmits user-provided text to an external service endpoint using requests.post, and the resolved default host logic may target host-accessible services from inside containers. In this skill context, the transmitted content is memory data, so external transmission meaningfully increases the chance of sensitive data leakage beyond the local process boundary.

Content

Scanner excerpt · rag_memory.py (reported line 193)May include surrounding context.

python
def get_embedding(self, text: str) -> Optional[List[float]]:
        """获取嵌入(需要 Ollama 服务)"""
        try:
            response = requests.post(
                f"{self.ollama_url}/api/embed",
                json={"model": "bge-m3", "input": text},
                timeout=30

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Stored memory content is sent to an external embedding endpoint over HTTP by default, without explicit consent, data classification checks, or a privacy warning. Because this skill is a memory system, the transmitted text may include sensitive prompts, credentials, personal data, or internal context, making unintended disclosure materially risky.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Search queries are also transmitted to the embedding service without clear notice or consent. Queries against a memory system can themselves contain confidential information or reveal user intent, so silent export increases privacy and compliance risk.

Content

No source excerpt is available for this finding.

Tainted flow: 'backup_file' from os.getenv (line 228, credential/environment) → open (file write)

Medium
Category
Data Flow
Confidence
83% confidence
Finding

The backup path is derived from an environment-controlled base directory and then opened for writing without validation or restriction. In deployments where untrusted users can influence environment variables, this can redirect backups to unintended filesystem locations, causing arbitrary file overwrite within the process's permissions and possible data exposure.

Content

Scanner excerpt · rag_memory.py (reported line 242)May include surrounding context.

python
"metadata": metadata or {}
        })
        
        with open(backup_file, "w", encoding="utf-8") as f:
            json.dump(backups, f, ensure_ascii=False, indent=2)
    
    def delete_memory(self, memory_id: int) -> bool:

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The module description and multiple user-facing print strings are in Chinese, indicating a fixed language choice. The file does not offer user opt-in or a configurable locale, which can violate language/locale policy when the skill is meant to be general-purpose.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.