What to test
- Direct prompt injection: user input that overrides the system prompt or safety instructions.
- Indirect prompt injection: instructions hidden in retrieved documents, web pages, tickets or emails.
- Sensitive information disclosure: system prompts, other users' conversation data or retrieval sources outside the user's permissions.
- Excessive agency: tools the model can call (email, payments, database writes) without user confirmation or proper authorisation.
- Insecure output handling: model output rendered as HTML or passed to shells, SQL or code execution.
- Conventional flaws in the surrounding API, including BOLA on conversation and file IDs.
What counts as proof
Model behaviour is probabilistic, so a single successful jailbreak is weak evidence. Strong evidence is an attack that succeeds repeatedly and has a concrete consequence: a tool call that sends data to an external address, retrieval of a document the user should not see, or model output that executes as script in the browser. Record the input, the model's response, any tool calls and how many attempts succeeded.
Remediation
Treat model output as untrusted input to everything downstream. Enforce authorisation in tools and retrieval, based on the end user's identity, rather than relying on the prompt. Require confirmation for consequential actions. Limit what the model can reach. Filters and classifiers help, but they reduce rather than eliminate prompt injection.
What Pentest-Swarm covers for LLM applications
Pentest-Swarm does not currently test prompt injection, jailbreaks or model behaviour automatically. It can test the conventional web and API layer around an LLM feature, which is often where the worst impact lands.
- Object-level authorisation on conversation, file and workspace IDs, proven with differential responses.
- SSRF proof on URL-fetching features, such as 'summarise this link' tools.
- Injection and XSS checks on endpoints that store or render model output.
- Self-hosted with a local model if you cannot send test data to a third-party AI provider.
Where it falls short
For prompt injection and model behaviour, use purpose-built tools such as garak, Microsoft's PyRIT or promptfoo, and the OWASP Top 10 for LLM Applications as a checklist, combined with manual red teaming. Indirect prompt injection in particular needs a tester who understands the app's data sources and tools. Use Pentest-Swarm alongside those for the API and web layer, not instead of them.
Questions
Can prompt injection be fully prevented?
Not with current models. The practical defence is limiting what a successful injection can do: least-privilege tools, authorisation outside the model and confirmation for risky actions.
What is indirect prompt injection?
Instructions planted in content the model later reads, such as a web page or document, rather than typed by the user. It lets an attacker target other users of the app.
Does Pentest-Swarm test for prompt injection?
No, not currently. It tests the surrounding web app and API. Use dedicated LLM red-teaming tools for model behaviour.