Back to skill

Security audit

QuickRecall - Zero-Dependency Memory Engine. 常用记忆优先出现。零依赖 AI 记忆引擎,纯 Node.js。/ Prioritizes frequently used memories. Zero deps.

Security checks for vulnerabilities and agentic risk

Overview

This is a local memory tool with no network behavior, but its persistent storage and compaction behavior can retain or lose user data in ways users should review first.

Review this before installing if you expect the memory store to contain sensitive information. Do not store secrets or credentials in it, keep backups of MEMORY_STORE.json, and avoid running compaction until the data-loss behavior is fixed or clearly accepted.

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

Warning
Location
memory.js:223
Finding
Persistent memories are stored in plaintext without explicit access restrictions<![CDATA[ ## Vulnerability Details **File Location**: `memory.js:15`, `memory.js:38-53`, `memory.js:223-230` **Vulnerability Type**: Insecure storage of potentially sensitive data **Risk Level**: Medium ### Vulnerable Code ```javascript const DEFAULT_STORE_PATH = join(__dirname, 'MEMORY_STORE.json'); ``` ```javascript add(content, importance, metadata = {}) { if (!content || typeof content !== 'string') throw new Error('Content must be non-empty string'); const trimmed = content.trim(); if (trimmed.length < 1 || trimmed.length > 5000) throw new Error('Content must be between 1 and 5000 characters'); const item = { id: randomUUID(), content: trimmed, timestamp: Date.now(), importance: importance ?? this.#config.defaultImportance, metadata, }; this.#memories.push(item); this.#dirty = true; this.#autoCleanup(); this.#save(); return item; } ``` ```javascript #save() { if (!this.#dirty) return; try { writeFileSync(this.#storePath, JSON.stringify(this.toJSON(), null, 2), 'utf-8'); this.#dirty = false; } catch (err) { console.error(`[memory] Error saving store: ${err.message}`); } } ``` ### Technical Analysis The engine accepts arbitrary memory content and metadata and serializes the complete store to a predictable plaintext JSON file. The write operation does not specify a restrictive file mode, does not encrypt sensitive values, and does not apply any secret-detection or data-classification controls. For a newly created file, Node.js uses the platform default creation mode subject to the process umask. Consequently, confidentiality depends on the runtime environment rather than an explicit security guarantee from the application. If the process has a permissive umask, the store may be readable by unintended local users. If the file already exists, writing it does not correct previously unsafe permissions. Because an AI memory store can contain user preferences, conversation-derived facts, internal ...[truncated 1223 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Store memory files in an operating-system-appropriate, user-private data directory rather than the package directory. 2. Create new store files with an explicit restrictive mode such as `0o600`: ```javascript writeFileSync(this.#storePath, serializedData, { encoding: 'utf8', mode: 0o600, }); ``` 3. Validate and repair the permissions of existing store files before reading or writing them. 4. Document that credentials, authentication tokens, private keys, and other secrets must not be stored unless encryption is enabled. 5. Add optional authenticated encryption for sensitive deployments. Obtain encryption keys from an environment-specific secret manager rather than embedding them in the project. 6. Use atomic writes through a securely created temporary file in the same private directory, then rename it into place. 7. Add automated tests that verify restrictive permissions on supported platforms. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
memory.js:147
Finding
Compaction silently deletes memories below the importance threshold<![CDATA[ ## Vulnerability Details **File Location**: `memory.js:147-187` **Vulnerability Type**: Destructive data-integrity flaw **Risk Level**: Medium ### Vulnerable Code ```javascript compact(groupSize = 5, minImportance = 0.5) { if (groupSize <= 1) return 0; const originalCount = this.#memories.length; const sorted = [...this.#memories].sort((a, b) => a.timestamp - b.timestamp); const newMems = []; for (let i = 0; i < sorted.length; ) { const group = []; let j = i; while (j < sorted.length && (j - i) < groupSize) { if (sorted[j].importance >= minImportance) { group.push(sorted[j]); } j++; } if (group.length >= 2) { const contents = group.map(m => m.content); const summaryText = `[Summary of ${group.length} items: ${contents.map(t => t.length > 60 ? t.slice(0, 57) + '...' : t).join('; ')}]`; const avgImp = group.reduce((s, m) => s + m.importance, 0) / group.length; const newestTs = Math.max(...group.map(m => m.timestamp)); newMems.push({ id: randomUUID(), content: summaryText, timestamp: newestTs, importance: avgImp, metadata: { compacted: true, originalCount: group.length }, }); } else { newMems.push(...group); } i = j; } this.#memories = newMems; this.#autoCleanup(); this.#dirty = true; this.#save(); return originalCount - this.#memories.length; } ``` ### Technical Analysis During each iteration, the method advances over every record in the current window, but only records whose importance is greater than or equal to `minImportance` are added to `group`. Records below the threshold are not added to a separate preserved collection. After processing the window, only `group` or its generated summary is copied into `newMems`. Every below-threshold record is therefore omitted. The method then replaces the complete in-memory collection with `newMems` and persists it, making the loss permanent. ...[truncated 1815 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Define the intended threshold semantics explicitly. If records below the threshold are candidates for compaction, collect those records for summarization and preserve records at or above the threshold unchanged. 2. Maintain separate collections for selected and preserved records. For example: ```javascript const compactable = sorted.filter(m => m.importance < minImportance); const preserved = sorted.filter(m => m.importance >= minImportance); ``` 3. Ensure every original record is either preserved unchanged or represented in a generated summary. Do not omit records implicitly. 4. If deletion below a threshold is intentional, implement it as a separate pruning method with explicit naming, documentation, confirmation, and a dry-run mode. 5. Write the new store only after validating accounting invariants, such as: - Every original ID is preserved or included in summary metadata. - No record outside the selected compaction set is removed. - The reported removal count matches the actual transformation. 6. Include original IDs in summary metadata to support traceability and recovery. 7. Create a backup or atomic snapshot before destructive compaction. 8. Add regression tests covering records below, equal to, and above the threshold, including mixed groups and partial final groups. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (12)

Ae1

High
Category
analysis-evasion
Content
| Copy | Copy `memory.js` + `memo.cjs` to your project |
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Memory Manipulation

High
Category
Memory Poisoning
Content
Get a single memory by ID. Increments hit_count.

#### `delete(id) -> boolean`
Delete memory by ID. Returns true if existed.

#### `compact(groupSize=5, minImportance=0.5) -> Array`
Compact low-importance memories into summaries.
Confidence
80% confidence
Finding
The documented delete and compact capabilities allow an agent to remove or rewrite stored memories, and compaction merges original records into summaries that may discard fidelity or alter meaning. In a memory system used by autonomous agents, these features can be abused to erase evidence, manipulate future model behavior, or degrade integrity of historical context if not tightly authorized and audited.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The README states that the memory system uses local file persistence and is automatically invoked during startup, but it does not clearly warn users that data will be written and retained without explicit per-use confirmation. In an agent context, automatic persistence can capture prompts, secrets, or sensitive workspace content unexpectedly, increasing privacy and integrity risk even without any network access.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
This markdown file describes automatic storage to `MEMORY_STORE.json` and later mentions auto-pruning and compaction, but it does not provide a clear user warning about the privacy and data-integrity impact of persisting potentially sensitive memories locally. Because the skill handles user memory and can automatically modify or prune stored entries, users should be explicitly warned in the documentation.

Natural-Language Policy Violations

Medium
Confidence
77% confidence
Finding
The file header comments are written in Chinese and there is no indication elsewhere in this file that language choice is optional or that the skill is intentionally region-specific. This can violate a language/locale policy when a skill imposes a specific language without user opt-in.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The add path persists arbitrary user-provided memory content directly to a local JSON file with no consent gate, sensitivity filtering, or encryption. In a memory engine for AI agents, this can silently retain secrets, personal data, prompts, or tokens beyond the user’s expectations, increasing privacy and data exposure risk if the host or file is accessed.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The remove and clear operations irreversibly delete stored memories and immediately save the modified state without any confirmation, soft-delete, or recovery mechanism. In a persistent memory component, accidental or indirect invocation can cause permanent loss of agent state, user data, or operational context, impacting integrity and availability.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The API spec explicitly describes persistent local storage plus destructive operations like deletion and compaction, but provides no warning about retention, overwriting, summarization, or user-consent boundaries. In an agent context, this can lead to silent collection, long-term storage, and mutation of potentially sensitive user data without clear operator awareness or safeguards.

Natural-Language Policy Violations

Low
Confidence
93% confidence
Finding
The README is entirely in Chinese and does not indicate that the user can choose another language or that the locale restriction is intentional and justified. This can violate language/locale policy where skills should not force a specific language without user opt-in.

Natural-Language Policy Violations

Low
Confidence
83% confidence
Finding
The markdown presents the skill name using Chinese text (`记忆增加引擎`) in an otherwise English document, which can be interpreted as imposing a specific language presentation without user opt-in. There is no accompanying explanation that the skill is bilingual or region-specific.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
The code formats dates with a hard-coded 'zh-CN' locale, which imposes a specific language/locale choice on users. This is a natural-language policy concern because the tool does not offer any locale selection or document that it is region-specific.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
This output path also hard-codes 'zh-CN' when rendering dates, requiring all users to view dates in a specific locale. The file does not provide a choice or justification for this locale restriction.

Static analysis

No suspicious patterns detected.