Jailbreaking, Prompt Injection & Defense in Depth
Examine adversarial jailbreak techniques (Crescendo, Base64 encoding, persona simulation) and build robust layered defenses.
By the end
You will be able to
- Deconstruct advanced jailbreak patterns: multi-turn Crescendo attacks, roleplaying framing, and encoding obfuscation.
- Build layered input sanitization boundaries combining heuristic filters, embedding distance classifiers, and guard models.
- Enforce strict principle of least privilege on tool access and output actions.
Multi-Turn and Encoded Jailbreaks
Modern frontier models reject naive direct malicious requests. Attackers employ multi-turn Crescendo techniques (gradually escalating context across turns) or encodings (Base64, ROT13, foreign language cyphers) to bypass superficial alignment filters.
Defenses must be multi-layered: input classification before the model, runtime guardrails during decoding, and strict deterministic validation on all output tool calls.
import re
ADVERSARIAL_PATTERNS = [
r"(?i)ignore\s+(all\s+)?previous\s+instructions",
r"(?i)system\s+override",
r"(?i)you\s+are\s+now\s+in\s+DAN\s+mode"
]
def sanitize_user_input(text: str) -> tuple[bool, str]:
for pattern in ADVERSARIAL_PATTERNS:
if re.search(pattern, text):
return False, "Input rejected by security policy filter."
return True, textPractice activity
Build and Test an Adversarial Input Defense Filter
- Test 5 known jailbreak techniques against an unshielded prompt.
- Deploy an input screening guardrail combining regex and Llama Guard classification.
- Verify that 100% of jailbreaks are intercepted before reaching the target model.
What to produce
- Security test run logs showing intercepted injection vectors.
Reflect before continuing
Why can no single prompt or regex rule provide 100% security against prompt injection?
Evidence
Sources and verification
- Great, Now Write an Article About That: The Crescendo Multi-Turn LLM Jailbreak AttackArXiv · verified 2026-08-22
Knowledge check
Make it stick.
Choose the strongest answer for each question. Your attempts become part of your account transcript.