Lion Cipher Lab

Detect and prevent system-prompt leakage (OWASP LLM07:2025)

Why it matters

A system prompt is the hidden instruction block an app prepends to every conversation to set the assistant's role and rules — the user never sees it, and developers routinely treat it as a safe place to stash things: an internal API key, a hidden business rule, a private URL. OWASP LLM07:2025 is the entry that says plainly this is the mistake. The risk is not that the prompt text is 'revealed' — prompts are not meant to be secret in the way a password is. The risk is what you embedded in it. If the prompt carries a credential or a rule that only works by being hidden, then leaking the prompt…

What you'll learn

Steps in this lab

  1. What system-prompt leakage is, and the anti-pattern behind it
  2. Open a terminal and check Python (zero-assumption setup)
  3. Why the model is a STUB — and what a canary token is
  4. Write the full program
  5. Run it and read the real scoreboard
  6. The spaced-encoding bypass, and how the layered guard defeats it
  7. The named failure mode: exact-match detection is whack-a-mole
  8. The real fix: don't embed the secret (architecture beats filters)
  9. When detection still earns its keep

Open the full interactive lab →