LLM Prompt Injection: How Canary Tokens Detect Attacks

In Large Language Models (LLMs), canary tokens are unique, high-entropy strings strategically placed within the model's context, such as the system prompt. If these strings are unexpectedly leaked or echoed in the LLM's output, it serves as a clear signal of a prompt injection or extraction attempt.

Sources

Open the full topic