Back to skill

Security audit

Super Self Improving Agent

Security checks for vulnerabilities and agentic risk

Overview

This is mostly a disclosed learning-log skill, but it needs review because it encourages persistent changes to agent memory and optional always-on hooks without strong per-change controls.

Install only in trusted, project-scoped environments. Keep hooks local rather than global, require manual review before any changes to CLAUDE.md, AGENTS.md, SOUL.md, TOOLS.md, or Copilot instructions, and do not use cross-session transcript/message features unless you explicitly choose the target session and sharing scope.

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

Warning
Location
SKILL.md:366
Finding

Unreviewed Promotion of Conversation-Derived Rules into Persistent Agent Memory

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:40-43, SKILL.md:366-380, hooks/openclaw/handler.ts:29-34, hooks/openclaw/handler.ts:86-106, hooks/openclaw/handler.js:30-35, and hooks/openclaw/handler.js:87-107
Vulnerability Type: T02: Agent Memory Poisoning
Risk Level: Medium

Vulnerable Code

The skill directs agents to promote learned rules into persistent, prompt-bearing workspace files:

markdown
| Broadly applicable learning | Promote to `CLAUDE.md`, `AGENTS.md`, and/or `.github/copilot-instructions.md` |
| Workflow improvements | Promote to `AGENTS.md` (OpenClaw workspace) |
| Tool gotchas | Promote to `TOOLS.md` (OpenClaw workspace) |
| Behavioral patterns | Promote to `SOUL.md` (OpenClaw workspace) |

The recurring-pattern workflow identifies these files as promotion targets:

markdown
Promotion targets:
- `CLAUDE.md`
- `AGENTS.md`
- `.github/copilot-instructions.md`
- `SOUL.md` / `TOOLS.md` for OpenClaw workspace-level guidance when applicable

Write promoted rules as short prevention rules (what to do before/while coding),
not long incident write-ups.

The OpenClaw bootstrap hook reinforces this workflow in agent context:

ts
**Promote when pattern is proven:**
- Behavioral patterns → \`SOUL.md\`
- Workflow improvements → \`AGENTS.md\`
- Tool gotchas → \`TOOLS.md\`

The reminder is then installed as a virtual bootstrap file:

ts
const reminderFile = {
  name: REMINDER_NAME,
  path: REMINDER_PATH,
  content: REMINDER_CONTENT,
  missing: false,
  virtual: true,
};

const existingIndex = cleanedBootstrapFiles.findIndex((file) => isInjectedReminderFile(file));
if (existingIndex === -1) {
  cleanedBootstrapFiles.push(reminderFile);
} else {
  cleanedBootstrapFiles[existingIndex] = reminderFile;
}

event.context.bootstrapFiles = cleanedBootstrapFiles;

Technical Analysis

Files such as SOUL.md, `AGENTS. ...[truncated 2756 chars]

Remediation
View remediation

Remediation Suggestions

  1. Require explicit user confirmation before every modification to SOUL.md, AGENTS.md, TOOLS.md, CLAUDE.md, .github/copilot-instructions.md, or equivalent prompt-bearing files.
  2. Present the destination, source learning, and complete proposed diff before requesting approval.
  3. Keep automatic capture restricted to .learnings/; implement promotion as a separate, manually invoked operation.
  4. Treat all conversation-derived content as untrusted data. Distill factual observations instead of copying imperative instructions verbatim.
  5. Record provenance metadata for every promoted rule, including its source task, author, original learning ID, approval identity, approval time, and destination.
  6. Prohibit promotion of rules that change safety constraints, instruction precedence, permission boundaries, secret handling, external communication, authentication, or executable tool behavior.
  7. Validate that a promoted rule is supported by trusted project documentation or independently verified behavior rather than recurrence alone.
  8. Maintain a manifest of rules installed by the skill and provide a rollback mechanism that removes or reverts each promoted entry.
  9. Apply least-privilege controls so the hook and routine learning workflow cannot modify persistent instruction files unless promotion mode has been explicitly authorized.
  10. Update the bootstrap reminder to state that persistent promotion requires review and must never occur automatically.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (21)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The description presents an active self-improvement system that monitors events like failures and corrections, learns from them, adapts outdated knowledge, and refines behavior. The supplied code does something much narrower: it listens only for agent bootstrap events and inserts a virtual markdown reminder containing instructions about when to log learnings. It neither detects failures nor corrections directly, nor performs any logging, reflection, correction, adaptation, or memory organization itself. Its primary purpose is prompt/bootstrap augmentation, not continuous self-improvement execution. Therefore the declared description materially overstates and misrepresents the actual behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The description overstates the implemented behavior. The code is narrowly a bootstrap-time hook that inserts a virtual markdown reminder file into bootstrapFiles for non-subagent sessions. That reminder describes possible self-improvement logging practices, but the hook itself does not monitor failures, detect user corrections, identify knowledge gaps, correct errors, adapt outdated knowledge, or refine approaches automatically. Its actual trigger is unrelated to the declared operational triggers: it runs on every agent bootstrap rather than on command failure, user correction, or explicit invocation. While the reminder content is thematically related to self-improvement, the implemented primary purpose is prompt/reminder injection, not continuous self-improvement behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The declared description promises an active, ongoing self-improvement mechanism with detection of failures, corrections, knowledge gaps, and automatic refinement. The supplied code does not implement those behaviors. It only emits a static reminder message as system context, apparently on prompt submission, suggesting that learnings may be logged later. There is no actual reflection logic, error detection, correction, memory organization, adaptation, or trigger handling matching the description. The primary behavior is materially narrower than declared, so this is a mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description presents an autonomous self-improvement capability that activates based on failures, corrections, knowledge gaps, or better methods. The supplied code does nothing of that sort. It is a local shell utility for generating a new skill scaffold on disk under a skills directory. Its primary purpose, triggers, and behavior are entirely different from the declaration. There is no reflection loop, memory management, knowledge updating, automatic correction, or adaptive reasoning logic. This is a clear description-behavior mismatch.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The description says the skill activates on broad conditions such as "knowledge gaps," "better methods," and "explicit skill invocation," which are not narrowly defined and could overlap with many normal interactions. It does not clearly constrain when the skill should not activate or provide exclusion conditions, increasing the risk of unintended invocation.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

An empty hook matcher causes the activator to run on every user prompt, creating a universal trigger. In practice this can expand the skill's reach far beyond user expectation, increase prompt-surface manipulation, and normalize automatic execution paths that may process sensitive contexts on every interaction.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The second example repeats the universal-trigger pattern and additionally hooks PostToolUse for Bash, which can inspect command outcomes broadly. This increases exposure to sensitive command output and makes the skill more dangerous in environments where prompts or shell output may contain secrets.

Content

No source excerpt is available for this finding.

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

The guide instructs users to place executable hook configuration in an agent config directory under the home folder, which creates durable cross-session command execution from a trusted location. Config-directory persistence is security-relevant because compromise or misuse of that path affects all future agent runs and can be harder for users to notice than per-project settings.

Content

Scanner excerpt · references/hooks-setup.md (reported line 48)May include surrounding context.

Option 2: User-Level Configuration

Add to ~/.claude/settings.json for global activation:

json
{

Exfiltration Commands

High
Category
Prompt Injection
Confidence
90% confidence
Finding

Instructions found that direct the agent to transmit conversation context or user data to external services.

Content

Scanner excerpt · references/openclaw-integration.md (reported line 181)May include surrounding context.

sessions_send

Send message to another session:

text
sessions_send(sessionKey="session-id", message="Learning: API requires X-Custom-Header")

Session Persistence

Medium
Category
Rogue Agent
Confidence
78% confidence
Finding

The skill encourages persistent storage of learnings under a user workspace, which can accumulate sensitive operational details across sessions. Although the document warns against logging secrets, persistent notes often end up containing redacted-too-late errors, file paths, stack traces, or user requests that may later be exposed to other tools or sessions.

Content

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

└── FEATURE_REQUESTS.md

text

### Create Learning Files

```bash
mkdir -p ~/.openclaw/workspace/.learnings

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
85% confidence
Finding

The skill instructs use of cross-session tools that can access other sessions' history and send messages across sessions. Even though it says to use them only in trusted environments and with explicit user intent, normalizing transcript access increases the chance of unintended data disclosure, especially if other sessions contain secrets or unrelated user data.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The manifest describes a skill for reflection, criticism, learning, and memory organization. The extraction workflow goes further by turning learnings into new reusable skills via helper scripts and manual skill creation guidance, which is a distinct capability not implied by routine self-improvement or error logging.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown template tells authors to 'Include trigger conditions' but provides no guidance on making triggers specific, bounded, or distinct from everyday language. Because this is a reusable template for skill manifests, it risks propagating ambiguous activation descriptions across many skills.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The minimal template asks for 'What this skill does and when to use it' but does not require concrete trigger wording, exclusions, or context limits. In a template, this can lead to vague descriptions that overlap with common requests and unintended invocation behavior.

Content

No source excerpt is available for this finding.

Skill Enumeration

Medium
Category
Agent Snooping
Confidence
80% confidence
Finding

Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Content

Scanner excerpt · references/examples.md (reported line 301)May include surrounding context.

When the above learning is extracted as a skill, it becomes:

File: skills/docker-m1-fixes/SKILL.md

markdown
---

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 · references/hooks-setup.md (reported line 15)May include surrounding context.

Option 1: Project-Level Configuration

Create .claude/settings.json in your project root:

json
{

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file documents a manifest-style hook configuration, so vague-trigger review applies. The empty string matcher is ambiguous and effectively unconstrained, meaning the hook will activate for all prompts rather than a clearly bounded set of cases.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Placing an always-on hook in ~/.claude/settings.json expands the scope from one project to every session, increasing the blast radius if the referenced script is modified, replaced, or behaves unexpectedly. Because this is persistent user-level configuration, it can cause broad automatic execution of a local command across unrelated contexts and can surface sensitive session content more often than intended.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The documented Codex configuration again uses matcher: "" with no explanation of scope limitations. In a setup guide, this is a vague trigger because it does not distinguish targeted invocation from unconditional activation.

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 · references/openclaw-integration.md (reported line 57)May include surrounding context.

openclaw hooks enable self-improvement

text

### 3. Create Learning Files

Create the `.learnings/` directory in your workspace:

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown file defines detection triggers, and 'Knowledge gaps' is an ambiguous condition with no clear boundary for when the skill should trigger. Because many normal interactions could involve partial knowledge or uncertainty, this phrasing is overly broad and may lead to unintended invocations or logging behavior.

Content

No source excerpt is available for this finding.