T02 · Agent Memory Poisoning
- Location
hooks/openclaw/handler.js:10- Finding
Persistent agent instruction poisoning through learning promotion
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This self-improvement skill is not clearly malicious, but it broadly influences future agent behavior through persistent memory files, hooks, and cross-session guidance without enough scoping or approval controls.
Install only if you intentionally want an agent self-improvement system that can affect future sessions. Prefer project-local hooks over global hooks, avoid empty matchers unless you accept every-prompt activation, require explicit review before writing to MEMORY.md, SOUL.md, AGENTS.md, or TOOLS.md, and do not allow cross-session transcript access or message forwarding without clear user consent. Verify the exact package name and version before installation.
hooks/openclaw/handler.js:10Persistent agent instruction poisoning through learning promotion
hooks/openclaw/handler.js:27Recurring bootstrap injection of self-modification instructions
hooks/openclaw/handler.js:27Runtime handler omits the documented sub-agent exclusion
SKILL.md:17Unpinned package execution in the installation command
references/openclaw-integration.md:159Cross-session transcript access is recommended without authorization controls
scripts/extract-skill.sh:89Output-directory containment can be bypassed through symbolic links
The declared description presents a fairly feature-rich self-improvement skill with multiple named integrations and domestic deployment optimizations. The supplied code chunk does not implement those capabilities; it only prints a self-improvement reminder block. Additionally, the metadata says there are no triggers, but the script comments and behavior indicate it is intended to run as an activator on user prompt submission. This is a material description/behavior mismatch rather than a mere implementation detail.
The declared description presents an advanced agent-oriented skill focused on self-improvement and multiple named integrations. The supplied code does none of that. It is a standalone Bash script for creating a new skill scaffold under a skills directory, validating arguments, optionally doing a dry run, and writing a templated SKILL.md file. This is a materially different primary purpose, not merely an implementation detail. There are no signs of agent iteration, model/provider integration, memory handling, or the claimed workflow features.
Directing users to modify ~/.claude/settings.json establishes persistent agent behavior in a sensitive config directory. In this context, the setting wires automatic command execution into the agent runtime, so compromise of the referenced skill path or misconfiguration can create durable cross-project execution and influence over future sessions.
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 states the skill is '专为国内部署优化', which establishes a China-specific deployment and locale orientation as a default behavior. Under the policy, forcing a specific language or locale without explicit user choice should be flagged unless clearly justified as a region-specific compliance tool, which is not stated here.
The documentation tells users to execute npx clawhub install ... without pinning a specific package version or otherwise constraining what will be fetched and run. In an agent-skill context, this creates a supply-chain risk: a newer or compromised package version could be executed unexpectedly, especially because npx may download and run code on demand.
The line instructs '国内部署 - 用百度 API、本地模型、国内工具' as a normative best practice, effectively prescribing a specific regional toolset. Because the file does not provide an opt-in, opt-out, or alternative non-China workflow here, this is a natural-language locale policy violation.
The description and changelog state the skill is enhanced with 'China-friendly search patterns' and specifically references 'Baidu'. This suggests the skill may impose a locale-specific behavior by default, but the metadata does not mention user choice, opt-in, or a region-specific justification.
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
---
Creating .claude/settings.json in the project root introduces persistent hook behavior at the repository level, so anyone using the project may inherit automatic command-hook execution. While less dangerous than user-global persistence, it still expands the trust boundary and can surprise collaborators or future sessions if the scripts or config change.
Create .claude/settings.json in your project root:
{
An empty matcher causes the activator hook to run on every prompt, creating a broad and persistent trigger surface. In a self-improving skill context, that means untrusted or sensitive prompts may always be passed through the hook path, increasing exposure, overhead, and the blast radius of any future script change.
The user-level configuration instructs users to install a globally active hook in ~/.claude/settings.json, extending code-executing behavior across all projects and sessions. This increases persistence and scope: a mistake, malicious script modification, or unsafe prompt-handling behavior affects every future interaction rather than a single repository.
The guide claims the hook scripts 'only output text' and 'don't modify files or run commands,' but the documented configuration explicitly executes shell scripts via command hooks. This misrepresents the trust boundary and can cause users to install code-execution hooks under a false sense of safety, increasing the chance of abuse if the scripts are changed or replaced.
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 documentation explicitly describes reading other sessions' transcripts and sending messages across sessions, but it does not mention consent, access control, or privacy boundaries. In a workspace-prompt-injection environment, this increases the chance that sensitive context from one session can be accessed or relayed to another without the user's clear awareness.