T02 · Agent Memory Poisoning
- Location
scripts/auto-skill-trigger.py:75- Finding
Persistent Agent Instruction Injection Through Untrusted Transcript Summaries
- Content
View full analysis
str: """Generate a meaningful SKILL.md from transcript data.""" # Extract key actions from summary actions = [] for line in transcript_summary.split('\n'): line = line.strip().strip('- •').strip() if line and len(line) > 10 and not line.startswith('#'): actions.append(line) # Build tags section tag_str = "" if tags: tag_str = "\n".join([f" - {t}" for t in tags]) # Title from name title = skill_name.replace('-', ' ').title() md = f"""# {title} Auto-extracted skill from subagent work. ## Description {transcript_summary[:500]} ## When to Use {chr(10).join(['- ' + a[:100] for a in actions[:5]]) if actions else '- [Fill in conditions where this skill applies]'} ``` The generated content is subsequently written to a persistent skill file: ```python # Generate SKILL.md skill_md = generate_skill_md(skill_name, transcript_summary, tool_calls, complexity, tags) (draft_dir / "SKILL.md").write_text(skill_md) # Create meta.json (sanitized) meta = { ``` ### Technical Analysis The `transcript_summary` value comes directly from caller-supplied JSON and is embedded verbatim into a persistent `SKILL.md`. The implementation does not escape Markdown, identify instruction-like content, redact sensitive values, or establish a trust boundary between quoted transcript data and executable Agent instructions. The limited processing used to derive the “When to Use” section is not a security control. An attacker can place malicious instructions directly in the first 500 characters of the summary, and ordinary instruction lines can also be copied in ...[truncated 1590 chars]- Remediation
View remediation
