How the attack works
An attacker plants text containing chat-template role delimiters somewhere the AI agent will read it, such as a file, webpage, or tool output the agent retrieves. If the agent's underlying model gets confused by these delimiters and treats injected content as a trusted instruction, it can end up running a command on the host that still carries the leftover role-delimiter tokens. The rule watches the agent's process and any processes it spawns within a short window, and checks whether those role-delimiter strings appear in an actually-executed command line. It does not see the injection or the model's internal confusion directly — only this downstream trace of it reaching the operating system.
Why it matters
If this fires, a prompt injection has likely moved beyond just poisoning the AI's context and turned into a real action on the host — potentially arbitrary command execution under the agent's privileges.
What you can do
- Treat any hit as a report-only lead, not a block signal, and investigate the specific command and its origin before acting.
- Check whether the flagged process is a legitimate prompt-engineering or template tool (e.g. llama.cpp, ollama, vllm flags, tokenizer tests) before treating it as an attack.
- Restrict what content sources (files, web pages, tool outputs) your AI agents can pull into their context without human review.
- Limit the agent process's ability to execute shell commands, or require approval for command execution triggered by agent-retrieved content.
Known benign look-alikes
- Prompt-engineering or evaluation harnesses launched by an agent that legitimately pass chat-template strings on the command line (llama.cpp --in-prefix "<|im_start|>user", ollama/vllm template flags, tokenizer unit tests).
- Agent-driven grep/rg/git-grep over prompt template files or ChatML fine-tuning datasets (.jsonl records containing <|im_start|> / [INST] markers).
- Dataset conversion or prompt-formatting one-liners (python -c, jq, sed) that embed role delimiters as literal arguments.
- Security research and red-team tooling reproducing template-injection payloads inside a monitored agent session.