T02 · Agent Memory Poisoning
- Location
SKILL.md:262- Finding
Untrusted Learnings Can Be Promoted into Persistent Agent Instruction Files
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This self-improvement skill is coherent in intent, but it gives broad persistent influence over future agent behavior and cross-session context without enough guardrails.
Review this carefully before installing. Use project-local configuration only, avoid user-level/global hooks, keep hook matchers narrow, do not allow automatic promotion into CLAUDE.md, AGENTS.md, SOUL.md, TOOLS.md, or Copilot instructions, and redact secrets, personal data, proprietary context, and transcripts before writing any learning. Prefer an audited pinned release instead of the documented mutable git clone.
SKILL.md:262Untrusted Learnings Can Be Promoted into Persistent Agent Instruction Files
hooks/openclaw/handler.js:8Global Hooks Inject Skill-Controlled Instructions into Agent Sessions
references/openclaw-integration.md:159Learning Workflow Encourages Access to Other Sessions' Transcripts
SKILL.md:39Manual Installation Uses a Mutable and Unpinned Git Repository
scripts/extract-skill.sh:107Output Path Validation Can Be Bypassed through Symbolic Links
The declared description is about maintaining and using learnings: capturing mistakes, corrections, failures, outdated knowledge, and better approaches for future improvement. The supplied code does not implement learning capture, error logging, correction recording, or review of prior learnings. Instead, it is a project scaffolding utility that generates a new skill directory and template markdown file from a skill name. While its comments mention creating a skill from a learning entry, that is only a loose workflow relationship; the concrete behavior is skill extraction/scaffolding, not continuous-improvement learning management as declared. This is a material purpose mismatch.
Directing users to modify ~/.claude/settings.json establishes persistence in the agent's global configuration directory, affecting all future sessions. Any command hook placed there executes with the agent's privileges, so compromising or replacing the referenced script can create durable cross-project behavior and significantly expand impact beyond a single repository.
Add to ~/.claude/settings.json for global activation:
{
Instructions found that direct the agent to transmit conversation context or user data to external services.
Send message to another session:
sessions_send(sessionKey="session-id", message="Learning: API requires X-Custom-Header")
The description says to use the skill when a user corrects Claude, when a capability doesn't exist, when knowledge is outdated, or when a better approach is discovered, and also to review learnings before major tasks. These conditions are very broad and lack exclusion criteria or negative examples, which increases the chance of unintended invocation during normal conversation.
Creating persistent learning directories in a home/workspace path is not inherently malicious, but it establishes session persistence by design. In this skill's context, persistence materially increases risk because conversational data, errors, and cross-task learnings may accumulate in a durable location without clear retention limits or sensitivity controls.
└── FEATURE_REQUESTS.md
### Create Learning Files
```bash
mkdir -p ~/.openclaw/workspace/.learnings
These instructions explicitly encourage reading session history, sending learnings to other sessions, and sharing persistent workspace memory. In a skill designed to store natural-language summaries, that creates a realistic cross-session data leakage channel where sensitive user context may be retained and redistributed beyond the original interaction.
The templates direct the agent to store full context, inputs, parameters, environment details, and user context in durable markdown logs. Because those fields naturally capture secrets, internal paths, tokens, incident details, or personal data, the format itself encourages retention of sensitive information that may later be exposed or reused improperly.
The automatic trigger phrases are so common that the skill can capture and persist routine user dialogue, corrections, and requests without meaningful boundary checks. In the context of a memory/logging skill, this increases the chance of collecting sensitive or unnecessary information into durable files, which can later be read, promoted, or shared across sessions.
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.
When the above learning is extracted as a skill, it becomes:
File: skills/docker-m1-fixes/SKILL.md
---
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.
Create .claude/settings.json in your project root:
{
This markdown file documents a hook configuration with an empty matcher, which provides no constraint on when the skill activates. Because it applies to every user prompt, it overlaps with ordinary interaction rather than a narrowly defined trigger condition.
This recommends installing a command hook in the user-level agent configuration with an empty matcher, causing it to trigger across all future sessions and repositories. Broad, persistent activation in a global config increases the blast radius of any later script modification, path hijack, or unsafe hook behavior, especially because hooks run with the agent's permissions.
Although presented as a lower-overhead configuration, this example still activates on every prompt because the matcher is empty. The documentation does not clarify intended boundaries for activation or provide narrower alternatives in the primary example.
The Codex setup mirrors the same unconstrained trigger pattern by leaving matcher empty. In documentation, this is an ambiguous activation condition because users are not given a clear boundary for when the hook should or should not run.
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.
openclaw hooks enable self-improvement
### 3. Create Learning Files
Create the `.learnings/` directory in your workspace:
The "Detection Triggers" section lists generic conditions like user corrections, API errors, and knowledge gaps without defining clear thresholds or exclusions. In a markdown skill guide, these broad natural-language triggers can overlap with normal operation and make it unclear when the skill should activate or record learnings versus when it should not.
This markdown template instructs authors to include trigger conditions, but the placeholder wording remains generic and does not require concrete trigger phrases, scope limits, or negative examples. Because this file is a reusable template for skill manifests, it may propagate ambiguous activation descriptions into downstream skills.
The minimal template's description field says only 'What this skill does and when to use it,' which does not instruct authors to define narrow activation criteria. In a template intended for broad reuse, this omission can lead to vague or collision-prone trigger descriptions.