Back to skill

Security audit

Self Evolution Engine

Security checks for vulnerabilities and agentic risk

Overview

This skill is not malicious, but it deserves review because it reads persistent OpenClaw memory/learning files and is designed around changing long-lived agent behavior.

Install only if you intentionally want a skill that analyzes prior OpenClaw memory/learnings and may guide long-term behavior changes. Review outputs before integrating any rule, avoid running it automatically, and do not use it on workspaces containing secrets or sensitive transcripts unless you add redaction and explicit source scoping.

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

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/evolution.py:16
Finding

Unscoped Collection and Processing of Sensitive Workspace Learnings

Content
View full analysis

Vulnerability Details

File Location: scripts/evolution.py, lines 16-76
Vulnerability Type: Unrestricted access to persistent agent interaction data
Risk Level: Medium

Vulnerable Code

python
# Default paths
WORKSPACE = Path.home() / ".openclaw" / "workspace"
LEARNINGS_DIR = WORKSPACE / ".learnings"
MEMORY_DIR = WORKSPACE / "memory"
MEMORY_FILE = WORKSPACE / "MEMORY.md"
EVOLUTION_LOG = WORKSPACE / ".evolution" / "evolution-log.md"


def ensure_evolution_dir():
    """Ensure evolution directory exists."""
    evol_dir = WORKSPACE / ".evolution"
    evol_dir.mkdir(parents=True, exist_ok=True)
    return evol_dir


def parse_date(date_str: str) -> Optional[datetime]:
    """Parse various date formats."""
    formats = [
        "%Y-%m-%d",
        "%Y-%m-%dT%H:%M:%S",
        "%Y-%m-%dT%H:%M:%SZ",
        "%d %b %Y",
        "%b %d, %Y",
    ]
    for fmt in formats:
        try:
            return datetime.strptime(date_str.strip(), fmt)
        except ValueError:
            continue
    return None


def extract_learnings(days: int = 30) -> list:
    """Extract learning entries from .learnings/ directory."""
    learnings = []
    cutoff = datetime.now() - timedelta(days=days)

    if not LEARNINGS_DIR.exists():
        return learnings

    for file_path in LEARNINGS_DIR.glob("*.md"):
        content = file_path.read_text(encoding="utf-8")

        # Split into entries
        entries = re.split(r'^##\s+\[', content, flags=re.MULTILINE)[1:]  # Skip header

        for entry in entries:
            # Extract date
            date_match = re.search(r'\*\*Logged\*\*:\s*(.+?)(?:\n|$)', entry)
            if date_match:
                entry_date = parse_date(date_match.group(1))
                if entry_date and entry_date >= cutoff:
                    # Extract category
                    category_match = re.match(r'([A-Z]+-\d+-\d+)\]\s+(\w+)', entry)
                    if category_match:
                        entry_id = category_matc
...[truncated 3069 chars]
Remediation
View remediation

Remediation Suggestions

  1. Require the caller to provide an explicit source directory rather than automatically scanning a global workspace location.
  2. Resolve and validate the selected path against an allowlisted workspace root, including checks against symbolic-link traversal.
  3. Display the files that will be processed and require explicit approval before reading persistent interaction data.
  4. Apply data minimization: retain only the fields required for analysis and remove the complete "content": entry field unless strictly necessary.
  5. Redact common credential formats, access tokens, private keys, and other secrets before storing, printing, or passing extracted text downstream.
  6. Enforce maximum file sizes, entry lengths, and file counts to reduce uncontrolled data ingestion.
  7. Treat all loaded learning text as untrusted data. Ensure it is never interpreted as executable instructions without separate validation and human review.
  8. Restrict permissions on .openclaw/workspace/.learnings so that only the intended account and trusted processes can write to it.
  9. Avoid emitting raw or derived interaction content by default; provide a metadata-only output mode and require an explicit flag for content-bearing output.
  10. Add tests covering unauthorized paths, symbolic links, maliciously structured entries, secret redaction, and oversized input files.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (10)

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

Scanner excerpt · scripts/evolution.py (reported line 240)May include surrounding context.

python
"type": learning["category"],
                })

    return rules


def self_assess(auto_evolve: bool = False) -> dict:

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill documents commands and workflows that read from memory/transcript files and update persistent behavioral files such as SOUL.md, AGENTS.md, TOOLS.md, and MEMORY.md, but it declares no explicit tool scope or permission boundaries. That creates an authorization ambiguity where a caller or host may invoke a state-modifying skill without clear upfront consent or sandboxing expectations.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill explicitly promotes integration steps that update persistent behavioral files, but the description does not prominently warn users that invoking the skill can change long-lived agent/project state. In practice, this can lead to silent policy drift, accidental corruption of behavioral configuration, or unauthorized self-modification if the skill is triggered automatically.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill directs analysis of daily memory logs, long-term memory, session transcripts, and tool-usage patterns without a clear privacy notice or data-handling limits. Because these sources may contain sensitive user data, preferences, secrets, or internal project information, processing and aggregating them for behavioral evolution materially increases privacy and data governance risk.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill encourages collection and analysis of conversation logs, memory files, and user preference data, then uses those outputs to drive persistent behavioral changes. This creates a realistic retention and leakage risk because sensitive content may be copied into derived reports, patterns, or configuration files where it persists longer and may be exposed more broadly than the original interaction data.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The documented integration with long-term memory and continuous preference learning normalizes ongoing retention of user-provided information beyond the immediate task. Even absent malicious intent, this increases the chance of over-collection, stale or inaccurate profiling, and unauthorized reuse of sensitive preferences or contextual details across future sessions.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
62% confidence
Finding

The description hard-codes multilingual trigger phrases, including Chinese terms, without explaining whether language selection is optional or user-configurable. While not severe, this can be read as imposing language-specific activation behavior without explicit opt-in or documented locale scope.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

The docstring at L244 says the function will 'optionally auto-evolve', and the CLI exposes --auto-evolve at L412, but the function only builds and returns an assessment object. The auto_evolve parameter is unused, no behavioral files are modified, and no evolution action is executed, so the documentation and interface actively overstate what the code does.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This code writes a generated report to a user-specified path, which is a file-modifying operation. While the function later prints a completion message, there is no prior confirmation, warning comment, or docstring disclosure that invoking report generation with --output will overwrite or create a file.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The log_evolution function appends entries to a persistent file under the workspace, which is a filesystem write affecting retained user/system data. The function performs the write silently, and this file does not include a user-facing warning, confirmation, or explanatory comment about the persistence impact.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.