Attack Surface
Definition
The attack surface of prompt injection is the set of all interaction points between an LLM application and the outside world through which content can be transmitted that can influence the behavior of the model. The wider the attack surface, the more potential vectors for injecting malicious instructions.
Key Components of the Attack Surface
| Category | Examples | Risk |
|---|---|---|
| User Input | Form fields, chats, uploaded files | High |
| External Data | Web pages, documents, email | High |
| Tools and APIs | Function calls, responses from external services | Medium |
| Memory and History | Previously saved messages, cache | Medium |
| System Prompts | Instructions, templates | Low (with proper isolation) |
Methods for Reducing the Attack Surface
- Isolating data from instructions: separating the context into trusted and untrusted segments.
- Validating and sanitizing input data before passing it to the model.
- Limiting the privileges of tools available to the model.
- Using guardrails to filter output data.