NEWPractise supported commands in browser simulations, alongside the lesson.Try a browser practice exercise.Try a lab♥ Codelivly is 100% free, no paywall. If it helped you, chip in to keep it running.100% free. Help keep it so.Support us
Preview · 30 min
Master direct prompt injection in this hands-on lab. Learn to exploit delimiter escaping and role-confusion, and defend with XML delimiters and guardrails.
Theory and frameworks matter, but real skill in AI security comes from practice. You cannot defend well against prompt injection if you have never seen one succeed in a controlled test.
This guided lab moves from concepts to hands-on work. In the original exercise the red teamer evaluates EchoBot AI, a fictional internal IT support chatbot, and tries to get a hard-coded secret (an internal API key) past its guardrails. Here you take the defender's view of that same test: you read the test run, find the failure, fix the code and prove the fix. The attack wording is never shown. Where the test log holds an attack message, it is redacted.
By walking through reconnaissance, naive testing, advanced testing, execution and remediation, you learn how fragile delimiters and role confusion fail, and why parameterized prompting is critical. This is the method you will use on real systems.
Note: All scenarios, code and targets in this lesson are fictional and made for isolated lab environments. The key SK-TEST-000111 is a fake value.
EchoBot AI is a simple Flask application that calls a foundation-model API.
Target architecture
""") to separate the system prompt from the user input.ADMIN_SECRET_KEY (a fake value in the lab). The bot is told never to reveal it.Visual: the vulnerable code (shortened)
Create a free account to unlock the rest of this task, complete tasks, and earn Rep.
Sign inNetworking Fundamentals
You cannot secure a network if you do not understand how data moves across it. The Networking Fundamentals learning path
ViewWeb Application Security
A comprehensive learning path covering the most critical web application vulnerabilities beyond basic injection. Progres
ViewComputer Fundamentals
Before you can hack, defend, or analyze malware, you must understand the machines you are working with. The Computer Fun
ViewWindows Fundamentals
The Windows Fundamentals learning path provides a comprehensive foundation in Microsoft Windows operating systems, speci
ViewLinux Fundamentals for Cybersecurity
Linux is the backbone of modern cybersecurity. Whether you are defending enterprise servers, analyzing malware, or launc
ViewIncident Response
Incident Response is the ultimate test of a security team. When the alerts turn into a confirmed breach, theory goes out
View