Back to skill

Security audit

Liu Longterm Memory

Security checks for vulnerabilities and agentic risk

Overview

This memory skill is purpose-aligned overall, but it asks agents to persist broad conversation details and recommends external processing and restore workflows without enough safeguards.

Review this before installing. Use local-only memory by default, avoid sending conversation history or memory files to external LLM or embedding providers unless you have reviewed the provider and redacted sensitive data, pin the npm package version, avoid global registry changes, check Git remotes before backup, and do not restore archives unless you trust and have inspected their contents.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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 (5)

T09 · Insecure Skill Coding Practices

Error
Location
bin/elite-memory.js:262
Finding

Arbitrary Command Execution Through Unsanitized Restore Filename

Content
View full analysis

Vulnerability Details

File Location: bin/elite-memory.js, lines 262-284
Vulnerability Type: OS command injection
Risk Level: High

Vulnerable code:

js
restore: () => {
  const file = process.argv[3];
  
  if (!file) {
    console.log('Usage: npx liu-longterm-memory restore <backup-file>');
    console.log('\nExample:');
    console.log('  npx liu-longterm-memory restore memory-backup-20260404.zip');
    console.log('  npx liu-longterm-memory restore memory-backup-20260404.tar.gz');
    return;
  }
  
  if (!fs.existsSync(file)) {
    console.log(`✗ File not found: ${file}`);
    return;
  }
  
  console.log(`🧠 Restoring memory from ${file}...\n`);
  
  try {
    if (file.endsWith('.tar.gz') || file.endsWith('.tgz')) {
      execSync(`tar -xzf "${file}"`, { stdio: 'pipe' });
    } else if (file.endsWith('.zip')) {
      execSync(`unzip -o "${file}"`, { stdio: 'pipe' });
    }

Technical Analysis

The restore filename comes directly from process.argv[3] and is interpolated into a command executed through execSync. Because string-form execSync invokes a shell, the shell interprets metacharacters and command substitutions embedded in the filename.

Enclosing the filename in double quotes does not neutralize shell constructs such as $(command) or backtick substitution. The fs.existsSync(file) check only verifies that a file with the supplied literal name exists; it does not make subsequent shell interpolation safe.

Attack Path

  1. An attacker supplies, uploads, or causes the creation of an archive whose filename contains a shell substitution while retaining a supported suffix.
  2. The victim invokes elite-memory restore with that filename.
  3. fs.existsSync confirms that the specially named file exists.
  4. The filename is interpolated into the tar or unzip shell command.
  5. The shell evaluates the embedded substitution before start ...[truncated 502 chars]
Remediation
View remediation

Remediation Suggestions

  • Replace string-form execSync with execFileSync or spawnSync and pass arguments as an array with shell processing disabled:
    js
    const { execFileSync } = require('child_process');
    
    if (file.endsWith('.tar.gz') || file.endsWith('.tgz')) {
      execFileSync('tar', ['-xzf', file], { stdio: 'pipe' });
    } else if (file.endsWith('.zip')) {
      execFileSync('unzip', ['-o', file], { stdio: 'pipe' });
    }
    
  • Resolve the filename to an absolute path and validate that it refers to a regular file.
  • Do not attempt to solve this solely through shell escaping; avoiding a shell is the safer design.
  • Add regression tests using filenames containing spaces, quotes, dollar signs, backticks, semicolons, and command-substitution syntax.

T09 · Insecure Skill Coding Practices

Error
Location
bin/elite-memory.js:278
Finding

Unvalidated Archive Extraction Allows File Overwrite Outside the Intended Memory Area

Content
View full analysis

Vulnerability Details

File Location: bin/elite-memory.js, lines 278-285
Vulnerability Type: Archive path traversal and unsafe file overwrite
Risk Level: High

Vulnerable code:

js
console.log(`🧠 Restoring memory from ${file}...\n`);

try {
  if (file.endsWith('.tar.gz') || file.endsWith('.tgz')) {
    execSync(`tar -xzf "${file}"`, { stdio: 'pipe' });
  } else if (file.endsWith('.zip')) {
    execSync(`unzip -o "${file}"`, { stdio: 'pipe' });
  } else {

Technical Analysis

The CLI extracts an arbitrary archive directly into the current working directory. It does not inspect archive entries before extraction or constrain restoration to the three documented memory locations.

There are no checks for absolute paths, parent-directory components, symbolic or hard links, special files, duplicate entries, or unexpected filenames. The unzip -o option also explicitly permits overwriting existing files without confirmation. Depending on the archive format and extraction utility behavior, malicious path or link entries can target project files or files outside the workspace.

Attack Path

  1. An attacker creates a ZIP or TAR archive containing traversal entries, absolute paths, malicious links, or unexpected project filenames.
  2. The archive is presented as a memory backup.
  3. The victim invokes the restore command from a project or workspace directory.
  4. The CLI extracts all entries without validation and permits overwrites.
  5. Crafted entries overwrite project configuration, agent instruction files, source code, shell configuration, or other files accessible from the extraction context.
  6. Modified executable or configuration content may run later when the user starts the project, shell, or agent.

Impact Assessment

Direct impact includes unauthorized creation and overwrite of files under the invoking user's permissions. If startup files, package scripts, executable project co ...[truncated 265 chars]

Remediation
View remediation

Remediation Suggestions

  • List and validate every archive entry before extraction.
  • Reject entries containing absolute paths, drive prefixes, null bytes, or .. path components.
  • Reject symbolic links, hard links, devices, FIFOs, and other non-regular entries.
  • Permit only the documented paths: SESSION-STATE.md, MEMORY.md, and regular Markdown files beneath memory/.
  • Extract into a newly created private temporary directory rather than directly into the workspace.
  • Resolve each extracted path with path.resolve and verify that it remains beneath the temporary extraction root.
  • Copy validated files into the workspace only after inspection, using explicit overwrite confirmation or an atomic replacement strategy.
  • Apply file-count and uncompressed-size limits to mitigate archive bombs.

T02 · Agent Memory Poisoning

Error
Location
SKILL.md:329
Finding

Attacker-Controlled Conversation Content Is Persisted and Recalled Across Sessions

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 329-343
Vulnerability Type: Persistent agent memory poisoning
Risk Level: High

Vulnerable instructions:

markdown
### On Session Start
1. Read SESSION-STATE.md — this is your hot context
2. Run `memory_search` for relevant prior context
3. Check memory/YYYY-MM-DD.md for recent activity

### During Conversation (Auto-Extraction)
For every user message, scan for extractable facts and act **BEFORE responding** (WAL):

1. **Preference detected?** → Write to `SESSION-STATE.md` + append to `MEMORY.md ## Preferences` + `memory_store` (importance=0.9)
2. **Decision made?** → Write to `SESSION-STATE.md` + append to `MEMORY.md ## Decisions Log` + Git-Notes (SILENTLY)
3. **Deadline/date given?** → Write to `SESSION-STATE.md ## Key Context`
4. **Tech stack mentioned?** → Append to `MEMORY.md ## Projects`
5. **Correction received?** → Update `SESSION-STATE.md` + log to `memory/lessons.md`
6. **Other concrete detail?** → Write to `SESSION-STATE.md ## Key Context`
7. **Backup requested?** (user says "备份" / "backup" / "save memory") → Run `npx liu-longterm-memory backup` (zip) or `npx liu-longterm-memory backup --git` (Git)

Technical Analysis

The Skill instructs the agent to persist broad classes of user-controlled text, including an unrestricted category for any “other concrete detail.” It then instructs future sessions to read and semantically recall that stored content.

The design does not establish a trust boundary between factual memory and executable agent instructions. It provides no required user confirmation, provenance labeling, sanitization, instruction-pattern detection, expiry, or isolation of recalled memory as untrusted data. Consequently, an attacker can phrase behavioral instructions as preferences, decisions, corrections, or project facts and cause them to be stored with high importance.

Attack Path

  1. An attacker submit ...[truncated 1141 chars]
Remediation
View remediation

Remediation Suggestions

  • Require explicit user approval before creating or modifying durable memory.
  • Restrict automatic capture to narrowly structured factual schemas rather than arbitrary text.
  • Store provenance, author identity, creation time, confidence, trust level, and expiry for every entry.
  • Detect and reject instruction-like language, tool directives, safety-policy changes, and requests to conceal behavior.
  • Treat all recalled memory as untrusted reference data and clearly delimit it from system and developer instructions.
  • Never execute commands solely because recalled memory requests them.
  • Provide review, quarantine, rollback, and deletion workflows.
  • Deduplicate and periodically expire memories instead of assigning permanent high importance automatically.

other

Warning
Location
SKILL.md:162
Finding

Conversation and Memory Content May Be Disclosed to External LLM and Embedding Providers

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 162-175
Vulnerability Type: Sensitive data disclosure to third-party services
Risk Level: Medium

Vulnerable instructions:

markdown
#### Mode B: LLM Batch Extraction (智谱免费模型,推荐)

Use ZhipuAI's free GLM-4-Flash model to batch-extract facts from conversation history. Zero cost.

Call the GLM-4-Flash chat completions endpoint with a system prompt:

> "Extract structured facts from the conversation. Return JSON array: [{type, content, importance}]. Types: preference, decision, fact, deadline, correction."

Then write each extracted fact to the appropriate memory layer.

- **Free**: GLM-4-Flash 完全免费,在 https://bigmodel.cn/ 注册获取密钥
- **Automatic**: Extracts preferences, decisions, facts, deadlines
- **国内直连**: No proxy needed
- **80% token reduction** vs raw conversation history

Technical Analysis

The Skill recommends sending conversation history to an external chat-completions service and configuring external embedding providers for memory search. Conversation histories and durable memories can contain credentials, personal information, proprietary source details, business decisions, or other confidential data.

The instructions do not require per-transfer informed consent, data minimization, credential detection, redaction, provider allowlisting, retention review, or classification of data that must remain local. A user enabling the recommended mode may therefore transmit more information than necessary to a third party.

Attack Path

  1. Sensitive data is discussed in a conversation or stored in the memory files.
  2. The user enables the recommended external extraction or embedding mode.
  3. Conversation history or memory content is included in API requests to the configured provider.
  4. The provider receives and processes the sensitive material.
  5. The data becomes subject to the provider's logging, retention, access-control, and ...[truncated 422 chars]
Remediation
View remediation

Remediation Suggestions

  • Default to local extraction and local embedding providers.
  • Obtain explicit, informed consent before sending conversation or memory content externally.
  • Clearly identify the destination provider, transmitted fields, purpose, and applicable retention policy.
  • Apply secret scanning and redaction for API keys, credentials, tokens, personal data, and proprietary identifiers.
  • Send only the minimum excerpts needed for the requested operation rather than complete conversation histories.
  • Maintain a configurable provider allowlist and require TLS endpoints.
  • Offer workspace-level policies that prohibit external processing for sensitive projects.
  • Record auditable metadata for external transfers without logging the sensitive payload itself.

T08 · Insecure Dependencies

Warning
Location
SKILL.md:509
Finding

Documentation Encourages Unpinned Package Execution and Global Use of an Alternate Registry

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 509-516
Vulnerability Type: Software supply-chain exposure
Risk Level: Medium

Vulnerable instructions:

markdown
### 安装加速

```bash
# 使用 npmmirror 镜像加速安装
npx --registry https://registry.npmmirror.com liu-longterm-memory init

# 或全局设置镜像
npm config set registry https://registry.npmmirror.com
text

### Technical Analysis

The documented `npx` command executes the package without pinning an audited version or verifying package integrity. Depending on local npm behavior and cache state, `npx` can retrieve and execute a newer package release at invocation time.

The documentation also recommends globally changing npm's registry. That modification affects unrelated future package installations, expanding the trust boundary from this Skill to all packages subsequently resolved through that registry. The audit did not establish that the named registry is malicious; the issue is the unsafe, unpinned execution and broad configuration change.

### Attack Path

1. A package publisher account, package release, dependency path, or configured registry is compromised.
2. A malicious or unexpected package version becomes the version selected by the unpinned command.
3. A user follows the documented `npx` command.
4. npm downloads and executes the selected package code locally.
5. If the global registry command was used, future npm operations may also resolve through the alternate registry, increasing exposure beyond this package.

### Impact Assessment

Compromised package code can execute with the privileges of the invoking user and access project files, user-readable credentials, environment variables, and network resources. A global registry change broadens the potential impact to later installations in unrelated projects. No direct privilege escalation beyond the invoking account is demonstrated.
Remediation
View remediation

Remediation Suggestions

  • Pin commands to a reviewed release, for example by using an exact package version.
  • Prefer installation from a lockfile followed by execution of the locally installed binary.
  • Verify npm integrity metadata and package provenance where supported.
  • Avoid recommending global registry changes; use a command-scoped registry only when necessary.
  • Document the trust implications of third-party mirrors and provide the official registry as the secure default.
  • Use organization-level allowlists and immutable internal mirrors for controlled environments.
  • Re-audit package updates before changing the pinned version.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (66)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The description substantially overstates the code's capabilities. The code is a straightforward filesystem-based memory CLI: it initializes SESSION-STATE.md, MEMORY.md, and daily logs; reports status; backs up via zip/tar or normal git add/commit/push; and restores from archives. It does not implement a write-ahead log protocol, vector indexing/search, git-notes storage, or any cloud backup provider. The only vector-related behavior is a passive check for whether a LanceDB path exists, which is not the same as providing vector search. Likewise, git backup uses regular commits, not git-notes. Therefore the declared description does not accurately represent the actual behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill proposes sending conversation history to an external LLM service for fact extraction without a prominent warning that chat content leaves the local environment. This can expose confidential prompts, credentials, proprietary code context, or personal data to third parties and to provider retention policies.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

Batch extraction from full conversation history using an external LLM exposes large amounts of user content in one operation, magnifying the impact of accidental or unauthorized transmission. Because the workflow is presented as recommended and free, users may adopt it without appreciating the sensitivity of the data involved.

Content

No source excerpt is available for this finding.

Ssd 3

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill instructs the agent to automatically capture broad categories of user-provided details across multiple persistent layers before responding, including an open-ended 'other concrete detail' rule. In context, this substantially increases privacy risk because it encourages indiscriminate retention of sensitive content and creates multiple copies that are harder to audit or delete.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

The explicit path rm -rf ~/.openclaw/memory/lancedb/ is a high-risk deletion primitive embedded in documentation. Although scoped more narrowly than rm -rf ~, it still enables irreversible wiping of persisted memory and could be dangerous if adapted incorrectly by users or agents.

Content

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

md
memory_recall query="*" limit=50

# Clear all vectors (nuclear option)
rm -rf ~/.openclaw/memory/lancedb/   # or ~/.clawdbot/memory/lancedb/
openclaw gateway restart

# Export Git-Notes

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

The explicit path rm -rf ~/.openclaw/memory/lancedb/ is a high-risk deletion primitive embedded in documentation. Although scoped more narrowly than rm -rf ~, it still enables irreversible wiping of persisted memory and could be dangerous if adapted incorrectly by users or agents.

Content

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

md
memory_recall query="*" limit=50

# Clear all vectors (nuclear option)
rm -rf ~/.openclaw/memory/lancedb/   # or ~/.clawdbot/memory/lancedb/
openclaw gateway restart

# Export Git-Notes

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The README instructs users to run the package via npx liu-longterm-memory without pinning a specific version. This causes execution of whatever version is current at install time, which creates a supply-chain risk if a malicious or compromised release is published later.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The documentation recommends executing the package through npx without a version constraint. Because npx fetches the latest matching package, users may unknowingly run a newly published malicious or breaking version.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

Using unpinned npx liu-longterm-memory in setup instructions exposes users to supply-chain compromise through future package updates. In an agent-memory tool, this is more sensitive because the tool is expected to handle project context and may process repositories or local files.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The backup and restore commands are presented as simple examples without warning that they can modify local files, overwrite existing memory state, or push data to remote Git repositories. In a memory-management tool, users may assume these are safe housekeeping actions and unintentionally lose data or expose sensitive memory contents.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The backup command is shown with an unpinned npx invocation, so users could execute an unintended package version while performing filesystem-affecting operations. This elevates risk because backup functionality typically reads and writes many local files.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The README shows npx liu-longterm-memory backup --git without version pinning, combining supply-chain risk with Git operations that may commit and push repository data. A malicious future release could abuse repository credentials or exfiltrate memory content.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The restore example invokes the package via unpinned npx, which is risky because restore operations are inherently destructive or state-altering. If a malicious package version were served, users might execute harmful file overwrite logic under the guise of restoration.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The README states that the agent auto-extracts facts from every conversation, but it does not clearly warn users that sensitive prompts, personal data, credentials, or proprietary context may be persisted or sent to an external model in LLM batch mode. For a long-term memory skill, this context makes the issue more dangerous because continuous capture and retention are core behavior, increasing privacy and compliance exposure.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The backup section advertises Git remote synchronization without a clear warning that memory files may be uploaded to an external repository. In the context of an agent memory tool, backups can contain sensitive project context, personal preferences, and internal notes, so omission of an explicit off-device disclosure increases privacy and confidentiality risk.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

The README instructs users to execute an unpinned package directly with npx from a registry mirror, which fetches and runs whatever version is current at execution time. If the package is compromised, typosquatted, or the mirror serves a malicious update, users may execute attacker-controlled code immediately on their machine.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

This command runs the package via npx without pinning a version, so execution depends on the latest published artifact at runtime. That creates supply-chain risk: a compromised maintainer account or malicious release could lead to arbitrary code execution on user systems.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

Using npx liu-longterm-memory status without a pinned version causes users to download and execute whatever version is currently published. In a security-sensitive tool that handles memory and backup workflows, that exposes users to remote code execution and data access if the package distribution is compromised.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

This unpinned npx invocation executes the latest package version when creating daily logs. Because npx runs package code locally, any malicious or hijacked release could modify files, exfiltrate data, or persist on the host.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The backup command is presented as an unpinned npx execution, which means users may run newly published code without review. Since the command touches backup data, a malicious package could access sensitive memory files and transmit or tamper with them.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The git backup workflow is invoked via unpinned npx, adding supply-chain risk to a command that may interact with git remotes and sensitive memory files. If a malicious release is pulled, it could both execute arbitrary code and push confidential data elsewhere.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The restore command uses unpinned npx, so users may fetch and execute an unexpected package version during a sensitive recovery workflow. A compromised release could overwrite files, implant persistence, or steal restored data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The README promotes automatic extraction of conversation facts via an external LLM service but does not clearly warn that conversation content may be transmitted off-device. Because this skill is a long-term memory system, the data involved may include sensitive preferences, decisions, deadlines, and other private context, making undisclosed transmission materially risky.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · README_CN.md (reported line 154)May include surrounding context.

md
|--------|---------|------|----------|
| **智谱AI** | `https://open.bigmodel.cn/api/paas/v4` | `embedding-3` | 2500 万 tokens 免费 |
| **Ollama(本地)** | `http://localhost:11434/v1` | `nomic-embed-text` | 完全免费离线 |
| **DeepSeek** | `https://api.deepseek.com/v1` | `deepseek-embedding` | 有免费额度 |
| **通义千问** | `https://dashscope.aliyuncs.com/compatible-mode/v1` | `text-embedding-v3` | 有免费额度 |
| **OpenAI** | `https://api.openai.com/v1` | `text-embedding-3-small` | 付费 |

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

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

md
|--------|---------|------|----------|
| **智谱AI** | `https://open.bigmodel.cn/api/paas/v4` | `embedding-3` | 2500 万 tokens 免费 |
| **Ollama(本地)** | `http://localhost:11434/v1` | `nomic-embed-text` | 完全免费离线 |
| **DeepSeek** | `https://api.deepseek.com/v1` | `deepseek-embedding` | 有免费额度 |
| **通义千问** | `https://dashscope.aliyuncs.com/compatible-mode/v1` | `text-embedding-v3` | 有免费额度 |
| **OpenAI** | `https://api.openai.com/v1` | `text-embedding-3-small` | 付费 |