A travel-planning agent may read a webpage while arranging a trip. If that page contains a hidden instruction, the agent might follow it instead of the user’s request—even leaking information or taking an unsafe action. This is prompt injection: an attempt to manipulate a model’s behavior through instructions placed in user input or external data. section 8.20 section 5.11
Prompt injection is related to, but distinct from, jailbreaking. A jailbreak tries to trick a chatbot into bypassing its built-in safety constraints; an injection embeds malicious instructions in input or data to redirect its behavior. An attack may do both. section 5.11 section 8.22
Instructions can reach a model through different routes:
- Direct injection uses a crafted user input to override safeguards or change the model’s behavior. section 10.10
- Indirect injection places instructions in content the system reads, such as a webpage, document, or email. The user may be unaware that the content contains an instruction. section 8.20
A model’s prompt can combine system instructions, conversation history, external information, and the user’s latest request. Each can provide an avenue for manipulation if altered. Attackers may also use unusual formatting, hypothetical scenarios, or a sequence of requests that gradually approaches an unsafe topic. Results can be unpredictable, and strategies continue to change. section 5.9 section 10.10
Figure 5.12 A sample composition of an LLM prompt deployed in the chat context (e.g., ChatGPT, Claude, Gemini)
This diagram shows the different components that can make up a model’s prompt, including context and user input. section 5.9
A hidden instruction in a document
An agent processing a document may encounter an invisible instruction embedded in it. In a demonstrated zero-click exploit, simply reading such content can trigger malicious behavior without the user typing an attack prompt. Access to memory or tools can make the consequences more serious. section 8.22
Red teaming tests systems with adversarial inputs to uncover vulnerabilities, including unsafe responses and unintended tool use. Defenses must also address the surrounding system: limiting an agent’s available actions and requiring human approval for sensitive operations can provide a buffer, although deciding which actions are risky remains difficult. section 10.22 section 8.20








