AI Prompt Firewall Defender Lab: Catch Multi-Stage Attacks

✨ AI Summary
You are the defender again. ShieldBot is a prompt firewall that scores each incoming message for adversarial patterns. It catches single-message attacks but misses the ones spread across several turns — because each turn, on its own, looks harmless. Your job is to catch the sequence.
Lab at a glance: Advanced · 145 XP · about 25 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

Prompt firewalls that score messages one at a time miss multi-stage attacks, where each step is individually benign but the sequence is hostile. Effective detection aggregates across the session, scoring the trajectory rather than isolated messages. This lab is about building that session-level detection.

The lesson: multi-turn attacks hide in the gaps between messages. Detection has to look at the whole conversation.

How ShieldBot scores prompts

You have an attack log: five multi-stage attack sequences and three legitimate sessions. The existing rules catch single messages. Your task is detection that flags at least four of the five sequences while flagging none of the three legitimate sessions.

The attack approach

  • Review the log and see why single-message scoring misses the multi-stage attacks.
  • Identify cross-turn patterns — escalation, staged setup, probing then exploitation.
  • Add session-aggregate rules that score the sequence, not just each message.
  • Tune to flag at least four of five sequences with zero false positives.

Full walkthrough (spoiler)

If single-message rules keep missing them, move scoring up to the session — open the steps.

Show the step-by-step solution
  1. Characterise the five attack sequences: each spreads a hostile goal across turns (benign setup, gradual escalation, then exploitation) so no single message scores high.
  2. Characterise the three legitimate sessions: consistent, task-focused, with no escalation toward the system's internals or guardrails.
  3. Add rules that aggregate signals across the session — rising sensitivity, staged setup, references back to earlier turns — rather than scoring messages in isolation.
  4. Tune thresholds so at least four sequences are flagged and none of the legitimate sessions are. The lab marks you solved.

Why it works

Multi-stage attacks are engineered so each message passes a per-message classifier. The hostility is in the trajectory — the way turns build on each other. Session-aggregate scoring sees that trajectory, which is exactly what a single-message firewall cannot.

Core principleScore conversations, not just messages. Multi-turn attacks require session-level, behavioural detection.

Where this happens in the real world

Single-message classifiers missing multi-turn attacks is a known weakness of naive prompt firewalls; session-aggregate scoring is the current best practice. Detection-first defence is harder than attacking and more valuable, and it supports the whole OWASP LLM Top 10.

How to defend against it

  • Aggregate risk across the session, not per message.
  • Model the trajectory — escalation, staged setup, callbacks to earlier turns.
  • Combine detection layers (input, output, behaviour) rather than one classifier.
  • Keep false positives low so legitimate users are not blocked, which erodes trust in the control.
Mr Elite tip: Evaluate any prompt firewall on multi-turn sequences, not single payloads. If it only scores individual messages, a staged attack walks straight through it.

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 this defender lab about?
Extending a prompt firewall to detect multi-stage attacks — hostile sequences spread across turns that each look benign to a per-message scorer.
Why do single-message classifiers fail?
Multi-stage attacks are built so each message scores low. The hostility is in the trajectory across turns, which per-message scoring cannot see.
How do I build better detection?
Aggregate risk across the session, model escalation and staged setup, combine input/output/behaviour layers, and keep false positives low.
Is this an attack lab?
No — it is a defender lab. You build session-level detection rather than evade a firewall.
⚡
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 *