Back to skill

Security audit

Memory Integration

Security checks for vulnerabilities and agentic risk

Overview

This skill has a coherent memory-search purpose, but it broadly processes OpenClaw memory files and sends memory/search metadata through external adapters without clear scoping controls.

Review before installing if your OpenClaw memory may contain private notes, credentials, customer data, or sensitive project details. Confirm what the co-occurrence and semantic-vector adapters store, whether they use remote services, how to delete synced data, and whether you can limit which memory files are processed.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (2)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/memory_integration.py:39
Finding
Agent Memory and Search Metadata Exposed to Unverified External Adapters<![CDATA[ ## Vulnerability Details **File Location**: `scripts/memory_integration.py:39-41, 91-118, 138-200, 242-256, 321-332` **Vulnerability Type**: Excessive access to sensitive Agent memory and delegation across an unverified trust boundary **Risk Level**: Medium ### Vulnerable Code ```python def __init__(self): self.workspace = Path(os.environ.get( 'OPENCLAW_WORKSPACE', '/root/.openclaw/workspace' )) self.memory_dir = self.workspace / 'memory' self.tracker = CoOccurrenceAdapter() ``` ```python def get_all_memory_files(self): files = [] memory_file = self.workspace / 'MEMORY.md' if memory_file.exists(): files.append(memory_file) if self.memory_dir.exists(): files.extend(sorted(self.memory_dir.glob('*.md'))) return files def parse_single_file(self, file_path): memories = [] print(f"Parsing {file_path}") with open(file_path, 'r', encoding='utf-8') as f: content = f.read() lines = content.split('\n') for i, line in enumerate(lines): if line.strip() and not line.startswith('#') and len(line.strip()) > 10: mem_id = self.generate_memory_id(str(file_path), line, i) memory = { 'id': mem_id, 'content': line.strip(), 'file': str(file_path), 'line': i, 'type': 'ltm' if file_path.name == 'MEMORY.md' else 'stm' } if file_path.name != 'MEMORY.md': memory['date'] = file_path.stem memories.append(memory) return memories ``` ```python if len(mem_ids) > 1: self.tracker.record_co_occurrence( mem_ids, f"search:{query[:50]}" ) ``` ```python def semantic_search(self, query: str, limit: int = 10) -> list: if self.vector_store is None: return [] try: results = self.vector_store.search(query, limit) ``` ### Tech ...[truncated 2830 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Require explicit authorization before the first memory synchronization or semantic search. 2. Introduce a configurable allowlist of permitted files and directories rather than automatically processing all memory files. 3. Default to a dedicated, non-sensitive integration directory instead of the entire native memory store. 4. Add a local-only mode that prevents data from reaching adapters backed by remote services. 5. Verify adapter provenance and expose whether each adapter performs local storage, remote storage, or network communication. 6. Do not send raw search queries unless necessary. Redact secrets and sensitive entities, or replace queries with local embeddings generated by a reviewed component. 7. Replace source paths in adapter records with opaque local identifiers. 8. Add retention limits, deletion support, access controls, and encryption for synchronized metadata. 9. Document the trust boundary and precisely disclose which memory-derived fields and query data are passed to each adapter. 10. Honor the documented feature-disable environment variables and fail closed when an adapter's security properties cannot be established. ]]>

T09 · Insecure Skill Coding Practices

Note
Location
scripts/memory_integration.py:84
Finding
Collision-Prone Memory Identifiers Can Merge Unrelated Records<![CDATA[ ## Vulnerability Details **File Location**: `scripts/memory_integration.py:84-88` **Vulnerability Type**: Weak and excessively truncated identifier construction **Risk Level**: Low ### Vulnerable Code ```python def generate_memory_id(self, file_path, content, line_start=0): hash_input = f"{file_path}:{line_start}:{content[:100]}" return f"mem_{hashlib.md5(hash_input.encode()).hexdigest()[:10]}" ``` ### Technical Analysis Memory identifiers are generated using MD5 and then truncated to ten hexadecimal characters, leaving only 40 bits of identifier space. The input also includes only the first 100 characters of the memory content. Consequently, different records with the same path, line position, and first 100 content characters produce identical identifiers regardless of their remaining content. Independent records can also collide because only 40 digest bits are retained. MD5 is not collision resistant and should not be used where an attacker can influence inputs and record identity affects downstream integrity. These identifiers are subsequently used as nodes in co-occurrence tracking and as cross-system memory references. A collision can therefore cause relationships or search metadata belonging to unrelated memories to be merged. ### Attack Path 1. An attacker or untrusted process obtains the ability to add or alter a memory file processed by the Skill. 2. The attacker creates a record whose first 100 characters and source identity match a targeted record, or generates inputs until the truncated 40-bit digest collides. 3. The Skill synchronizes the crafted record and assigns it the same memory identifier as the targeted record. 4. The co-occurrence adapter treats both records as the same logical memory. 5. File, date, and search relationships associated with the crafted record are merged with or attributed to the targeted memory. 6. Enhanced search and downstream cross-system references may then use corrupted associations. A strai ...[truncated 781 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Replace MD5 with SHA-256 or another modern cryptographic hash. 2. Hash the complete normalized content rather than only its first 100 characters. 3. Retain at least 128 bits of the digest; retaining the complete SHA-256 value is preferable when storage permits. 4. Canonicalize the source path and define stable line or record boundaries before hashing. 5. Include a versioned namespace in the input so identifier-generation changes can be migrated safely. 6. Maintain a mapping from each identifier to its full source fingerprint. 7. Detect and reject cases where an existing identifier is presented with a different full fingerprint. 8. If stable identity across file edits is required, use a securely generated UUID stored alongside the record rather than deriving identity solely from mutable content. 9. Add tests covering records that share their first 100 characters, records moved between lines, and intentional duplicate submissions. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (3)

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill explicitly states that it synchronizes OpenClaw memory files into semantic vector and co-occurrence stores, but it does not warn users that potentially sensitive memory contents may be copied into additional storage systems. This creates a real confidentiality and data-governance risk because users may enable or install the skill without understanding that internal notes, secrets, or personal data could be propagated beyond the original memory files.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The module docstring and all user-facing console messages are written exclusively in Chinese, which imposes a specific language on users of the skill. There is no visible opt-in, fallback, or documented justification that this script is intentionally limited to a Chinese-speaking or region-specific context.

Natural-Language Policy Violations

Low
Confidence
98% confidence
Finding
The natural-language instructions and descriptions are presented in Chinese throughout the skill documentation. Under the stated policy, forcing a specific language without user opt-in or an explicit justified locale constraint is a policy violation.

Static analysis

No suspicious patterns detected.