T02 · Agent Memory Poisoning
- Location
SKILL.md:51- Finding
Repository-Controlled Content Can Be Propagated into Persistent Agent Instructions
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:51-73;sub-skills/init/SKILL.md:7-20
Vulnerability Type: Persistent agent instruction poisoning
Risk Level: MediumVulnerable Code Snippets
SKILL.md:51-73:markdown **If no `CLAUDE.md` exists**: invoke the `init` skill at `sub-skills/init/SKILL.md`, then continue. **If CLAUDE.md exists**, read it and cross-check each section against the sources from Phase 1: **Commands** — compare against the actual command source. Fix changed commands, add useful new ones, remove deleted ones. **Architecture/structure** — compare described modules and key files against what exists on disk. Add new additions; remove deleted or renamed things. **Configuration/env vars** — compare against actual config files. Add new runtime-relevant settings; remove or correct stale ones. **Constraints and gotchas** — check whether any documented constraints have been resolved by recent work. **Env template**: verify it lists all vars the config requires. Missing vars here break fresh setups. **`@import` references**: scan for `@path/to/file` lines and verify each imported file still exists. A missing import silently breaks context loading. **Size**: if the file exceeds 200 lines, flag it — beyond that, adherence degrades and context cost rises. Suggest moving detail into `.claude/rules/` topic files. **`.claude/rules/`**: if this directory exists, check whether any path-scoped rule files reference commands, module names, or file paths that no longer match the current codebase. Fix or flag stale ones. **`CLAUDE.local.md`**: if this exists, give it the same pass as CLAUDE.md — it's the gitignored personal supplement and can go stale too. Be surgical: update what's stale, leave accurate content alone. It's read by a future Claude session.sub-skills/init/SKILL.md:7-20:markdown Please analyze this codebase and create a CLAUDE.md file, which will be given to ...[truncated 4240 chars]- Remediation
View remediation
Remediation Suggestions
- Treat README files, editor rules, Copilot instructions, existing Agent rules, and other repository content as untrusted data rather than authoritative behavioral instructions.
- Restrict generated content to independently verifiable technical facts, such as commands present in package configuration, concrete file paths, and architecture derived from source code.
- Explicitly reject source text that attempts to modify Agent safety policy, expand permissions, access credentials, contact external endpoints, or mandate execution of unverified commands.
- Generate a proposed patch and show the complete diff before modifying
CLAUDE.md,CLAUDE.local.md,.claude/rules/, or project skills. - Require explicit user approval before applying any persistent Agent-instruction change.
- Record the provenance of each imported fact so reviewers can identify which repository file supplied it.
- Avoid copying prose verbatim from untrusted instruction files. Normalize validated facts into a constrained schema or predefined template.
- Warn the user when conflicting instructions are found rather than automatically selecting or merging them.
