Back to skill

Security audit

Self Improvement

Security checks for vulnerabilities and agentic risk

Overview

This skill is not overtly malicious, but it needs review because it encourages persistent changes to agent memory and prompt files with broad optional hooks and limited approval controls.

Install only if you want an agent to keep persistent learning files and potentially update future agent instruction files. Before enabling hooks or promotion, keep setup project-local, avoid empty matchers when possible, review every proposed addition to AGENTS.md, CLAUDE.md, SOUL.md, TOOLS.md, or copilot-instructions.md, and do not store raw transcripts, command output, credentials, or private data.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T02 · Agent Memory Poisoning

Error
Location
SKILL.md:335
Finding

Untrusted Learnings Can Be Promoted into Persistent Agent Instructions

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:335-380
Additional Locations: SKILL.md:40-43, SKILL.md:463, hooks/openclaw/handler.js:8-24, hooks/openclaw/handler.js:43-48, hooks/openclaw/handler.ts:10-25, hooks/openclaw/handler.ts:53-58
Vulnerability Type: Persistent agent-context poisoning
Risk Level: High

Vulnerable Code

markdown
If logging something similar to an existing entry:

1. **Search first**: `grep -r "keyword" .learnings/`
2. **Link entries**: Add `**See Also**: ERR-20250110-001` in Metadata
3. **Bump priority** if issue keeps recurring
4. **Consider systemic fix**: Recurring issues often indicate:
   - Missing documentation (→ promote to CLAUDE.md or .github/copilot-instructions.md)
   - Missing automation (→ add to AGENTS.md)
   - Architectural problem (→ create tech debt ticket)

## Simplify & Harden Feed

Use this workflow to ingest recurring patterns from the `simplify-and-harden`
skill and turn them into durable prompt guidance.

### Ingestion Workflow

1. Read `simplify_and_harden.learning_loop.candidates` from the task summary.
2. For each candidate, use `pattern_key` as the stable dedupe key.
3. Search `.learnings/LEARNINGS.md` for an existing entry with that key:
   - `grep -n "Pattern-Key: <pattern_key>" .learnings/LEARNINGS.md`
4. If found:
   - Increment `Recurrence-Count`
   - Update `Last-Seen`
   - Add `See Also` links to related entries/tasks
5. If not found:
   - Create a new `LRN-...` entry
   - Set `Source: simplify-and-harden`
   - Set `Pattern-Key`, `Recurrence-Count: 1`, and `First-Seen`/`Last-Seen`

### Promotion Rule (System Prompt Feedback)

Promote recurring patterns into agent context/system prompt files when all are true:

- `Recurrence-Count >= 3`
- Seen across at least 2 distinct tasks
- Occurred within a 30-day window

Promotion targets:
- `CLAUDE.md`
- `AGENTS.md`
- `.github/copilot-instructions.md`
- `SOUL.md` / `TOOLS.md` for OpenClaw workspace-level guidance when applicab
...[truncated 4315 chars]
Remediation
View remediation

Remediation Suggestions

  1. Require explicit, informed user approval before writing or promoting any content into agent instruction files.
  2. Treat all conversation-derived content, task summaries, command output, and learning entries as untrusted data.
  3. Remove the “promote aggressively” instruction and replace it with a deny-by-default promotion policy.
  4. Add a mandatory review stage that displays the exact proposed rule, source, destination file, and behavioral implications.
  5. Record provenance fields such as source session, author, trust level, supporting evidence, approval identity, and approval timestamp.
  6. Require independent verification of a learning before promotion. Recurrence alone must not be treated as evidence of correctness.
  7. Reject promoted text containing commands, hidden directives, policy overrides, credential requests, external URLs, or instructions to weaken security controls unless separately authorized.
  8. Store learnings as quoted data rather than executable agent instructions. Generate concise rules only through a constrained, security-reviewed transformation.
  9. Restrict writes to CLAUDE.md, AGENTS.md, SOUL.md, TOOLS.md, and .github/copilot-instructions.md through an allowlisted approval tool rather than unrestricted file editing.
  10. Add rollback support and an audit log for every persistent-context modification.

T08 · Insecure Dependencies

Warning
Location
SKILL.md:54
Finding

Manual Installation Uses an Unpinned Mutable Git Repository

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:54-61
Vulnerability Type: Unpinned executable supply-chain dependency
Risk Level: Medium

Vulnerable Code

markdown
### Installation

**Via ClawdHub (recommended):**
```bash
clawdhub install self-improving-agent

Manual:

bash
git clone https://github.com/peterskoett/self-improving-agent.git ~/.openclaw/skills/self-improving-agent

Remade for openclaw from original repo : https://github.com/pskoett/pskoett-ai-skills - https://github.com/pskoett/pskoett-ai-skills/tree/main/skills/self-improvement

text

### Technical Analysis

The manual installation command clones the repository’s mutable default branch without selecting a reviewed commit hash or signed release tag. The resulting installed content can therefore differ from the audited package.

This repository contains scripts and an OpenClaw hook intended to operate with the agent’s permissions. If the upstream repository, maintainer account, or default branch is compromised, a later installation can retrieve modified executable or instruction-bearing content. No checksum, signature, commit verification, or reproducible package manifest is specified.

This is a supply-chain weakness rather than evidence that the currently audited repository contains a malicious payload. The risk arises because the documented installation process does not preserve the security properties of the reviewed version.

### Attack Path

1. An attacker compromises the upstream repository, a maintainer account, or the default branch.
2. The attacker modifies the hook, shell scripts, or skill instructions.
3. A user follows the documented `git clone` command after the malicious change.
4. Git retrieves the mutable current branch rather than the audited version.
5. The user enables the hook or invokes a bundled script as documented.
6. The modified content executes with the same permissions as the agent process or injects attacker-controlled instructions int
...[truncated 522 chars]
Remediation
View remediation

Remediation Suggestions

  1. Replace the mutable clone instruction with a reviewed, immutable commit:
    bash
    git clone https://github.com/peterskoett/self-improving-agent.git ~/.openclaw/skills/self-improving-agent
    git -C ~/.openclaw/skills/self-improving-agent checkout --detach &lt;reviewed-commit-sha&gt;
    
  2. Prefer signed, versioned releases and require verification of the release signature.
  3. Publish SHA-256 checksums for release archives and document checksum verification before installation.
  4. Ensure the documented version corresponds exactly to _meta.json and the audited artifact.
  5. Provide a lock or manifest containing expected hashes for executable scripts, hook handlers, and SKILL.md.
  6. Warn users not to enable hooks until source integrity has been verified.
  7. Document a controlled update process that reviews diffs between the installed commit and the proposed new commit.
  8. Protect upstream releases with branch protection, mandatory review, signed commits or tags, and multi-factor authentication.
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 (19)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description says this skill is for capturing learnings, errors, corrections, API/tool failures, outdated knowledge, and improved approaches to support continuous improvement. However, the actual code does not implement a learning-capture or review mechanism. Instead, it is a helper script for extracting or promoting a learning into a new skill by creating a directory and markdown template on disk. This is a materially different primary purpose: scaffolding skill files rather than recording operational failures or user corrections. The filesystem-writing behavior is central to the code and is not reflected in the declared purpose.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

An empty hook matcher causes the activator to run on every prompt, creating unbounded prompt interception and increasing the chance that sensitive user input is processed for logging/reminder behavior unnecessarily. In a skill focused on persistence, this broad activation raises privacy and prompt-scope risks, especially if downstream scripts inspect or transform user content.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The advanced setup broadens activation to all prompts and adds PostToolUse processing for Bash output, which can expose command output containing secrets, tokens, file contents, or proprietary data to hook scripts on every run. Because this skill explicitly handles errors and learnings, indiscriminate interception materially increases the risk of persistent storage or secondary processing of sensitive data.

Content

No source excerpt is available for this finding.

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
93% confidence
Finding

Directing users to modify ~/.claude/settings.json changes the agent's global configuration directory, creating persistence and broad trust in local hook commands across all future sessions. If the referenced scripts are altered, relocated, or replaced, the agent will continue executing them automatically with user-level privileges.

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
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 · SKILL.md (reported line 81)May include surrounding context.

└── FEATURE_REQUESTS.md

text

### Create Learning Files

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

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The listed feature-request triggers include generic phrases such as "Can you also...", "I wish you could...", and "Is there a way to...", which commonly occur in ordinary conversation and are not specific to this skill. Without tighter scoping or exclusion conditions, these examples make invocation boundaries ambiguous and increase the risk of unintended activation.

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

The guide instructs users to install persistent hook configuration in project settings, causing the behavior to recur automatically in future sessions. Persistence increases the chance that users forget the hook is active, leading to repeated execution and ongoing processing of prompts or tool outputs beyond the moment of initial consent.

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

An empty matcher causes the hook to fire on every user prompt, which is broader than necessary for a self-improvement feature. This increases exposure to prompt-triggered side effects, accidental capture of sensitive context, and unnecessary execution of local scripts on all interactions.

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 recommends installing the hook in ~/.claude/settings.json, enabling broad activation across all projects and sessions. That expands the blast radius of any bug, sensitive-data handling mistake, or future script change from one repository to the user's entire agent environment.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The 'minimal setup' still uses an empty matcher, so it remains globally triggered within the project despite being framed as lower overhead. Reduced overhead does not reduce the security risk of indiscriminate script execution on every prompt.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The Codex example mirrors the same empty matcher pattern, causing the hook to activate on all prompts in that environment as well. Reproducing the broad trigger across tools normalizes an unsafe default and increases the chance of sensitive or unintended contexts being processed.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The document states that the hook scripts 'don't modify files or run commands,' but the examples explicitly configure those scripts as commands executed by the agent hook system. This creates a misleading security assurance that can cause operators to underestimate the risk of arbitrary code execution under the agent'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:

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The guide instructs operators to log learnings to workspace files and promote them to persistent workspace prompts without warning about sensitive, user-specific, or secret-bearing data retention. In a self-improvement context, errors and corrections often contain commands, outputs, identifiers, or credentials that should not be stored indefinitely.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The guide expands a 'self-improvement' skill from local learning capture into editing persistent global prompt files such as AGENTS.md, SOUL.md, and TOOLS.md. That creates a durable prompt-injection and policy-drift channel where transient mistakes, adversarial user content, or poisoned observations can be promoted into future session behavior.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The documentation introduces cross-session transcript reading, messaging, and spawning capabilities that are broader than needed for a logging skill. Even with some cautionary wording, these features increase the attack surface for context leakage, prompt contamination across sessions, and unauthorized sharing of sensitive transcript content.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

Using 'Knowledge gaps' as a trigger is overly ambiguous and can cause the skill to activate on normal uncertainty, incomplete information, or exploratory reasoning. This increases the chance of excessive logging, persistence of low-quality or sensitive content, and unintended behavioral changes if such logs are later promoted.

Content

No source excerpt is available for this finding.