Back to skill

Security audit

Auto Memory Distiller

Security checks for vulnerabilities and agentic risk

Overview

This skill has a coherent memory-distillation purpose, but it automatically reads broad local conversation history, sends raw chat text to Gemini, and writes persistent memory without clear user approval or local redaction.

Install only if you are comfortable with your OpenClaw conversation history being automatically processed and sent to Google's Gemini API. Before using it, prefer adding explicit opt-in, session allowlists, local secret redaction, dependency pinning, and review controls for memory writes; avoid enabling cron or heartbeat execution until those controls exist.

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 (3)

T09 · Insecure Skill Coding Practices

Error
Location
distiller.py:137
Finding

Raw conversation history is transmitted to an external API before local redaction

Content
View full analysis
= total_lines: continue current_line = last_read_line while current_line < total_lines: chunk_end = min(current_line + CHUNK_SIZE_MESSAGES, total_lines) chunk_lines = lines[current_line:chunk_end] conversation_text = "" for i, line in enumerate(chunk_lines): try: data = json.loads(line) role = data.get("message", {}).get("role", "unknown").upper() content_list = data.get("message", {}).get("content", []) text = "".join([ c.get("text", "") for c in content_list if c.get("type") == "text" ]) if text.strip(): conversation_text += ( f"[{current_line + i + 1}] {role}: {text}\n" ) except: continue if conversation_text.strip(): existing_topics = get_existing_topics() results = distill_chunk( session_id, current_line + 1, chunk_end, conversation_text, existing_topics ) ``` ### Technical Analysis The skill reads every nonempty JSONL session b ...[truncated 1596 chars]
Remediation
View remediation

T02 · Agent Memory Poisoning

Error
Location
distiller.py:57
Finding

Untrusted conversation content can poison persistent agent memory

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:13
Finding

Dependency installation instructions use mutable unpinned package versions

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • YARA SignaturesMalware Match, Webshell Match, Cryptominer Match
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (10)

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

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

�物理文件路径和行号。

依赖配置 (Prerequisites)

脚本默认使用 Gemini API,依赖以下 Python 库:

bash
pip install google-genai python-dotenv

请在系统的环境变量,或者 ~/.openclaw/workspace/.env 中配置你的密钥:

env
GEMINI_API_KEY=your_gemini_api_key_here

使用方法 (Usage)

无需人工干预。建议把该脚本绑定到系统的 crontab 或者通过 OpenClaw 的 heartbeat 在闲暇时自动触发:

bash
# 手动运行
python ~/.openclaw/workspace/skills/auto-distiller/distiller.py

存储目录 (Directory Structure)

  • distiller.py: 核心脚本。
  • state.json: 游标记录文件(自动生成)。
  • 输出的记忆目录: ~/.openclaw/workspace/memory/topics/*.md

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · distiller.py (reported line 18)May include surrounding context.

python
TOPICS_DIR = WORKSPACE_DIR / "memory" / "topics"
STATE_FILE = SKILL_DIR / "state.json"

# Attempt to load a generic .env file from the workspace if it exists
load_dotenv(WORKSPACE_DIR / ".env")

API_KEY = os.getenv("GEMINI_API_KEY") or os.getenv("GOOGLE_API_KEY")

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · distiller.py (reported line 29)May include surrounding context.

python
TOPICS_DIR = WORKSPACE_DIR / "memory" / "topics"
STATE_FILE = SKILL_DIR / "state.json"

# Attempt to load a generic .env file from the workspace if it exists
load_dotenv(WORKSPACE_DIR / ".env")

API_KEY = os.getenv("GEMINI_API_KEY") or os.getenv("GOOGLE_API_KEY")

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · distiller.py (reported line 19)May include surrounding context.

python
STATE_FILE = SKILL_DIR / "state.json"

# Attempt to load a generic .env file from the workspace if it exists
load_dotenv(WORKSPACE_DIR / ".env")

API_KEY = os.getenv("GEMINI_API_KEY") or os.getenv("GOOGLE_API_KEY")

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
71% confidence
Finding

The file presents the skill instructions and operational description entirely in Chinese, with only section-label translations in parentheses. There is no indication that users may choose another language or that the Chinese-only presentation is required for a region-specific or compliance-related reason.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill explicitly describes silent background processing of long conversation logs into structured long-term memory, but does not warn the user about ongoing collection, transformation, and storage of potentially sensitive conversational data. This creates a real privacy and consent risk because users may not realize their chats are being persistently analyzed and written to files with source pointers.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The prompt explicitly instructs the model to extract and persist facts, decisions, and code snippets from conversations into long-term memory topic files. Persisting conversation-derived knowledge can retain sensitive or private information beyond the original session, especially since redaction is delegated to the model and not enforced locally.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill sends raw conversation text from local session files to Google's Gemini API for summarization without any explicit consent, warning, or data-minimization gate. Because session logs may contain secrets, personal data, or other sensitive content, this creates a real privacy and data-exfiltration risk even though the code asks the model to redact secrets in its output.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

User-visible output is presented in Chinese, and the prompt content and status messages throughout the file are also Chinese-only. This forces a specific language/locale experience without opt-in or explanation, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

Multiple printed status and error messages are Chinese-only, including startup, progress, failure, and completion notices. Because the skill does not provide a language selection or justify a region-specific scope, this is a natural-language locale policy concern.

Content

No source excerpt is available for this finding.