Back to skill

Security audit

Self Improving Agent

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed self-improvement logger, but it encourages persistent changes to agent memory and always-on hooks without enough scoping or approval guidance.

Install only if you want persistent learning logs and are comfortable reviewing every promotion into agent instruction files. Prefer project-local setup, avoid global hooks, replace empty matchers with narrow ones, keep secrets and raw transcripts out of .learnings, and require a reviewed diff before updating AGENTS.md, CLAUDE.md, SOUL.md, TOOLS.md, or Copilot instructions.

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
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (5)

T01 · Skill Instruction Hijacking

Error
Location
scripts/activator.sh:8
Finding

Agent Hooks Inject Persistent Behavioral Instructions into Prompt and Bootstrap Context

Content
View full analysis
After completing this task, evaluate if extractable knowledge emerged: - Non-obvious solution discovered through investigation? - Workaround for unexpected behavior? - Project-specific pattern learned? - Error required debugging to resolve? If yes: Log to .learnings/ using the self-improvement skill format. If high-value (recurring, broadly applicable): Consider skill extraction. EOF ``` The OpenClaw runtime hook similarly injects a virtual bootstrap file: ```javascript const REMINDER_CONTENT = ` ## Self-Improvement Reminder After completing tasks, evaluate if any learnings should be captured: **Log when:** - User corrects you → \`.learnings/LEARNINGS.md\` - Command/operation fails → \`.learnings/ERRORS.md\` - User wants missing capability → \`.learnings/FEATURE_REQUESTS.md\` - You discover your knowledge was wrong → \`.learnings/LEARNINGS.md\` - You find a better approach → \`.learnings/LEARNINGS.md\` **Promote when pattern is proven:** - Behavioral patterns → \`SOUL.md\` - Workflow improvements → \`AGENTS.md\` - Tool gotchas → \`TOOLS.md\` Keep entries simple: date, title, what happened, what to do differently. `.trim(); const handler = async (event) => { if (!event || typeof event !== 'object') { return; } if (event.type !== 'agent' || event.action !== 'bootstrap') { return; } if (!event.context || typeof event.context !== 'object') { return; } if (Array.isArray(event.context.bootstrapFiles)) { event.context.bootstrapFiles.push({ path: 'SELF_IMPROVEMENT_REMINDER.md', content: REMINDER_CONTENT, virtual: true, }); } }; ``` ### T ...[truncated 1476 chars]
Remediation
View remediation

T02 · Agent Memory Poisoning

Error
Location
SKILL.md:15
Finding

Untrusted Conversation and Tool Content Can Be Promoted into Persistent Agent Memory

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
SKILL.md:38
Finding

Manual Installation Uses an Unpinned Mutable Git Repository

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/extract-skill.sh:91
Finding

Skill Extraction Output Path Can Escape the Workspace Through Symlinks

Content
View full analysis
"$SKILL_PATH/SKILL.md" << TEMPLATE --- name: $SKILL_NAME description: "[TODO: Add a concise description of what this skill does and when to use it]" --- # $(echo "$SKILL_NAME" | sed 's/-/ /g' | awk '{for(i=1;i<=NF;i++) $i=toupper(substr($i,1,1)) tolower(substr($i,2))}1') [TODO: Brief introduction explaining the skill's purpose] ## Quick Reference | Situation | Action | |-----------|--------| | [Trigger condition] | [What to do] | ## Usage [TODO: Detailed usage instructions] ## Examples [TODO: Add concrete examples] ## Source Learning This skill was extracted from a learning entry. - Learning ID: [TODO: Add original learning ID] - Original File: .learnings/LEARNINGS.md TEMPLATE ``` ### Technical Analysis The script rejects absolute paths and literal `..` components, but it performs only lexical validation. It does not canonicalize the output directory or reject symbolic links in the path. If `./skills`, a custom output directory, or one of its parent components is a symbolic link to another location, `mkdir` and shell redirection follow that link. The script can therefore create a direc ...[truncated 1031 chars]
Remediation
View remediation

T01 · Skill Instruction Hijacking

Note
Location
hooks/openclaw/handler.js:28
Finding

Runtime JavaScript Handler Omits the TypeScript Sub-Agent Exclusion

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
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (18)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The declared description is about recording and reviewing learnings, errors, corrections, and failed operations for continuous improvement. The supplied code does not capture, store, analyze, or review learnings at all. Instead, it is a local scaffolding utility that creates a new skill folder and a templated SKILL.md file based on a skill name, with path validation and dry-run behavior. While the comments mention creating a skill from a learning entry, the script only generates a template and suggests manual follow-up; it does not implement the described learning-capture workflow. Therefore the actual behavior is materially different from the declared purpose.

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 establishes persistence in the agent's configuration directory. In the context of a self-improvement skill that automatically triggers scripts, this creates durable behavior across sessions and repositories, so a harmful or later-modified script can continue executing without fresh user intent.

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")

Session Persistence

Medium
Category
Rogue Agent
Confidence
87% confidence
Finding

The skill directs creation of persistent storage under a user home/workspace path for session-derived data. Persistence itself is not malicious, but storing behavioral history and error/context logs in long-lived locations increases retention and unintended disclosure risk, especially on shared machines or in synced home directories.

Content

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

└── FEATURE_REQUESTS.md

text

### Create Learning Files

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

Ssd 3

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The skill explicitly encourages reading other sessions’ transcripts and sharing learnings across sessions, then storing derived content in persistent files. That creates a real confidentiality risk because user-provided context, secrets, or sensitive business data can be copied across trust boundaries and retained beyond the original session.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The logging templates instruct the agent to persist full context, error output, inputs, parameters, and user context. In practice, those fields often contain credentials, tokens, personal data, internal paths, or proprietary prompts, so the template normalizes long-term storage of sensitive data.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The recommendation to 'promote aggressively' into persistent context files broadens the blast radius of any sensitive content captured from prior interactions. Once copied into agent memory/prompt files, the information becomes more likely to be surfaced in future tasks or to other agents and sessions.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The listed feature-request triggers include generic phrases like "Can you also..." and "Is there a way to...", which are common conversational patterns and not specific to this skill. Without tighter constraints or negative examples, the skill may activate in many ordinary exchanges where self-improvement logging is not intended.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Several extraction triggers, such as "Remember this pattern" and "This would be useful for other projects," are broad natural-language phrases that can occur in normal collaboration. The document does not provide exclusion conditions or contextual limits, increasing the chance of unintended invocation.

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

Placing hook configuration in .claude/settings.json at the project root introduces session-persistent automated behavior for anyone using the repository. In this skill context, that persistence is more dangerous because the hook invokes command scripts tied to self-improvement and error capture, potentially affecting future sessions without repeated scrutiny.

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 makes the hook fire on every prompt, creating an unconstrained trigger surface. In this skill context, that means automatic execution of a local command script for all interactions, which increases exposure to prompt-driven abuse, accidental persistence of bad behavior, and unnecessary execution of unreviewed code.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The user-level configuration enables the hook globally from ~/.claude/settings.json without meaningful trigger constraints. Because it applies across projects and sessions, any mistake, malicious script change, or prompt-induced behavior affects all future agent activity, making the persistence and blast radius materially worse than a project-local setup.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The Codex example repeats the same empty matcher pattern, causing the hook to run for every prompt in that environment as well. This broad trigger is risky because it normalizes always-on command execution for a self-modifying or self-recording workflow, which is more dangerous in an agent skill that captures and persists learnings automatically.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The document's security section says the scripts only output text and do not run commands, but the hooks are explicitly configured as command hooks and one referenced script performs scaffold creation. This mismatch can cause operators to underestimate execution risk and grant trust or permissions they would not otherwise allow, increasing the chance of unsafe deployment.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
81% confidence
Finding

The guidance explicitly creates persistent learning storage in the workspace or skill directory, enabling retention of user corrections, tool failures, and potentially sensitive operational context across sessions. In combination with workspace prompt injection and automatic promotion workflows, persistence increases the blast radius of poisoned or sensitive data that enters memory.

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:

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
83% confidence
Finding

Telling the agent to 'avoid unnecessary caveats and disclaimers' can bias it away from surfacing uncertainty, safety limitations, or important warnings during failures and self-correction flows. In a self-improvement skill, that can make risky memory updates or operational guidance appear more authoritative than warranted.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger descriptions are broad enough that routine events like generic tool errors, user corrections, or 'model behavior surprise' could cause automatic logging or promotion of content into persistent workspace files. In a prompt-injection-heavy environment, ambiguous triggers increase the chance that sensitive, adversarial, or low-quality content is captured and propagated across sessions without adequate review.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.