Back to skill

Security audit

Strict Self-Improving Agent (Rule of 3)

Security checks for vulnerabilities and agentic risk

Overview

This is a real self-improvement logging skill, but it uses broad persistent memory and always-on hook guidance that can affect future agent behavior.

Install only if you are comfortable with persistent local learning records and hook-generated reminders influencing future sessions. Prefer project-local setup, avoid user-global hooks, use restrictive matchers, review scripts before enabling them, and redact secrets, personal data, private business context, raw prompts, and sensitive command output before anything is logged or promoted.

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

T01 · Skill Instruction Hijacking

Error
Location
hooks/openclaw/handler.js:8
Finding

Bootstrap and Prompt Hooks Inject Behavioral Instructions into Agent Context

Content
View full analysis
{ // Safety checks for event structure if (!event || typeof event !== 'object') { return; } // Only handle agent:bootstrap events if (event.type !== 'agent' || event.action !== 'bootstrap') { return; } // Safety check for context if (!event.context || typeof event.context !== 'object') { return; } // Inject the reminder as a virtual bootstrap file // Check that bootstrapFiles is an array before pushing if (Array.isArray(event.context.bootstrapFiles)) { event.context.bootstrapFiles.push({ path: 'SELF_IMPROVEMENT_REMINDER.md', content: REMINDER_CONTENT, virtual: true, }); } }; ``` The related prompt hook emits another imperative instruction block: ```bash # Output reminder as system context cat << 'EOF' After completing this task, evaluate if extractable knowledge emerged: - Non-obvious solution discovered through investigation? - Workaround for unexpected behav ...[truncated 2736 chars]
Remediation
View remediation

T02 · Agent Memory Poisoning

Error
Location
SKILL.md:239
Finding

Persistent Learning Promotion Can Poison Future Agent Instructions

Content
View full analysis
Remediation
View remediation
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 (22)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description is about recording and consulting learnings after failures, corrections, outdated knowledge, or improved approaches. The supplied code does not capture learnings, store errors/corrections, review prior learnings, or react to the listed triggers. Instead, it is a command-line scaffolding utility that generates a new skill folder and template markdown file from a skill name. This is a materially different primary purpose and includes undeclared filesystem-writing behavior. While the comments mention creating a skill from a learning entry, the implementation only scaffolds the skill artifact and suggests manual follow-up; it does not implement the described continuous-improvement learning capture behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description focuses on recording and reviewing learnings arising from failures, corrections, and discovered improvements. The supplied code does not capture new learnings, errors, or corrections at all. Instead, it performs a different function: reviewing existing memory items that are already marked ready_for_promotion and compiling them into a review document. This is a materially different primary purpose and involves filesystem scanning and document generation capabilities not reflected in the description. While both relate broadly to 'memory' or 'learnings,' the actual behavior is a promotion-review utility, not a learning-capture mechanism.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

Using generic everyday phrases as automatic logging triggers can cause the agent to capture large amounts of routine conversation into persistent storage. In a memory-oriented skill, that materially increases the risk of storing irrelevant or sensitive user content without deliberate review.

Content

No source excerpt is available for this finding.

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
90% confidence
Finding

Directing users to modify ~/.claude/settings.json places persistent executable hook configuration in the agent's user-level config directory, which can affect all future sessions. In the context of a self-improvement skill that runs local scripts, this persistence increases the chance of long-term unintended execution and cross-project exposure.

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 177)May include surrounding context.

sessions_send

Send message to another session:

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

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The description says to use the skill whenever a command fails unexpectedly, the user corrects the agent, an API fails, knowledge is outdated, or a better approach is discovered. These conditions are extremely common in ordinary interactions and do not clearly limit when the skill should activate versus when normal task handling should continue without invocation.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
78% confidence
Finding

The skill directs creation of persistent storage under ~/.openclaw/workspace/memory/core, enabling cross-session retention of logged content. Persistent storage is not inherently unsafe, but in this skill it combines with broad auto-logging guidance, making unintended long-term retention of sensitive data a realistic risk.

Content

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

│ └── features.md

text

### Create Learning Files

```bash
mkdir -p ~/.openclaw/workspace/memory/core

Ssd 3

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The logging templates encourage storing full context, related files, and user-provided details in persistent markdown records. In practice, that can retain secrets, personal data, internal paths, or confidential project details long after the original interaction, expanding exposure through future reads and promotion workflows.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Feature-request logging explicitly asks for the user's requested capability and motivation, which can capture sensitive business intent, personal circumstances, or confidential project goals in plain language. Because the skill is designed for persistence across sessions, the context makes this more dangerous than transient chat memory.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill claims the agent must not write directly to core instruction files, then later encourages direct promotion into those files. Contradictory instruction hierarchies can cause an agent to bypass intended review controls and persist behavioral changes into trusted instruction surfaces without consistent governance.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The stated Rule-of-3 and human-review-only model is weakened by later instructions allowing direct extraction of a skill from a single learning. That inconsistency can let unvetted operational guidance become reusable automation, increasing the chance of unsafe or overbroad instructions being persisted and reused.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The automatic detection rules instruct the agent to log corrections, new information, and user-provided content broadly, which strongly biases the system toward retaining whatever the user says. In a persistent memory skill, this can convert ordinary conversation into durable records containing sensitive data, and later propagation mechanisms may repeat or elevate that data.

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
84% confidence
Finding

Placing hook configuration in .claude/settings.json creates session-persistent behavior that automatically re-applies when new sessions start. Persistence is not inherently unsafe, but here it increases risk because it continuously executes local scripts tied to prompts and tool events, including after users may forget the hook is enabled.

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

An empty matcher on UserPromptSubmit causes the hook to run for every prompt, greatly broadening the execution surface and increasing the chance that unneeded or unsafe behavior is triggered in sensitive contexts. In a self-improvement skill, this is especially risky because it normalizes constant execution of local scripts on all interactions rather than only on relevant failure or correction events.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The user-level configuration installs the hook in ~/.claude/settings.json for global activation across all projects, extending script execution into unrelated repositories and sessions. This magnifies risk from a single skill by creating broad, persistent reach into future prompts and environments that may contain more sensitive data or workflows.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The Codex example repeats the empty matcher pattern, causing the hook to trigger on every prompt in that environment as well. Reproducing overly broad trigger logic across multiple agent platforms increases the attack surface and makes unsafe execution patterns more likely to be copied verbatim.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The document states that hook scripts 'only output text' and 'don't modify files or run commands', but the configuration explicitly runs shell scripts via command hooks. This creates a misleading security boundary that may cause users to trust or install hooks without appreciating that arbitrary script logic executes with the agent user's privileges.

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:

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The guide instructs promoting transient 'learnings' into persistent workspace prompt files such as AGENTS.md, SOUL.md, and TOOLS.md, which influence future agent behavior across sessions. For a self-improvement skill, this expands scope from local logging into durable prompt-surface modification, creating a prompt-persistence channel that could propagate mistakes, injected content, or unsafe behavioral changes.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The documented use of sessions_history, sessions_send, and sessions_spawn gives a learning-focused skill visibility into other sessions and the ability to send cross-session messages. That is broader than necessary for error logging and creates opportunities for unnecessary data access, context leakage, or propagation of tainted instructions between sessions.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger conditions are broad and loosely defined, so routine errors, corrections, or ambiguous 'surprises' may activate logging or promotion behavior unintentionally. In a system with persistence and workspace injection, overbroad triggers increase the chance that low-quality, sensitive, or adversarial content gets stored and later reused.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.