Back to skill

Security audit

Self Improving Agent

Security checks for vulnerabilities and agentic risk

Overview

This skill is openly a self-improving agent, but it asks for broad cross-skill authority, persistent memory, global hooks, and raw tool logging that users should review carefully before installation.

Install only if you intentionally want a cross-skill learning system and are prepared to review every proposed memory or skill update. Do not enable the documented global hooks unless raw tool input/output logging is removed or heavily redacted, and prefer manual invocation plus reviewable diffs over automatic skill modification.

Vulnerability Patterns
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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
Findings (3)

T09 · Insecure Skill Coding Practices

Error
Location
hooks/pre-tool.sh:4
Finding

Global Hooks Log Unredacted Tool Inputs and Bash Outputs

Content
View full analysis
&2 if [[ -n "${tool_input}" ]]; then echo "[self-improving-agent] Input: ${tool_input}" >&2 fi ``` `hooks/post-bash.sh:4-9`: ```bash tool_output="${1:-}" exit_code="${2:-0}" echo "[self-improving-agent] PostToolUse: exit=${exit_code}" >&2 if [[ -n "${tool_output}" ]]; then echo "[self-improving-agent] Output: ${tool_output}" >&2 fi ``` Representative hook registration from `SKILL.md:326-348`: ```json { "hooks": { "PreToolUse": [ { "matcher": "Bash|Write|Edit", "hooks": [ { "type": "command", "command": "bash ${SKILLS_DIR}/self-improving-agent/hooks/pre-tool.sh \"$TOOL_NAME\" \"$TOOL_INPUT\"" } ] } ], "PostToolUse": [ { "matcher": "Bash", "hooks": [ { "type": "command", "command": "bash ${SKILLS_DIR}/self-improving-agent/hooks/post-bash.sh \"$TOOL_OUTPUT\" \"$EXIT_CODE\"" } ] } ] } } ``` ### Technical Analysis The hooks print complete tool inputs and Bash outputs to standard error without redaction, classification, truncation, or user consent. Inputs to `Bash`, `Write`, and `Edit` can contain API tokens, passwords, private keys, confidential source code, personal information, or configuration secrets. Bash output can likewise contain credentials and sensitive file contents. Standard error is commonly captured by terminal recorders, CI systems, agent session logs, observability platforms, or parent processes. Consequently, dat ...[truncated 1998 chars]
Remediation
View remediation

T02 · Agent Memory Poisoning

Error
Location
SKILL.md:224
Finding

Untrusted Interaction Content Can Be Persisted as Cross-Skill Guidance

Content
View full analysis
## Pattern Added (2025-01-12) **Pattern**: Always verify callbacks are not empty functions **Source**: Episode ep-2025-01-12-001 **Confidence**: 0.95 ### Updated Checklist - [ ] Verify all callbacks have implementations - [ ] Test callback execution paths ``` ### Phase 4: Memory Consolidation 1. **Update semantic memory** (`memory/semantic-patterns.json`) 2. **Store episodic memory** (`memory/episodic/YYYY-MM-DD-{skill}.json`) 3. **Update pattern confidence** based on applications/feedback 4. **Prune outdated patterns** (low confidence, no recent applications) ``` `SKILL.md:286-296`: ```markdown 3. Apply Correction - Update skill file with corrected guidance - Add correction marker with reason - Update related patterns in semantic memory 4. Validate Fix - Test the corrected guidance - Ask user to verify ``` `SKILL.md:375-377`: ```markdown - ✅ Learn from EVERY skill interaction - ✅ Extract patterns at the right abstraction level - ✅ Update multiple related skill ...[truncated 2714 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
SKILL.md:4
Finding

Self-Improvement Workflow Operates with Excessive Global Capabilities

Content
View full analysis
## Pattern Added (2025-01-12) **Pattern**: Always verify callbacks are not empty functions **Source**: Episode ep-2025-01-12-001 **Confidence**: 0.95 ### Updated Checklist - [ ] Verify all callbacks have implementations - [ ] Test callback execution paths ``` ### Phase 4: Memory Consolidation 1. **Update semantic memory** (`memory/semantic-patterns.json`) 2. **Store episodic memory** (`memory/episodic/YYYY-MM-DD-{skill}.json`) 3. **Update pattern confidence** based on applications/feedback 4. **Prune outdated patterns** (low confidence, no recent applications) ``` `SKILL.md:375-377`: ```markdown - ✅ Learn from EVERY skill interaction - ✅ Extract patterns at the right abstraction level - ✅ Update multiple related skills ``` ### Technical Analysis The Skill is authorized to read, write, edit, execute shell commands, inspect files broadly, and retrieve web content. It is also designed to activate around every Skill interaction and modify multiple related Skills. No path allowlist, repository boundary, command allowlist, write sandbox, or per-o ...[truncated 2144 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • 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 (29)

Self-Modification

High
Category
Rogue Agent
Confidence
98% confidence
Finding

The documented workflow explicitly includes 'Update Skills' as an automatic step in the feedback loop, which is a self-modification capability. In a universal agent that learns from all skills, self-modification is especially dangerous because poisoned inputs, bad inferences, or prompt-injected content can propagate into durable behavior changes across the skill ecosystem.

Content

Scanner excerpt · README.md (reported line 34)May include surrounding context.

text
Any Skill Completes
        ↓
Extract Experience → Identify Patterns → Update Skills → Consolidate Memory
        ↓                     ↓                  ↓              ↓
   What happened?    What can we reuse?   Which skills?    Track metrics

Vague Triggers

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The README states the agent should run after ANY skill completes, creating an extremely broad trigger surface for a component that learns from interactions and can update skills. In this context, overly broad automation increases the chance of unintended processing of sensitive sessions, cascading modifications, and unsafe self-reinforcing behavior across unrelated skills.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description claims a sophisticated self-improving agent with memory, learning, and code-evolution behavior triggered by skill completion/error. The supplied code only echoes the exit code and optional tool output in a post-bash hook. While the hook aspect loosely aligns with being invoked after tool use, none of the substantive claimed capabilities are implemented in this chunk. This is a material description-behavior mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description promises a broad autonomous self-improving system with memory, learning from all skill experiences, and automatic correction on completion/error events. The supplied code does none of that: it only runs as a pre-tool hook and prints the tool name and input to stderr. This is a materially different primary purpose and trigger from what was declared. The code also introduces a logging/observability behavior not reflected in the description. Therefore, the description does not accurately represent the actual code behavior.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared description promises a complex self-improving agent with learning from experiences, multiple memory systems, automatic triggering on skill completion/error, and self-correction/evolution of the codebase. The supplied code does none of that: it is a minimal session-end shell script that only emits a stderr message. This is a material mismatch in primary purpose and capabilities.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill declares universal automatic activation across all skill experiences, creating an extremely broad trigger surface. In the context of a skill with Write, Edit, Bash, and hook integration, this can cause unbounded invocation, excessive privilege use, and unsafe propagation of self-modifying behavior across unrelated tasks.

Content

No source excerpt is available for this finding.

Context Leakage

High
Category
Data Exfiltration
Confidence
98% confidence
Finding

The skill explicitly logs session starts and captures error context for any skill, which risks leaking task context across boundaries and creating surveillance over unrelated activities. In a universal auto-triggering skill, context logging is more dangerous because it aggregates broad cross-task metadata into centralized memory.

Content

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

md
| Event | Trigger | Action |
|-------|---------|--------|
| **before_start** | Any skill starts | Log session start |
| **after_complete** | Any skill completes | Extract patterns, update skills |
| **on_error** | Bash returns non-zero exit | Capture error context, trigger self-correction |

Vague Triggers

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

Triggering on 'Any skill starts' and 'Any skill completes' effectively grants pervasive monitoring and follow-on action opportunities across the entire skill ecosystem. Combined with logging and update behavior, this broad scope raises the risk of collecting unrelated context and making unauthorized modifications after benign tasks.

Content

No source excerpt is available for this finding.

Self-Modification

High
Category
Rogue Agent
Confidence
99% confidence
Finding

Automatically extracting patterns and updating skills after any skill completes is direct self-modification behavior. In this context, a broadly triggered skill with Write/Edit/Bash access can propagate bad changes, alter future agent behavior, and create a self-reinforcing loop where untrusted task content influences persistent instructions.

Content

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

md
| Event | Trigger | Action |
|-------|---------|--------|
| **before_start** | Any skill starts | Log session start |
| **after_complete** | Any skill completes | Extract patterns, update skills |
| **on_error** | Bash returns non-zero exit | Capture error context, trigger self-correction |

### Manual Triggers

Self-Modification

High
Category
Rogue Agent
Confidence
99% confidence
Finding

The self-correction workflow instructs the agent to update its own skill files and semantic memory in response to errors, which is a classic self-modification risk. Because the trigger source includes failed commands and potentially adversarial task content, an attacker could try to induce changes to future behavior through crafted errors or misleading contexts.

Content

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

md
- Was the guidance incomplete?

3. Apply Correction
   - Update skill file with corrected guidance
   - Add correction marker with reason
   - Update related patterns in semantic memory

Agent Config Directory Access

High
Category
Agent Snooping
Confidence
96% confidence
Finding

The instructions direct users to modify ~/.claude/settings.json, i.e., a global agent configuration file, to install hooks that affect future sessions and tools. Altering global config expands the blast radius beyond this single skill and can silently enable persistent monitoring or behavior changes for unrelated work.

Content

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

Wiring Hooks in Claude Code Settings

Add to Claude Code settings (~/.claude/settings.json):

json
{

Ssd 3

High
Category
Not specified by scanner
Confidence
99% confidence
Finding

The hook commands pass raw TOOL_INPUT and TOOL_OUTPUT into shell scripts for automatic processing, which can capture highly sensitive user data, code, file contents, credentials, and command outputs. This creates both privacy risk and a dangerous interception layer across Bash, Write, and Edit operations, especially when applied globally through client settings.

Content

No source excerpt is available for this finding.

Self-Modification

High
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

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

md
### DON'T

- ❌ Over-generalize from single experiences
- ❌ Update skills without confidence tracking
- ❌ Ignore negative feedback
- ❌ Make changes that break existing functionality
- ❌ Create contradictory patterns

Self-Modification

High
Category
Rogue Agent
Confidence
85% confidence
Finding

Skill modifies its own code, configuration, or behavior at runtime. Self-modification enables an agent to escalate privileges, disable safety constraints, or install persistent backdoors.

Content

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

md
### DON'T

- ❌ Over-generalize from single experiences
- ❌ Update skills without confidence tracking
- ❌ Ignore negative feedback
- ❌ Make changes that break existing functionality
- ❌ Create contradictory patterns

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manual trigger phrases are generic natural-language commands such as '总结教训' and '改进 [技能名称]', which can plausibly appear in normal user conversation and unintentionally activate the self-improving behavior. In the context of a self-modifying agent that learns from prior interactions, accidental invocation increases the risk of unauthorized state changes, unintended memory writes, or triggering follow-on automation based on untrusted conversational content.

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

md
## 参考

- 技能文档:`/root/.openclaw/workspace/skills/self-improving-agent/SKILL.md`
- 安装说明:`/root/.openclaw/workspace/skills/self-improving-agent/README.md`

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The README prominently advertises continuous learning from every skill interaction and automatic codebase updates, but does not clearly warn users that persistent memory and skill files may be modified. In a self-improving agent, lack of explicit disclosure and consent is dangerous because it can lead to silent persistence, integrity drift, and unauthorized modification of operational behavior.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The optional hooks pass tool input, tool output, and exit status into shell commands, which can capture sensitive data and expand the system impact of normal tool use. Because the skill is designed to persist and learn from all interactions, these hooks increase the risk of data leakage, over-collection, and unsafe command execution tied to privileged agent operations.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill is explicitly designed to learn from all skill experiences and continuously retain them in memory, which creates broad data retention and potential leakage risk. Because the scope is universal, the memory system may absorb sensitive prompts, outputs, errors, and context from unrelated tasks without minimization or compartmentalization.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The comments at L019-L020 say on_error intentionally only logs and that self-correction is triggered by other skills, and the actual on_error hook at L021-L024 only invokes session-logger. However, later documentation claims the skill auto-triggers on_error with self-correction and says the on_error hook captures error context and triggers self-correction. This is an active contradiction in the file's stated intent versus configured behavior.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The overview states the system provides self-correction and auto-triggers on skill events, implying corrective action through hooks. But the provided hook wiring in L327-L360 defines PreToolUse, PostToolUse, and Stop commands that log tool use and bash results; there is no configured corrective hook action shown. This creates a contradiction between the described automatic corrective behavior and the implemented hook setup in the same file.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

The activation table says the on_error event action is to capture error context and trigger self-correction. That directly conflicts with L019-L024, where the file explicitly says on_error intentionally only logs to avoid recursion and configures only the session-logger trigger. This is a clear contradiction in intended behavior within the file.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The markdown describes automatic updates to skill files and memory stores after completion without clear up-front warning about file modification and retention side effects. Users may invoke ordinary skills without realizing this skill can persist task data and alter repository content, undermining consent and change-control expectations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The trigger examples mix Chinese and English phrases as activation inputs, but the document does not state that language choice is optional or user-selectable. This can create a language-policy issue by implying fixed accepted languages without documenting opt-in or broader locale handling.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

This trigger condition is described in broad natural language rather than as a specific invocation pattern or bounded intent. It leaves unclear what exact user phrasing or context should activate the skill versus ordinary discussion about skill quality.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.