AI-DEFENSAintermediate · 5 min · upd. 2026-10
Defending AI systems
Deploying AI securely requires controls across the whole system: the model, the data, the tools it uses, and the governance around it. This page gathers the defenses from the previous entries into a defense-in-depth architecture for LLM/ML applications, with the guiding principle that an injection or a jailbreak can get through and what matters is bounding its impact.
Threat model (defensive summary)
Section titled “Threat model (defensive summary)”- LLM output is untrusted input to the rest of the system (LLM05).
- All external content (RAG, email, web) is untrusted and may carry instructions (indirect injection, Prompt injection).
- Impact scales with agency: the more tools and permissions, the greater the potential harm of a manipulation.
- Third-party data and models are supply chain (LLM03), and secrets in the system prompt leak (LLM07).
Secure architecture principles
Section titled “Secure architecture principles”- Least privilege and the least possible agency for the model and the agent.
- Defense in depth: assume injection/jailbreak will happen and limit what they can achieve.
- Human-in-the-loop for sensitive actions (send, delete, pay, change configuration).
- Separate untrusted data from instructions and run tools in a sandbox.
Controls by layer
Section titled “Controls by layer”| Layer | Controls |
|---|---|
| Input | Validation, size/rate limits, injection-pattern detection |
| Model | Guardrails/safety classifiers, robust system prompt (not infallible) |
| Tools | Action allow-list, per-tool permissions, human confirmation |
| Output | Treat as untrusted: encode/validate before using it downstream |
| Data | Data/model provenance, no secrets in the context (Data poisoning) |
| Monitoring | Log prompts, outputs, and actions for detection and audit |
flowchart LR
IN[Input] --> VAL[Validation / limits]
VAL --> LLM[LLM + guardrails]
EXT[(External content\nuntrusted)] --> LLM
LLM --> POL{Sensitive action?}
POL -- yes --> HITL[Human approval]
POL -- no --> TOOL[Tool with allow-list]
HITL --> TOOL
TOOL --> SYS[(Systems)]
LLM --> OUT[Output treated as untrusted]
LLM -.-> LOG[(Monitoring / logs)]
TOOL -.-> LOG
RAG and agents securely
Section titled “RAG and agents securely”- RAG: all retrieved content is untrusted (indirect injection); limit what the output can trigger and isolate data across tenants (LLM08).
- Agents: bound the tools and their scope, approve impactful actions, and apply timeouts and iteration/cost limits.
- Plugins: design with least privilege and validate their inputs and outputs (LLM05/LLM06).
Governance and compliance
Section titled “Governance and compliance”| Framework | What it provides |
|---|---|
| NIST AI RMF (AI 100-1) | AI risk management: Govern, Map, Measure, Manage functions |
| NIST AI 600-1 | A generative-AI profile on top of the AI RMF |
| ISO/IEC 42001 | AI management system (certifiable) |
| EU AI Act | Risk-tiered regulation in the EU |
This is complemented by an inventory of models, data, and uses, and a risk and impact assessment (Risk management, GDPR, Frameworks).
Red Team
Section titled “Red Team”- Validate that the architecture holds: check that an injection doesn’t escalate to an action because an allow-list or human approval is missing.
- Test output handling downstream (XSS/SSRF/RCE) and the consumption limits.
- Exercise RAG and agents with lab content and verify cross-tenant isolation.
Blue Team / MLSecOps
Section titled “Blue Team / MLSecOps”- Design with minimal agency and human-in-the-loop; LLM output is never trusted.
- Defense in depth across layers (input/model/tools/output/data/monitoring).
- Governance (NIST AI RMF / ISO 42001 / EU AI Act) and an inventory of models and data.
- Monitoring of prompts, outputs, and actions (Detection, SIEM), continuous red teaming (AI red teaming), and a response plan for manipulation (Incident handling).
Checklist
Section titled “Checklist”- Minimal agency of the model/agent; human-in-the-loop for sensitive actions
- LLM output treated as untrusted input downstream
- Defenses by layer (input/model/tools/output/data)
- RAG: retrieved content as untrusted; cross-tenant isolation
- Data/model provenance; no secrets in the context
- Monitoring of prompts/outputs/actions and alerts
- Governance (NIST AI RMF / ISO 42001 / EU AI Act) and inventory
- Continuous red teaming (AI red teaming) and response plan
References
Section titled “References”PrerequisitesLLM security (OWASP LLM Top 10)