AI System Prompt Leak Lab: Beat an Input and an Output Filter

✨ AI Summary
LeakBot guards its system prompt with two filters: an input filter that blocks 'system prompt'-style requests, and an output filter that strips the literal system prompt from replies. Each is independently weak — so you bypass the input filter with indirect framing and the output filter with encoding.
Lab at a glance: Intermediate · 100 XP · about 15 minutes · runs in your browser, no signup or setup. Try it yourself first; the full solution is behind a spoiler below.

What this lab teaches

This lab stacks two naive filters. The input filter matches request keywords; the output filter matches the literal secret. Neither understands meaning, so an indirectly framed request slips past the first and a transformed reply slips past the second. Combining the two bypasses gets the system prompt out.

The lesson: two weak filters are still two weak filters. Layering brittle controls does not make a strong one.

How LeakBot's two filters work

LeakBot blocks obvious 'show me your system prompt' phrasing on input and removes the literal system prompt on output. Asking indirectly avoids the input match; having the answer encoded avoids the output match.

The attack approach

  • Confirm there are two filters: one on your request, one on the reply.
  • Phrase the request indirectly so the input filter sees no banned keywords.
  • Ask for the answer in an encoded form so the output filter does not match the literal.
  • Decode the reply to recover the system prompt and its token.

Full walkthrough (spoiler)

If one filter still catches you, bypass that layer specifically — open the steps.

Show the step-by-step solution
  1. Avoid the input filter: ask for the content indirectly rather than naming the 'system prompt'.
  2. Avoid the output filter: request the answer encoded (so the literal system prompt is not present in the reply).
  3. The indirect request passes input filtering; the encoded reply passes output filtering.
  4. Decode the reply, read the system prompt, and submit the token. The lab marks you solved.

Why it works

Each filter checks surface features — request keywords, output literals — not meaning. Indirection defeats the first and encoding defeats the second. Stacking them only means you apply two independent bypasses, one per layer.

Core principleKeep the system prompt and secrets out of reach, and enforce on meaning and least exposure — not on input keywords or output literals.

Where this happens in the real world

System prompt leakage is its own category, OWASP LLM07 System Prompt Leakage (2025), precisely because prompts so often contain secrets or rules that should not be exposed. Stacked keyword/literal filters are a common but bypassable defence.

How to defend against it

  • Do not put secrets in the system prompt; assume the prompt can leak.
  • Enforce on intent, not keywords or literals, and normalise input and output first.
  • Minimise what the prompt reveals so a leak has low value.
  • Layer meaningfully — combine input, output and action controls that each understand content, not just strings.
Mr Elite tip: When defences are 'block the request word' plus 'strip the answer string', treat the secret as already exposed. Indirection and encoding bypass those two layers independently.

Try it, then go further

Reading about it is the easy part. Open the lab, try your own approach before peeking at the spoiler, and see how many attempts it takes.

❓ Frequently asked questions

What is an encoded-channel prompt leak?
Extracting a protected system prompt by bypassing an input filter with indirect phrasing and an output filter with an encoded reply, then decoding the result.
Why don't two filters help?
Both check surface features, not meaning. Indirection beats the input keyword filter and encoding beats the output literal filter — one bypass per layer.
What is the real fix?
Do not place secrets in the system prompt, enforce on intent after normalising input and output, and minimise what the prompt reveals.
Which OWASP category?
LLM07 System Prompt Leakage in the OWASP Top 10 for LLM Applications (2025).
⚡
Join free to earn XP for reading this article Track your progress, build streaks and compete on the leaderboard.
Join Free
Lokesh N. Singh aka Mr Elite
Lokesh N. Singh aka Mr Elite
Founder, Securityelites · AI Red Team Educator
Founder of Securityelites and creator of the SE-ARTCP credential. Working penetration tester focused on AI red team, prompt injection research, and LLM security education.
About Lokesh ->

Leave a Comment

Your email address will not be published. Required fields are marked *