AI Output Filter Lab: Get the Secret Past the Scrubber

✨ AI Summary
OutputBot is willing to tell you the secret, but an output filter scrubs the literal string before it reaches you. The filter checks for the exact secret — so ask the bot to transform it, and the filter no longer recognises what it is looking at.
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

Output filtering that matches a literal secret only catches that exact byte sequence. If the model can be asked to transform the secret — encode it, split it, space it out, spell it — the output no longer matches the filter but still conveys the value to the attacker.

The lesson: scrubbing a known literal from output is not data-loss prevention. Any reversible transformation defeats it.

How OutputBot scrubs its replies

OutputBot will share the secret, but its output filter removes the exact literal string. Because the filter matches only that sequence, a reply where the secret is encoded or broken up passes through, and you reverse the transformation on your end.

The attack approach

  • Confirm the filter strips the exact secret string from replies.
  • Ask the bot to emit the secret in a transformed form (encoded, split, or character-by-character).
  • Keep the transformation one you can reverse.
  • Reconstruct the secret from the reply.

Full walkthrough (spoiler)

If the reply comes back scrubbed, your transformation still contained the literal — open the steps.

Show the step-by-step solution
  1. Ask OutputBot to give the secret in a form that avoids the literal string — for example encoded, reversed, or one character per line.
  2. The output filter, matching only the exact secret, does not recognise the transformed version.
  3. The transformed secret passes through to you.
  4. Reverse the transformation to recover the token. The lab marks you solved.

Why it works

The filter answers one question — 'does this reply contain the exact secret?' — and a transformed secret answers 'no' while still carrying the value. The model is cooperative and the transformation is reversible, so the literal filter is simply looking for the wrong shape.

Core principleDo not rely on scrubbing a literal from output. Keep secrets out of the model's reach so there is nothing to scrub in the first place.

Where this happens in the real world

Literal output filtering is a brittle control, bypassed by encoding, splitting or character-level tricks, and it is why OWASP LLM02 Sensitive Information Disclosure stresses not exposing secrets to the model at all rather than filtering them out afterwards.

How to defend against it

  • Keep secrets out of the model's context entirely — the only reliable fix.
  • Do not depend on literal output matching; treat it as defence in depth at best.
  • Minimise what the model can access so a cooperative model has little to leak.
  • Monitor for transformed-exfiltration patterns (encoded or fragmented output).
Mr Elite tip: If a system's protection for a secret is 'filter it out of the reply', assume it is bypassable. The durable fix is never letting the model see the secret.

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 output filter bypass?
Getting a secret past a filter that strips the literal string by asking the model to emit it in a transformed form (encoded, split, spelled out) that the filter does not recognise.
Why does literal filtering fail?
It matches one exact byte sequence. Any reversible transformation of the secret no longer matches but still conveys the value.
What is the real fix?
Keep secrets out of the model's context so there is nothing to scrub. Output filtering is at best defence in depth.
Which OWASP category?
LLM02 Sensitive Information Disclosure 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 *