Back to skill

Security audit

๐ŸŒ™ dreaming-optimizer

Security checks for vulnerabilities and agentic risk

Overview

The skill is a disclosed memory optimizer, but it persistently stores user memory content with limited controls and has local storage safety issues users should review before installing.

Install only if you are comfortable with the skill reading OpenClaw memory notes and writing long-term local memory. Review or fix storage permissions, restrict agent names, and make sure you have a way to inspect and delete committed memories, archives, and summaries before relying on it with sensitive notes.

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
lib/blayer_client.py:17
Finding

Unsanitized agent name permits SQLite writes outside the intended memory directory

Content
View full analysis
None: """Ensure the B-layer schema exists.""" try: self.db_path.parent.mkdir(parents=True, exist_ok=True) conn = sqlite3.connect(str(self.db_path)) conn.executescript(self.SCHEMA_SQL) conn.commit() conn.close() logger.debug(f"Schema ensured at {self.db_path}") ``` ### Technical Analysis The command-line `--agent` value is used directly to construct the SQLite database path. The code neither restricts the agent value to a filename-safe identifier nor resolves the resulting path and verifies that it remains beneath `~/.openclaw/memory`. In `pathlib`, joining a base path with an absolute path discards the base path. Relative values containing `../` can also traverse outside the intended directory. The `.sqlite` suffix does not prevent traversal or use of an absolute destination. After constructing t ...[truncated 2073 chars]
Remediation
View remediation

T09 ยท Insecure Skill Coding Practices

Warning
Location
lib/blayer_client.py:24
Finding

Sensitive memory databases and archives are created without private filesystem permissions

Content
View full analysis
None: """Ensure the B-layer schema exists.""" try: self.db_path.parent.mkdir(parents=True, exist_ok=True) conn = sqlite3.connect(str(self.db_path)) conn.executescript(self.SCHEMA_SQL) conn.commit() conn.close() logger.debug(f"Schema ensured at {self.db_path}") ``` ```python # bin/commit.py:74-95 def archive_entry(entry: dict, archive_dir: Path = None) -> Optional[Path]: """Archive a low-score entry to dreaming-archives/.""" if archive_dir is None: archive_dir = Path.home() / ".openclaw" / "workspace" / "memory" / "dreaming-archives" try: archive_dir.mkdir(parents=True, exist_ok=True) ts = datetime.now(tz=timezone.utc).strftime("%Y%m%d-%H%M%S") content_preview = (entry.get("content_preview") or entry.get("content", ""))[:50] safe_preview = "".join(c if c.isalnum() else "_" for c in content_preview) filename = f"archived-{ts}-{safe_preview}.md" archive_path = archive_dir / filename content = entry.get("content", "") metadata = ( f"---\n" f"archived_at: {datetime.now(tz=timezone.utc).isoformat()}\n" f"original_score: {entry.get('score', 'unknown')}\n" f"original_source: {entry.get('source_file', 'unknown')}\n" f"tag: {entry.get('tag', 'context')}\n" f"---\n\n{content}" ) archive_path.write_text(metadata, encoding="utf-8") ``` `` ...[truncated 2984 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (24)

Ssd 3

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The design explicitly ingests daily and transient memory content, persists selected entries into long-term SQLite storage, and generates summaries for human consumption. Without data minimization, sensitivity filtering, consent boundaries, or retention controls on the primary memory corpus, the system can accumulate and resurface sensitive user content well beyond the original session context.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The summary step creates an additional output channel that derives from collected memory entries and is described as traceable and human-readable. That increases exposure because sensitive content may be duplicated into JSON artifacts, broadening access paths, backup surfaces, and accidental disclosure risk.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
94% confidence
Finding

This design step explicitly persists session-derived memory into SQLite and emits JSON summaries, confirming intentional cross-session retention. Session persistence is risky here because the stored material originates from daily notes and transient memory, which may contain sensitive data not appropriate for durable storage or later resurfacing.

Content

Scanner excerpt ยท DESIGN.md (reported line 31)May include surrounding context.

md
โ”‚                                             โ”‚
โ”‚  [1] DAILY NOTES โ”€โ”€โ–บ [2] SCORE โ”€โ”€โ–บ [3] DEDUP โ”€โ”€โ–บ [4] TAG โ”€โ”€โ–บ [5] COMMIT โ”€โ”€โ–บ [6] SUMMARY โ”‚
โ”‚       (read)           โ”‚            โ”‚            โ”‚            โ”‚              โ”‚        โ”‚
โ”‚                     threshold      similarity   rule-based   write SQLite   JSON file  โ”‚
โ”‚                       filter         check       classifier   B-layer      human UI  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                    โ”‚

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The design hardcodes Chinese fact terms and later uses Chinese-heavy tagging patterns and test fixtures as core behavior examples, but nowhere states that the skill is intended only for Chinese-language deployments or that users can choose another language. This creates a natural-language locale policy concern because the skill appears to privilege one language by default without opt-in or justification.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
96% confidence
Finding

The data flow specifies writing unique entries and associated metadata to a persistent SQLite database, which creates durable memory beyond the originating session. In this skill's context, that is more dangerous because the pipeline is designed to mine and consolidate broad user-authored notes, increasing the chance that sensitive operational, personal, or confidential content is retained indefinitely.

Content

Scanner excerpt ยท DESIGN.md (reported line 227)May include surrounding context.

md
โ†’ tag_entry(content) โ†’ "fact"|"opinion"|"preference"|"learning"|"context"

  Step 5: Commit to B-layer
          โ†’ Write unique entries to ~/.openclaw/memory/<agent>.sqlite
          โ†’ Fields: id, content, score, tag, source, created_at, updated_at

  Step 6: Generate summary

Ssd 3

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The schema stores full content, previews, source metadata, timestamps, merge links, and audit reasons, creating a rich persistent record of user-provided material. This enlarges the blast radius of any local compromise, accidental sharing, debugging leak, or future misuse because both the original content and contextual metadata are retained together.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
95% confidence
Finding

The commit interface documents writing full content text and previews to the B-layer SQLite store, reinforcing that session-derived data is intentionally retained in persistent storage. Because this includes human-readable content rather than only abstracted features, any compromise or unintended access exposes substantive user memory rather than low-sensitivity metadata alone.

Content

Scanner excerpt ยท DESIGN.md (reported line 527)May include surrounding context.

md
db_path: Path = None,
    dry_run: bool = False,
) -> dict:
    """Write entries to B-layer SQLite.
    
    Args:
        entries: List of entry dicts with keys:

Ssd 3

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The logging guidance explicitly allows token similarity scores and entry content excerpts in DEBUG logs, which can leak private memory content into log files and observability pipelines. Logs are often copied, aggregated, or retained longer than primary data stores, so excerpt logging materially increases disclosure risk.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
91% confidence
Finding

The documented 'commit writer' indicates session data is persisted into long-term memory, which is security-relevant because retained content may include sensitive, incorrect, or adversarially injected information. In an agent memory system, such persistence can affect future decisions and amplify the impact of a single unsafe run.

Content

Scanner excerpt ยท SKILL.md (reported line 20)May include surrounding context.

md
1. **Entry scorer** โ€” LLM-based priority scoring (0โ€“100)
2. **Deduplication** โ€” Semantic similarity merge against existing memories
3. **Fact tagger** โ€” Label as fact/opinion/preference/context
4. **Commit writer** โ€” Write optimized entries to persistent memory
5. **Dreaming summary** โ€” Traceable REM consolidation report
6. **Configurable threshold** โ€” Min score threshold (default: 70)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill explicitly states it will write optimized entries to persistent memory, but the documentation does not warn users that invoking it modifies long-lived state. This can lead to silent data alteration, unintended retention of sensitive information, and hard-to-reverse memory poisoning in an agent context where memory influences future behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The integration section documents writes to a SQLite memory database and summary directory without highlighting that running the skill changes the filesystem persistently. In a memory-management skill, undocumented writes increase the risk of covert state manipulation, leakage of summarized sensitive content, and user surprise about where data is being stored.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The tag classification patterns are hard-coded to recognize only specific Chinese and English phrases, which imposes a language-dependent behavior on how entries are interpreted. Because the file provides no user choice, configuration, or justification for this locale restriction, it can disadvantage content in other languages and conflicts with the language/locale policy criterion.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The docstring for archive_entry claims it archives a "low-score entry," which implies the lowest-quality items are retained there. In commit_to_blayer, entries with scores below archive_threshold are actually discarded, while only entries between archive_threshold and commit_threshold are archived (L158-L183), so the documentation misstates the actual behavior in a way that affects operator understanding of data handling.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The function writes full entry content plus metadata such as source_file, score, and tag to a persistent archive in plain text under a predictable user directory. If entries contain secrets, personal data, internal notes, or sensitive prompts, this creates a durable confidentiality risk through local file exposure, backups, or later accidental disclosure; similar risks also exist where full content is passed into logging/audit paths.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
60% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt ยท bin/optimize.sh (reported line 20)May include surrounding context.

sh
echo ""

# Clean old state (fresh cycle)
mkdir -p "$STATE_DIR"

# โ”€โ”€ Step 1: Score entries โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
echo "๐Ÿ“Š [Step 1/4] Scoring entries..."

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The scoring logic explicitly relies on fixed Chinese and English term lists for fact detection, actionable language, and vague language penalties. This imposes language-specific behavior on users' content without any opt-in, fallback, or documented language selection, which can disadvantage entries written in other languages and violates the locale-choice policy.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This code automatically creates a persistent database directory and file under the user's home directory, then later writes memory content and audit-log entries to it. While the module has internal docstrings and debug logs, there is no user-facing disclosure, confirmation, or visible notice that persistent local storage of memory data will be created and updated.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The commit_entry method writes full content, previews, source file paths, timestamps, and agent metadata into the SQLite database and audit log. Although this behavior is documented in code comments, there is no user-facing print, prompt, or explicit warning that potentially sensitive user data and file metadata will be stored persistently.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
79% confidence
Finding

This code enables file logging and elsewhere emits arbitrary details and context content into logs, which can include user or system data. Although the module is documented as logging utilities, there is no warning in comments or docstrings that sensitive information may be persisted to disk or console output.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The Quick Reference table uses Chinese labels and descriptions, which imposes a specific language on users in the documentation. There is no indication that the skill is intentionally region-specific or that alternative language support is available.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
98% confidence
Finding

The top-level docstring says this file provides "LLM-based priority scoring for memory entries," which communicates a model-driven implementation. In reality, the code scores entries using fixed constants and keyword lists in functions like count_fact_terms, count_actionable_terms, count_vague_terms, and score_entry, with no model calls or inference logic present.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
83% confidence
Finding

The file defines fact terms only for zh and en, which encodes a language-specific behavior in configuration. There is no nearby natural-language explanation that users can choose locale coverage or that the limitation is intentional for a region-specific use case.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This code file contains multiple natural-language string literals in Chinese used as sample content for the skill's tests. Under the stated policy, forcing a specific language without user opt-in can be a locale-policy violation, and there is no indication here that the language choice is optional or justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

This code file contains multiple hardcoded Chinese text samples used as representative content, starting here, with no indication that the skill is intentionally region-specific or that language is configurable. Because SQP-3 applies to all file types and covers language/locale policy violations, forcing a single language in embedded natural-language behavior can be a policy concern.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.