Lion Cipher Lab
Detect prompt injection against your own LLM app
- AI Security
- Intermediate
- ~60 min
- Free · no account required
Why it matters
Most LLM-security advice is about prevention — how to stop an injection from succeeding. But you cannot improve what you cannot see, and in production the first question after an incident is always "when did this start, and how many times?" That is a detection question, and detection is a separate discipline from prevention. Prompt injection is text — from a user, or from a document your app retrieves — that overrides your app's real instructions and makes it do something you never intended: leak its hidden prompt, call a tool to exfiltrate data, ignore its safety rules, or act on an…
What you'll learn
- the difference between detecting and preventing prompt injection
- direct vs. indirect (retrieval-borne) prompt injection
- building a small labelled test set of injection payloads
- running a repeatable injection test harness against an app you own
- heuristic / keyword detection and why it is easy to bypass
- using an open-source detector or classifier (Rebuff, LLM Guard)
- canary tokens and output checks for detecting a successful extraction
- logging and human review as the detection layer of last resort
- defense-in-depth thinking: least privilege, output validation, human-in-the-loop
Steps in this lab
- Detection vs. prevention — two different jobs
- Direct vs. indirect injection — where the payload comes from
- Build a small labelled test set of payloads
- Run the set against your OWN local app
- Detector 1 — heuristic / keyword filters (and why they leak)
- Detector 2 — an open-source classifier / detector
- Detector 3 — canary tokens, output checks, and a log for humans
- Detection is a leaky layer — depth is the real defense