Back to skill

Security audit

Reminiscence-追忆

Security checks for vulnerabilities and agentic risk

Overview

This local memory-search skill is coherent, but it can automatically read private memory files and create persistent plaintext search indexes with loose activation wording and limited retention controls.

Review before installing if your OpenClaw memory may contain secrets, private conversations, client data, or credentials. Use it only when you intentionally want local memory search, inspect or delete ~/.openclaw/memory_bm25_index.json and ~/.openclaw/memory_bm25_token_cache.json as needed, and ensure your ~/.openclaw directory is private to your user account.

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
scripts/search.py:18
Finding

Persistent Plaintext Memory Index Uses Process-Default File Permissions

Content
View full analysis

Vulnerability Details

File Location: scripts/search.py, lines 18–24, 316–317, and 422–449
Vulnerability Type: Plaintext storage of potentially sensitive memory data with insufficient access-control enforcement
Risk Level: Medium

Vulnerable Code

python
WORKSPACE = os.path.expanduser("~/.openclaw/workspace")
MEMORY_PATHS = [
    f"{WORKSPACE}/MEMORY.md",
    f"{WORKSPACE}/memory/*.md",
]
INDEX_PATH = os.path.expanduser("~/.openclaw/memory_bm25_index.json")
TOKEN_CACHE_PATH = os.path.expanduser("~/.openclaw/memory_bm25_token_cache.json")
python
try:
    with open(filepath, 'r', encoding='utf-8') as f:
        content = f.read()
except Exception:
    return []
python
with open(TOKEN_CACHE_PATH, 'w', encoding='utf-8') as f:
    json.dump({f"{k[0]}|||{k[1]}": v for k, v in token_cache.items()}, f, ensure_ascii=False)

N, doc_freqs, avg_dl = get_all_terms(chunks)

index = []
for chunk in chunks:
    term_freqs = Counter(chunk['terms'])
    index.append({
        'text': chunk['text'],
        'file': chunk['file'],
        'start_line': chunk['start_line'],
        'end_line': chunk['end_line'],
        'chunk_idx': chunk['chunk_idx'],
        'heading_hit': chunk['heading_hit'],
        'tf': dict(term_freqs),
        'terms_set': list(set(chunk['terms'])),
    })

data = {
    'N': N,
    'doc_freqs': dict(doc_freqs),
    'avg_dl': avg_dl,
    'chunks': index,
}

with open(INDEX_PATH, 'w', encoding='utf-8') as f:
    json.dump(data, f, ensure_ascii=False)

Technical Analysis

The index builder reads the complete contents of the configured memory files and stores each chunk's plaintext in ~/.openclaw/memory_bm25_index.json. It also creates a token cache containing source paths and derived memory data.

Both output files are opened with ordinary write mode and no explicit restrictive permissions. Their resulting access mo ...[truncated 2018 chars]

Remediation
View remediation

Remediation Suggestions

  1. Ensure ~/.openclaw is owned by the current user and has mode 0700 before writing.
  2. Create the index and token-cache files with mode 0600, rather than relying on the caller's umask. Use os.open() with O_CREAT | O_EXCL | O_WRONLY and mode 0o600, or explicitly apply os.chmod(path, 0o600).
  3. Write data to securely created temporary files in the same protected directory, flush and synchronize them, and publish them with os.replace() to avoid partial or corrupted indexes.
  4. Reject symbolic links and unexpected file types. Use lstat(), O_NOFOLLOW where supported, and verify directory ownership and permissions.
  5. Minimize stored data. If full chunk text is unnecessary for retrieval, avoid duplicating it in the index or store only the minimum required metadata.
  6. Document retention and deletion behavior, and remove or rebuild stale indexes when source memory is deleted or materially changed.
  7. Consider encryption at rest if the threat model includes other privileged local processes or storage-media disclosure.
Vulnerability Patterns
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (6)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill invokes a local Python script that reads memory files and builds a persistent index, which implies file read and file write capabilities, yet the manifest declares no explicit tool scope or permissions. This creates an authorization gap: an orchestrator or reviewer cannot clearly constrain what filesystem access the skill requires, increasing the risk of over-broad local file access if the implementation changes or is triggered unexpectedly.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The top-level description says the skill should trigger for broad phrases like querying memory or '搜一下...', which are common in ordinary conversation and not tightly bound to the skill's intended scope. Overbroad activation can cause unintended access to local memory content, accidental index construction, or disclosure of sensitive past notes when the user did not clearly request memory retrieval.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The build instructions state that the skill will generate an index, but they do not clearly inform the user that local memory files will be read and their contents transformed into a persistent JSON index on disk. For a memory-recall skill, this omission matters because users may not realize sensitive notes are being reprocessed and stored in a secondary artifact that could remain accessible after the original interaction.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The automatic trigger section enumerates multiple natural-language patterns and even '任何 memory_search 工具调用' without exclusion rules, ambiguity checks, or consent boundaries. In a memory skill, this is more dangerous because activation directly leads to searching sensitive local records and potentially surfacing private historical content based on loosely matched user phrasing.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains natural-language strings that force a specific language for usage instructions and user-facing interaction. Under the policy, language/locale constraints should be optional or explicitly justified; here there is no opt-in or explanation that the tool is intended only for Chinese-speaking users.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

该文件的用户说明和使用指引完全固定为中文,但文档中没有提供其他语言选项,也没有声明这是面向特定中文用户群体的限定技能。按策略,强制特定语言而未提供用户选择,属于自然语言层面的语言/地区策略风险。

Content

No source excerpt is available for this finding.