Back to skill

Security audit

Agent Self-Evolve

Security checks for vulnerabilities and agentic risk

Overview

This skill openly sets up persistent agent self-improvement, but it also lets scheduled agent runs change code, skills, and memory without clear user approval.

Install only if you are comfortable with a self-improvement workflow that writes persistent memory and can modify code or skill files on a schedule. Before use, change the cron prompts to review-only, require explicit approval for code and skill changes, restrict writable paths, and exclude secrets or sensitive personal data from memory files.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (1)

T02 · Agent Memory Poisoning

Error
Location
references/daily-evolution-prompt.md:11
Finding

Persistent Memory Poisoning Can Trigger Unattended Code and Skill Modification

Content
View full analysis

Vulnerability Details

File Location: references/daily-evolution-prompt.md:11-28
Supporting Locations: SKILL.md:45-64, SKILL.md:104-109, references/weekly-evolution-prompt.md:11-37
Vulnerability Type: Persistent memory poisoning and unsafe autonomous modification
Risk Level: High

Vulnerable Code Snippet:

markdown
1. **Read today's daily log**: Read `memory/YYYY-MM-DD.md` (use today's date).
   If it doesn't exist, check yesterday's date. If neither exists, skip to step 5.

2. **Extract lessons**: From the daily log, identify:
   - Mistakes made (add to `memory/mistakes-learned.md`)
   - New knowledge learned (add to domain knowledge files)
   - Significant events/decisions (update `MEMORY.md`)
   - Skills or code that could be improved (queue in `memory/skill-improvements.md`)

3. **Execute queued improvements**: Read `memory/skill-improvements.md`.
   For each unchecked `- [ ]` item:
   - If it's a code fix: implement it, test if possible, mark as done
   - If it's a skill improvement: update the skill file, mark as done
   - If it requires user input: skip, leave in queue

4. **Update metrics**: Read `memory/evolution-metrics.json`, increment:
   - `total_evolutions` +1
   - `daily_evolutions` +1
   - `mistakes_recorded` += number of new mistakes added
   - `code_fixes_applied` += number of code fixes executed
   - `skills_improved` += number of skills updated

The persistent behavioral hook recommended in SKILL.md:45-64 is:

markdown
## 🧬 Self-Evolution

I have a built-in learning loop. After every interaction:
- Made a mistake → record in `memory/mistakes-learned.md`
- Found a skill/code improvement → queue in `memory/skill-improvements.md`
- Learned something new → update domain knowledge file
- Important decision/preference → update `MEMORY.md`

The weekly prompt also authorizes skill creation in `references/weekly-evolution-prompt.md:29 ...[truncated 3393 chars]

Remediation
View remediation

Remediation Suggestions

  1. Treat all daily logs, memory files, and improvement queues as untrusted data rather than executable instructions.
  2. Require explicit user approval before modifying code, skills, AGENTS.md, MEMORY.md, or other persistent behavioral files.
  3. Change scheduled reviews to produce proposed patches only. Store a diff and rationale in a review directory, but do not apply the patch automatically.
  4. Enforce a strict allowlist of writable workspace paths and reject absolute paths, parent-directory traversal, symlink escapes, and modifications outside the intended repository.
  5. Use a structured queue format with validated fields for target, issue, proposed change, provenance, and approval status. Do not execute free-form Markdown instructions.
  6. Record the source interaction for every queued item and require a trusted approval marker that cannot be set through ordinary conversation-derived content.
  7. Run generated changes in a restricted sandbox with minimal filesystem and network permissions. Apply resource limits and disable access to credentials and unrelated repositories.
  8. Generate and review a complete diff before application. Run relevant tests and security checks, and automatically roll back failed changes.
  9. Disable autonomous skill creation. Require manual review for every new skill and inspect its instructions and scripts before installation.
  10. Prevent logs and memory content from overriding system instructions or expanding tool permissions. Clearly delimit quoted historical content when supplying it to an agent.
  11. Maintain append-only audit records outside the agent's normal write scope so that unauthorized changes cannot be hidden by editing evolution logs or metrics.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (14)

Self-Modification

High
Category
Rogue Agent
Confidence
90% confidence
Finding

The skill is explicitly designed around self-evolution and self-improvement, signaling a self-modification capability. In context, this is not merely descriptive: later sections operationalize automatic code/skill changes, so the self-modification label corresponds to real autonomous behavior that can alter future agent actions.

Content

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

md
---
name: self-evolve
description: >
  Self-evolution system for OpenClaw agents. Enables continuous learning through
  mistake tracking, experience distillation, skill improvement queues, and

Self-Modification

High
Category
Rogue Agent
Confidence
90% confidence
Finding

The 'Self-Evolve' section frames the system as turning every interaction into a learning opportunity, which in isolation could be benign, but in this skill it introduces recurring autonomous evolution loops. Because the design couples reflection with scheduled modifications and memory persistence, the context makes this materially more dangerous than a simple journaling feature.

Content

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

md
or one-off reminders (use cron directly).
---

# Self-Evolve 🧬

A self-improvement system that turns every interaction into a learning opportunity.
Three loops: **real-time capture** → **daily consolidation** → **weekly deep review**.

Missing User Warnings

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The instruction to 'implement it, test if possible, mark as done' enables unattended code changes based solely on queue contents, with no approval checkpoint or trust boundary on who or what populated the queue. Because the same system also extracts improvement ideas from prior logs, an attacker could seed malicious or unsafe instructions into memory files and have them converted into automatic code edits during the scheduled run.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The real-time capture instructions broadly direct the agent to persist mistakes, new knowledge, user preferences, and important decisions into durable memory files. Without minimization, consent boundaries, or sensitivity filtering, this creates a long-term data retention pipeline that may store personal, confidential, or unnecessary interaction details.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The daily review flow instructs the agent to read logs, extract lessons and insights, and write summaries into durable memory artifacts and metrics. This semantic consolidation increases privacy risk because transient interaction content becomes searchable long-term memory, potentially preserving sensitive details beyond the user's expectation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The daily evolution loop explicitly authorizes the agent to execute queued code fixes and skill updates autonomously. Even if framed as self-improvement, this grants self-modification capability that can alter user files or agent behavior without contemporaneous review, increasing the risk of harmful changes, persistence of bad logic, or abuse if queued items are poisoned.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

These steps instruct the agent to execute queued improvements and update multiple durable files as part of an automated cron workflow, but do not prominently warn the user that their files may be modified without review. This creates a silent-change pathway where self-generated edits can accumulate, including incorrect code changes or unwanted memory persistence.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The weekly evolution loop expands scope from learning and review into creating new skills, which is a materially broader capability than passive reflection. Autonomous skill creation can introduce new privileged behaviors, persistence mechanisms, or unsafe workflows without clear user intent or governance.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The heartbeat integration recommends immediate execution of urgent improvements without waiting for the normal review cycle, bypassing even the limited queue delay described elsewhere. This raises the chance of impulsive, unreviewed modifications to code, skills, or configuration based on ambiguous urgency labels.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The prompt directs multiple automatic writes to memory, metrics, logs, and potentially skill files, but does not warn the operator that the cron job will perform unattended state changes. This is dangerous because it reduces informed consent and auditability around persistent modifications, making accidental data drift, prompt poisoning propagation, or silent configuration changes more likely.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The prompt explicitly authorizes the agent to autonomously implement code fixes and update skill files from a queued list, which expands its behavior from passive lesson capture into self-directed code and configuration modification. In a cron-driven unattended context, any bad, poisoned, or misinterpreted queue entry could result in unsafe changes being applied without human review, creating a path to persistence, corruption, or privilege misuse.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The prompt explicitly instructs the agent to modify multiple persistent files (mistakes-learned.md, skill-improvements.md, domain knowledge files, metrics JSON, and memory/evolution-log.md) as part of an automated cron-driven run, but it does not warn that these are automatic writes or require confirmation before changing durable state. In the context of a self-evolution skill, this is risky because a scheduled unattended task can silently rewrite memory, queue skill creation, and accumulate self-directed changes over time, increasing the chance of drift, corruption, or unsafe persistence of bad inferences.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The natural-language invocation guidance includes both Chinese and English phrases, but the skill does not state whether it will respond in the user's language, ask for preference, or otherwise handle locale choice. This can create an implicit language-policy issue because behavior across languages is not explicitly user-directed.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The example sets "tz": "Asia/Shanghai", which imposes a specific locale setting in natural-language/config guidance without offering an opt-in or explaining that it is only an example for a particular region. This can violate language/locale policy expectations when reused as-is by users in other locales.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.