AI and LLM security for defenders: prompt injection, data leaks and practical mitigations
TL;DR. Large language models do not reliably distinguish instructions from data. A document, a web page or a tool result can try to override the task you thought you set. Treat every untrusted string as untrusted, keep tools on a short leash, never put secrets in the prompt, and review high-impact actions before they run. This is a defensive guide for teams that already use assistants in their work. It does not provide attack recipes or “jailbreak” collections.
What is actually new here
A traditional application has a reasonably clear boundary: user input goes into a field, and the server decides what to do. With an LLM, the same stream can contain a task, a policy, a retrieved document and a tool result. Models are trained to be helpful; they are not a security kernel. Prompt injection is the class of failure in which untrusted text changes the model’s behaviour — for example, by asking it to ignore prior instructions, to exfiltrate the system prompt, or to call a tool in a way you did not intend.
Related, but not identical:
- Jailbreaking is an attempt to make a model ignore its safety policy. That is mostly a vendor and product problem; your job is not to collect those strings.
- Data leakage is when secrets, personal data or internal documents appear in a prompt, a log, or a completion that leaves your control.
- Insecure tool use is when a model is allowed to send mail, change a ticket, or run a command, and an injected instruction abuses that permission.
- Supply-chain risk includes plugins, retrieved sites and third-party MCP or API tools you did not write.
If your assistant cannot take actions and never sees data you care about, the remaining work is mostly classification and logging. The moment it can call tools or read internal files, you need a design, not only a disclaimer.
A defensive model you can explain
- The user is one source of instructions. Documents, search results, emails and tool outputs are data, even when they are written as commands.
- Secrets do not belong in prompts. API keys, session tokens, passwords and raw dumps stay in a vault or a server-side config. If a model needs a capability, give it a scoped tool, not the key itself.
- Tools are entitlements. Each tool should have the narrowest argument set, the least privilege, and — for irreversible or costly actions — a human confirmation.
- Outputs are untrusted too. A model can invent a URL, a command, or a “security finding.” Do not execute or publish them without review.
- Logs are part of the threat model. Prompts and completions often contain personal or customer data. Treat them like application logs, not like a scratch pad in a public chat.
Practical mitigations, in order
1. Classify the data before it reaches the model
If a workflow would be unacceptable in a public ticket, it is unacceptable in a prompt. Redact identifiers, drop attachments you do not need, and keep production databases out of “just summarise this.” For a writing assistant such as SiberAI, the same rule applies: the security notes exist because prompts can leak.
2. Separate instructions from retrieved content
Where the product allows it, put your policy in a system or developer channel and mark retrieved text as untrusted content. Even then, do not assume the model will obey. Design so that a hostile paragraph cannot enlarge a tool’s scope.
3. Constrain tools
Allow-list destinations, rate-limit calls, and refuse dangerous argument patterns (for example, a fetch tool that can reach link-local or metadata addresses — the SSRF lesson from the OWASP article in this series still applies). Prefer “draft a change” over “apply a change.” Log every tool call with the actor, the arguments and the outcome.
4. Require confirmation for high impact
Sending mail, transferring money, deleting a repository, or changing IAM should not happen in a single unattended step. A short, human-readable summary of what will happen is the control; a generic “OK” button is not.
5. Filter and monitor
Block obvious secret formats from leaving the application in a completion. Alert on unusual tool sequences. Keep an evaluation set of defensive cases: “document contains an instruction to ignore policy,” “user asks to paste an access key,” “tool result asks to call a second tool.” Use it in staging, not as a way to invent new attacks.
6. Keep the product small
Turn off plugins you do not need. Pin versions. Do not paste unknown “system prompts” from the internet into production. If you only need a writing workspace, the ordinary quickstart is enough; you do not need to wire raw error traces or customer tickets into a chat.
A compact control map
| Risk | First defensive question | Control family |
|---|---|---|
| Prompt injection via documents or tools | Can untrusted text change what a tool is allowed to do? | Instruction/data separation, confirmations, narrow tools |
| Secret leakage in prompts or logs | Would I put this in a public issue tracker? | Redaction, vault-backed tools, log hygiene |
| Insecure plugin or fetch | Where can this tool go, and who approved it? | Allow-lists, least privilege, inventory |
| Over-trusting the answer | What happens if this is wrong or fabricated? | Human review, no direct execution |
| Training or retention surprises | Where is this conversation stored, and for how long? | Product settings, vendor review, classification |
What this article will not do
It will not list injection strings, “universal jailbreaks,” or ways to extract another tenant’s data. Practise on systems you own, official vendor labs, or synthetic documents you wrote yourself. If you find a real product issue, use responsible disclosure — not a public race to see who can make the model misbehave more loudly.
Key takeaways
- Models mix instructions and data; your design must not.
- Secrets stay out of prompts; tools stay narrow and, when it matters, confirmed.
- Outputs and logs are untrusted and often sensitive.
- Evaluation belongs in staging, with defensive cases, not as an attack hobby.
- Smaller, documented workflows beat a pile of unofficial plugins.
Last updated: November 2026.
FAQ
Q: If the vendor says the model is “aligned,” can I skip these controls?
A: No. Alignment reduces some misuse; it does not replace authorization, redaction or confirmation on your side.
Q: Is a system prompt a sufficient boundary?
A: It is a useful place to state policy, not a guarantee. Assume untrusted content will try to override it, and limit what success would achieve.
Q: Can I paste production logs into a chat to debug faster?
A: Not if they contain tokens, personal data or customer payloads. Summarise locally, or use a redacted excerpt in an approved environment.
Q: Do open-source models change the advice?
A: You gain more control over hosting and logging, and you still have the same injection and tool-use problems. You also inherit the job of patching the stack.
Q: How do I practise this legally?
A: Use sample documents you created, official vendor challenge environments, or an isolated lab application you own. Do not test a public assistant by stuffing other people’s data into it.
Q: Should every team ban LLM tools?
A: Not necessarily. Ban unmanaged tools for sensitive data, and offer a reviewed path with logging and a short policy. A blanket ban that nobody follows is worse than a narrow, honest one.
Q: Where do I start this week?
A: Inventory where prompts go today, remove secrets, turn off unused tools, and add confirmation on the two most dangerous actions.
Yorumlar
Yorum Gönder