Open Agent School · Public worked example
Prompt Injection: meaning and example
Welcome! Take one idea with you today.
Prompt injection happens when text the model reads changes its behavior in ways the developer did not intend. Direct injection comes from the user's own message. Indirect injection hides in content the model processes, such as a web page, email, or file. Models read instructions and data in the same stream of tokens, so data can act like instructions.
Picture it: An invented garden club uses an assistant to summarize ten shared documents each day and, if asked, send replies. Some synthetic documents contain a harmless-looking line addressed to "the assistant" asking it to email the member list elsewhere. Decide which defenses limit the damage when the assistant follows such a line.
What is easy to mix up?
System prompts reduce the chance but cannot be relied on alone. Treat model output as untrusted, give tools least privilege, enforce policy on the server, and require human approval for high-impact actions.
Teaching example by Open Agent School. Source: OWASP Gen AI Security Project - LLM01:2025 Prompt Injection.