The vulnerability is a series of prompt injection flaws stemming from insufficient and decentralized input sanitization. The agent was susceptible to malicious inputs from three primary sources: context files (AGENTS.md, etc.), persisted memory files (MEMORY.md), and the output of tools that access external content (e.g., web_extract).
-
Context File Injection: The _scan_context_content function in agent/prompt_builder.py used a limited, local set of regex patterns to scan files that are directly injected into the system prompt. These patterns were bypassable.
-
Memory Injection: Similarly, the MemoryStore.load_from_disk method in tools/memory_tool.py relied on a separate but also insufficient set of patterns to scan memory files loaded from disk.
-
Indirect Prompt Injection: The make_tool_result_message function in agent/tool_dispatch_helpers.py treated all tool outputs as trusted, passing them directly to the model. This allowed malicious content from external sources, like web pages, to be interpreted as instructions.
The patch addresses these issues comprehensively. It centralizes threat detection into a new tools/threat_patterns.py module with more robust and extensive patterns (including detection for C2-like behavior). It then refactors the vulnerable functions to use this centralized scanner. For indirect injection, it implements an architectural defense by wrapping outputs from untrusted tools in semantic delimiters, instructing the model to treat the content as data, not instructions.