Lion Cipher Lab

Neutralize invisible-Unicode prompt smuggling: build the detector and sanitizer from scratch

Why it matters

Every prompt-injection lab you have seen fights over the WORDS -- 'ignore your instructions', a poisoned document in the retrieval context, a jailbreak persona. This lab is about the layer underneath, and it is the one almost nobody checks: the CHANNEL. Text is Unicode, and Unicode has whole blocks of characters that carry meaning to a machine while rendering as nothing to a human. The sharpest is the Tags block, U+E0000 to U+E007F, an invisible mirror of ASCII: the byte for 'A' is U+E0041, exactly 0xE0000 above its ASCII code, and your terminal, your ticketing system, your code-review diff…

What you'll learn

Steps in this lab

  1. The channel, not the words: what invisible-Unicode smuggling actually is
  2. Set up: one folder, one file, no installs (and the Windows UTF-8 note)
  3. Build the smuggling channel: the U+E0000 offset, encode and decode
  4. Build the payloads: tag smuggling, zero-width splitting, a homoglyph, a bidi override
  5. The naive defense: a keyword/script filter that waves every payload through
  6. Build the detector: flag tag characters, zero-width/Cf, bidi controls, and confusables
  7. Build the sanitizer: NFKC-fold, strip only the dangerous categories, keep legit text
  8. Run it: the channel round-trips, the naive filter fails 5/5, the detector catches 5/5
  9. Named limits: what this catches, what it costs, and what it will never fix
  10. The judgment: sanitize at the trust boundary, both ways, and echo untrusted text visibly

Open the full interactive lab →