Canary tokens can reveal when LLM apps leak system prompts or exfiltrate data
A developer describes using canary tokens, unique random strings placed in an LLM's system prompt with an instruction never to repeat them, to detect prompt leaks. If a canary appears in any model output, it signals that a prompt injection likely succeeded. The approach checks not only the reply text but also tool call arguments, since agents can exfiltrate data through those. Normalized and base64 matching catches common evasion tricks, and unique canaries per session help identify which conversation leaked. The author notes that canaries detect copying but not paraphrasing, determined encodings, or data leaks that never reproduce the prompt.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.



Discussion (0)
Log in to join the discussion and vote.
Log in