Back to skill

Security audit

Memory V2

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent memory-system skill, but it persists sensitive conversation data and exposes destructive or broad memory operations with weak safety and privacy controls.

Review this before installing in any environment that may store private conversations, documents, secrets, or regulated data. Configure explicit retention and deletion policies, avoid automatic maintenance until operators understand compression/archive behavior, restrict who can call get/delete APIs, validate memory IDs, and update the flagged dependencies. Treat any configured LLM summarizer as a potential data egress path unless it is known to be local or otherwise approved.

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/vector-store.js:211
Finding

LanceDB Predicate Injection Through Unsanitized Memory IDs

Content
View full analysis

Vulnerability Details

File Location: src/vector-store.js:211-218 and src/vector-store.js:228-234
Vulnerability Type: SQL-like predicate injection
Risk Level: Medium

Vulnerable Code

javascript
async getMemory(id) {
  if (!this.initialized) {
    await this.initialize();
  }

  const results = await this.collection
    .filter(`id = '${id}'`)
    .execute();

  return results.length > 0 ? results[0] : null;
}
javascript
async deleteMemory(id) {
  if (!this.initialized) {
    await this.initialize();
  }

  await this.collection.delete(`id = '${id}'`);
  this.emit('memory-deleted', { id });
}

Technical Analysis

The getMemory(id) and deleteMemory(id) methods interpolate a caller-controlled memory identifier directly into LanceDB SQL-like predicate strings. The identifier is enclosed in single quotes but is neither escaped nor validated.

A crafted identifier containing a quote followed by supported predicate syntax can terminate the intended string literal and modify the filter condition. Consequently, the database may evaluate a predicate broader than the intended exact-ID comparison.

Both vulnerable methods are reachable through the public MemorySystem.getMemory(id) and MemorySystem.deleteMemory(id) interfaces. The exact payload syntax depends on the predicate grammar supported by the deployed LanceDB version, but direct interpolation creates the exploitable injection boundary.

Attack Path

  1. An attacker obtains access to an application operation that forwards a memory ID to MemorySystem.getMemory() or MemorySystem.deleteMemory().
  2. The attacker supplies an ID containing a quote and additional LanceDB predicate syntax.
  3. MemorySystem forwards the identifier to VectorStore without validation.
  4. VectorStore constructs a predicate such as id = '${id}' using direct string interpolation.
  5. LanceDB parses the injected characters as part of the predicate rather than as a literal identifier. ...[truncated 1015 chars]
Remediation
View remediation

Remediation Suggestions

  1. Use LanceDB parameterized predicates or a typed query API if the deployed version supports them. Keep untrusted values separate from predicate syntax.

  2. If parameter binding is unavailable, enforce a strict identifier format before every database operation. For example:

javascript
function validateMemoryId(id) {
  if (typeof id !== 'string' || !/^[A-Za-z0-9_.:-]{1,128}$/.test(id)) {
    throw new TypeError('Invalid memory ID');
  }
  return id;
}

Apply this validation consistently in addMemory, getMemory, deleteMemory, updateMemory, and batch operations so that invalid identifiers cannot enter or query the database.

  1. Do not rely solely on manual quote escaping. If escaping is unavoidable, use a LanceDB-documented literal-escaping routine and centralize predicate construction in one helper.

  2. Add authorization checks in the integrating application so a caller can access or delete only memories belonging to its user, tenant, or session.

  3. Add regression tests covering identifiers containing single quotes, backslashes, comment markers, boolean operators, Unicode control characters, oversized values, and malformed predicate fragments. Verify that such values are rejected before reaching LanceDB.

  4. For destructive operations, consider transactional safeguards, deletion limits, audit logging, and backups to reduce the impact of an unexpectedly broad predicate.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (41)

Known Vulnerable Dependency: protobufjs==6.11.4 — 11 advisory(ies): CVE-2026-44294 (protobuf.js: Denial of service from crafted field names in generated code); CVE-2026-44293 (protobuf.js: Code injection through bytes field defaults in generated toObject c); CVE-2026-44289 (protobuf.js: Denial of service through unbounded protobuf recursion) +8 more

Critical
Category
Supply Chain
Confidence
96% confidence
Finding

protobufjs 6.11.4 is a real and important vulnerable dependency because the listed advisories include denial of service and code-generation/injection classes of issues. In an ML/vector-memory stack that may ingest remote models, metadata, or serialized artifacts, vulnerable protobuf handling can materially expand attack surface if untrusted protobuf content or code generation features are reachable.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 130)May include surrounding context.

md
import NERExtractor from './src/ner-extractor.js';

Known Vulnerable Dependency: axios==1.13.6 — 16 advisory(ies): CVE-2026-44494 (axios Vulnerable to Full Man-in-the-Middle via Prototype Pollution Gadget in `co); CVE-2026-44495 (axios Vulnerable to Credential Theft and Response Hijacking via Prototype Pollut); CVE-2025-62718 (Axios has a NO_PROXY Hostname Normalization Bypass that Leads to SSRF) +13 more

High
Category
Supply Chain
Confidence
97% confidence
Finding

axios 1.13.6 is a real vulnerable dependency finding, especially because this project includes network-capable components and axios is a direct dependency of @lancedb/lancedb. Advisories involving SSRF, proxy bypass, credential leakage, or prototype-pollution-assisted request tampering can become serious when the application makes requests to user-influenced URLs or operates in environments with sensitive network access.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: form-data==4.0.5 — 1 advisory(ies): CVE-2026-12143 (form-data: CRLF injection in form-data via unescaped multipart field names and f)

High
Category
Supply Chain
Confidence
92% confidence
Finding

form-data 4.0.5 is flagged for CRLF injection via unescaped multipart field names/filenames. If this package is used to build multipart requests from attacker-controlled metadata, it can enable request smuggling or header/body manipulation toward downstream services.

Content

No source excerpt is available for this finding.

Known Vulnerable Dependency: sharp==0.32.6 — 2 advisory(ies): GHSA-f88m-g3jw-g9cj (sharp inherited vulnerabilities in libvips: CVE-2026-33327, CVE-2026-33328, CVE-); GHSA-rgj7-g3m4-5g8c (sharp: Vulnerabilities in libheif: GHSA-g89c-p67h-r497 and GHSA-2jg2-4ch7-h545)

High
Category
Supply Chain
Confidence
94% confidence
Finding

sharp 0.32.6 is a real vulnerable dependency with inherited image parsing issues in native libraries such as libvips/libheif. If the skill processes untrusted images, these bugs can lead to denial of service, memory corruption, or potentially code execution in the native image-processing layer.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

This method removes the entire memories table and rebuilds it, which is an irreversible bulk data loss operation. The code emits a post-action event but provides no prior warning, confirmation, or prominent documentation of the destructive effect.

Content

No source excerpt is available for this finding.

Memory Manipulation

High
Category
Memory Poisoning
Confidence
80% confidence
Finding

Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Content

Scanner excerpt · test/vector-store.test.js (reported line 90)May include surrounding context.

js
assert(memory.content === '这是更新后的测试记忆');
  });

  it('should delete memory', async () => {
    await store.deleteMemory('test_001');
    
    const memory = await store.getMemory('test_001');

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The documented default configuration hard-codes Chinese embedding and NER models, and the surrounding guide is written as if Chinese is the expected operating language. Because no opt-in, alternative locale selection, or justification for a China-specific deployment context is provided, this appears to impose a language/locale choice.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The documentation exposes deletion and maintenance operations, including forgetting, compression, and archiving, without warning that these actions may be irreversible or may alter retention behavior. This can lead operators to unintentionally destroy records needed for recovery, compliance, or user expectations, especially in a long-term memory component.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The guide explicitly demonstrates persisting full user and assistant conversation text, which can include personal data, secrets, or regulated information, but provides no privacy notice, minimization guidance, retention limits, or consent controls. In a memory subsystem, this normalizes broad collection and long-term storage of sensitive conversational content, increasing the risk of privacy violations and unauthorized disclosure.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The natural-language description and examples position the skill as Chinese-only or Chinese-preferred, including Chinese NER and Chinese-specific models, while the documentation does not present this as an explicit user choice or narrowly justified locale restriction. Under the policy, forcing a specific language/locale without opt-in can be a violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill documents a persistent memory system that stores user-provided content locally, including examples containing personal data, but it does not clearly warn users about retention, sensitivity, or safe handling of stored memories. This can lead to unintentional storage of sensitive personal information and increases privacy and data-governance risk, especially because the feature is explicitly designed to retain and search prior content.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The clear() method irreversibly removes in-memory graph data and deletes the backing files with fs.unlink, but it does not prompt for confirmation or provide any user-facing warning before doing so. Although the file contains technical comments, they are not a disclosure to the user of the destructive behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

Natural-language strings in the file, including the module documentation and summarization prompt, are written to operate in Chinese and the prompt explicitly asks for a Chinese summary. There is no indication that the user can choose language or that the locale restriction is intentional and justified for a region-specific use case.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

forgetLowPriorityMemories() automatically compresses memory content and then marks it archived, altering stored data in a way that may discard detail and make recovery difficult if the original content is not preserved elsewhere. In a memory-management component, silent automated mutation of persisted records can cause integrity and availability issues for user data, especially when driven by heuristic scoring and thresholds.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The code sends raw memory content directly to an external LLM for summarization via this.llm.generate(prompt) without any consent gate, sensitivity filtering, or indication that stored memories may leave the local trust boundary. Because memories may contain personal, confidential, or otherwise sensitive data, this creates a real privacy and data-handling risk rather than a purely informational issue.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The deleteMemory method permanently removes data from the vector store and graph store, then saves the change, but there is no confirmation prompt or user-visible warning around this destructive action. Although the method name implies deletion, this file itself provides no disclosure beyond a brief developer-oriented comment/docstring.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The top-level comments describe the file as a Transformers.js-based NER/entity extraction module, which implies extracting entities from text. However, extractAndLink also mutates an external graph store by creating new nodes and linking entities, which is a materially different behavior from pure extraction.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The default model is set to 'Xenova/bge-large-zh-v1.5', which imposes a Chinese-language-oriented embedding choice by default. The file does not state that this is a region/language-specific tool or provide user opt-in or selection for other locales.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This code sends arbitrary input text to the embedding pipeline for processing, and the surrounding method handles memory content that may contain user data. Although the file has technical comments and some logging for initialization, it does not disclose to users that stored/query text will be processed by the embedding model during add/search operations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The skill deletes stored memories directly via collection.delete, and similar destructive behavior is also used in update flows and full clear operations. While method names indicate deletion semantically, there is no confirmation prompt or explicit warning comment/logging that these operations permanently remove data.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The file's human-readable text, including the title comment and later comments/test data, is written in Chinese with no indication that the skill or project is intentionally locale-specific. Under the stated policy, forcing a specific language without opt-in can be a language/locale policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The file mixes code with Chinese-only natural-language comments and test descriptions such as '简化版测试', '添加第二个节点', and '清理测试数据'. This imposes a specific language on maintainers and users of the skill artifact without any opt-in or documented locale constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The comment "MemoryManager 测试" indicates the file's natural-language content is written in Chinese, and similar Chinese-only strings appear throughout the tests. Under the stated policy, forcing a specific language without user opt-in or documented justification is a locale/language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The string logged at runtime, "MemoryManager tests completed", is English here, but the surrounding natural-language content in the file is predominantly Chinese and no language choice or justification is provided. The file therefore presents a language policy concern due to fixed-language natural-language content.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.