15.1 Model Security Architecture & Defense Against Vulnerabilities

Key Takeaways

  • The OWASP Top 10 for Large Language Model Applications establishes a foundational taxonomy of generative AI threats, requiring enterprise architects to map Microsoft cloud-native controls—such as Azure AI Content Safety, Microsoft Purview, and API Management—against specific risk vectors.
  • Mitigating Excessive Agency (LLM06) in autonomous multi-agent systems mandates the Principle of Least Privilege (PoLP), strict segregation of read-only discovery tools from state-mutating execution tools, and mandatory Human-in-the-Loop (HITL) approval gates for high-impact transactions.
  • Supply chain security for foundation models (LLM03) requires relying on verified registries within the Azure AI Foundry Model Catalog, scanning open-weights weights against arbitrary code execution vulnerabilities (safetensors format vs. unsafe Python pickle deserialization), and container vulnerability scanning via Microsoft Defender for Containers in Azure Container Registry (ACR).
  • Vector and embedding weaknesses (LLM08) and data poisoning (LLM04) are addressed by enforcing Entra ID security trimming in Azure AI Search, cryptographic content hashing, and isolating data ingestion pipelines within private virtual networks.
  • Denial of wallet and unbounded resource consumption (LLM10) must be controlled using Azure API Management token rate-limiting policies (TPM/RPM quotas), Provisioned Throughput Units (PTU), and strict autonomous agent turn and recursion limits.
Last updated: September 2026

Model Security Architecture & Defense Against Vulnerabilities

Quick Answer: Securing enterprise agentic AI requires a multi-layered defense-in-depth architecture that maps the OWASP Top 10 for Large Language Model Applications to Microsoft native security services. To eliminate Excessive Agency (LLM06)—the paramount risk in autonomous multi-agent systems—architects must enforce the Principle of Least Privilege on agent toolsets, strictly isolate read-only queries from state-mutating actions, and insert mandatory Human-in-the-Loop (HITL) verification gates. Furthermore, model supply chains must be safeguarded by pulling verified weights from the Azure AI Foundry Model Catalog, adopting safe serialization formats (safetensors), and scanning agent container images using Microsoft Defender for Containers in Azure Container Registry.

As enterprise architectures evolve from static conversational bots to autonomous multi-agent systems, the attack surface expands exponentially. Agents possess dynamic planning capabilities, maintain persistent memory across sessions, and execute functional tools that interface with enterprise databases, ERP platforms, and customer communication channels. Securing these architectures requires moving beyond traditional network perimeter defense to implement comprehensive model security architecture and automated threat mitigation.


1. Mapping the OWASP Top 10 for LLMs to Microsoft Solutions

The Open Worldwide Application Security Project (OWASP) maintains the authoritative benchmark for generative AI vulnerabilities: the OWASP Top 10 for Large Language Model Applications. For the Microsoft AB-100 exam, solutions architects must understand not only the theoretical risk of each vulnerability, but the precise Microsoft native service and architectural pattern used to mitigate it.

+-----------------------------------------------------------------------------+
|         ENTERPRISE AGENTIC SYSTEM: OWASP THREAT MITIGATION TAXONOMY         |
+-----------------------------------------------------------------------------+
| INGRESS / PROMPT LAYER:                                                     |
| - LLM01 Prompt Injection         --> Azure AI Content Safety Prompt Shields |
| - LLM07 System Prompt Leakage    --> Delimiter Encapsulation & Metaprompts  |
+-----------------------------------------------------------------------------+
| INFERENCE & GROUNDING LAYER:                                                |
| - LLM04 Data & Model Poisoning   --> Virtual Network Isolation & RBAC       |
| - LLM08 Vector Weaknesses        --> Azure AI Search Security Trimming      |
| - LLM09 Misinformation          --> Azure AI Groundedness Detection API    |
| - LLM10 Unbounded Consumption    --> Azure API Management (APIM) Quotas/TPM |
+-----------------------------------------------------------------------------+
| EXECUTION & AGENT TOOL LAYER:                                               |
| - LLM02 Sensitive Info Leakage   --> Microsoft Purview DLP & PII Masking    |
| - LLM03 Supply Chain Defects     --> Azure AI Foundry Catalog & ACR Defender|
| - LLM05 Improper Output Handling --> Strict Structured JSON / Pydantic Schema|
| - LLM06 Excessive Agency         --> Tool Segregation & HITL Approval Gates |
+-----------------------------------------------------------------------------+

Comprehensive Vulnerability & Mitigation Matrix

OWASP IdentifierVulnerability NameThreat Vector & Attack MechanicsMicrosoft Native Solution & Architectural Pattern
LLM01Prompt InjectionAdversarial user input (Direct) or tainted external data (Indirect) manipulates model execution logic.Deploy Azure AI Content Safety Prompt Shields for user prompts and document spotlighting; enforce XML delimiter isolation.
LLM02Sensitive Information DisclosureModel inadvertently reveals Personally Identifiable Information (PII), credentials, or proprietary business data.Integrate Microsoft Purview Information Protection (Sensitivity Labels, DLP), Azure AI Content Safety PII redaction filters, and Customer Lockbox.
LLM03Supply Chain VulnerabilitiesCompromised third-party base models, vulnerable Python libraries, poisoned fine-tuning weights, or malicious plugins.Source models exclusively through Azure AI Foundry Model Catalog; scan containers in Azure Container Registry (ACR) with Microsoft Defender for Containers.
LLM04Data and Model PoisoningMalicious data introduced into training, fine-tuning, or vector grounding datasets corrupts model reasoning or inserts backdoors.Secure training data stores in Azure Data Lake Storage Gen2 with Managed Identities and Azure Private Link; enforce cryptographic hashing (SHA-256) on ingested grounding files.
LLM05Improper Output HandlingDownstream systems blindly accept raw LLM string generation, enabling Cross-Site Scripting (XSS), SQL injection, or remote shell execution.Enforce OpenAI Structured Outputs (JSON Schema); sanitize and validate all LLM output on the consumer side before passing to backend APIs or UI renderers.
LLM06Excessive AgencyAgents granted excessive permissions, autonomous loop authority, or multi-tool access perform unauthorized or destructive actions.Enforce the Principle of Least Privilege (PoLP); segregate read from write tools; mandate Human-in-the-Loop (HITL) approval before executing state mutations.
LLM07System Prompt LeakageAttackers use evasion prompts to trick the LLM into disclosing confidential metaprompts, system instructions, or internal schemas.Harden metaprompts with strict refusal boundaries; deploy egress regex/canary token detectors; enforce Prompt Shields on prompt extraction attempts.
LLM08Vector and Embedding WeaknessesPoisoned vector embeddings skew similarity searches, or unauthenticated users retrieve unauthorized document chunks.Implement Security Trimming (ACL filtering) in Azure AI Search using Entra ID user identity tokens; isolate vector indexes via private endpoints.
LLM09Misinformation (Hallucination)Models generate factually false, ungrounded, or misleading statements presented with high confidence.Enable the Azure AI Groundedness Detection API; configure low temperature (0.0–0.2); mandate explicit citations for all generated assertions.
LLM10Unbounded ConsumptionAttackers execute high-frequency or compute-intensive queries, causing Denial of Service (DoS) or catastrophic financial "Denial of Wallet".Place Azure API Management (APIM) in front of Azure OpenAI; enforce Tokens-Per-Minute (TPM) and Requests-Per-Minute (RPM) rate limits; utilize Provisioned Throughput Units (PTU).

2. Mitigating Excessive Agency in Autonomous Multi-Agent Systems

In autonomous multi-agent architectures (e.g., orchestrators built with Semantic Kernel, AutoGen, or Microsoft Copilot Studio), Excessive Agency (LLM06) represents the highest systemic threat. Excessive agency arises when an agent is granted:

  1. Excessive Functionality: Access to tools that can alter critical business state without justification.
  2. Excessive Permissions: Running connectors under broad service account privileges rather than the delegated context of the invoking user.
  3. Excessive Autonomy: Executing multi-step planning loops, recursive tool chaining, and automated financial or operational actions without intermediate verification.
[ End User Request ]
        |
        v
[ Multi-Agent Orchestrator (Copilot Studio / Semantic Kernel) ]
        |
        +-------------------------------+-------------------------------+
        |                                                               |
        v (Read-Only Tool)                                              v (State-Mutating Tool)
+-------------------------------+                               +-------------------------------+
|    Query Customer Balance     |                               |      Issue $5,000 Refund      |
+-------------------------------+                               +-------------------------------+
| - Granted by Default          |                               | - Principle of Least Privilege|
| - Delegated Entra ID Token    |                               | - Requires Explicit Approval  |
| - Execution Proceed Instantly |                               +-------------------------------+
        |                                                                       |
        v                                                                       v
[ Return Account Summary ]                                       +-------------------------------+
                                                                |   HUMAN-IN-THE-LOOP (HITL)    |
                                                                |        APPROVAL GATE          |
                                                                +-------------------------------+
                                                                | Adaptive Card sent to Manager |
                                                                | via Microsoft Teams / Outlook |
                                                                +-------------------------------+
                                                                          /           \
                                                              [Approved] /             \ [Rejected]
                                                                        v               v
                                                              [Execute Refund]     [Halt Action]

Architectural Principles for Eliminating Excessive Agency

A. Principle of Least Privilege (PoLP) for Agent Toolsets

Agents must never be provisioned with generic "super-user" connectors. Instead:

  • Granular Scoping: Do not grant an agent a full SAP or Dataverse connector if it only requires access to the CustomerInquiries table. Use scoped API roles and row-level security.
  • Delegated User Context (On-Behalf-Of Flow): Where feasible, configure tools to run under delegated user credentials (On-Behalf-Of OAuth2 tokens) rather than static application service principals. If User A cannot issue a refund in the ERP UI, the agent acting on behalf of User A must fail with an HTTP 403 Forbidden.
  • Read-Only vs. Read-Write Tool Segregation: Separate read-only discovery tools (search_knowledge_base, get_order_status, check_inventory) from state-mutating execution tools (update_order_status, transfer_funds, delete_record). Different subagents in a multi-agent team should be assigned distinct roles; a "Research Agent" must possess zero write tools.

B. Mandatory Human-in-the-Loop (HITL) Confirmation Gates

State-mutating operations that exceed defined risk thresholds must trigger a synchronous or asynchronous Human-in-the-Loop (HITL) verification step before the transaction commit occurs:

  • Copilot Studio & Power Automate: An agent topic identifies the intent to execute a state mutation (e.g., modifying payroll records). Rather than calling the ERP connector directly, the topic triggers a Power Automate flow that dispatches an Approvals Adaptive Card to a manager's Microsoft Teams client.
  • State Suspension & Resume: The agent's conversation state is paused in Dataverse until the manager clicks "Approve" or "Reject". Upon approval, the flow resumes and executes the mutation under the approving manager's identity audit trail.
  • Explicit User Confirmation: For lower-risk transactions, the agent must present an explicit confirmation card summarizing the planned parameters (target account, transfer amount, recipient) and require positive user button interaction before calling the tool.

C. Autonomous Loop Governance & Execution Budgets

Autonomous reasoning loops (e.g., ReAct patterns where an LLM plans, acts, observes, and repeats) are vulnerable to infinite execution loops caused by confusing tool responses or adversarial inputs.

  • Maximum Turn Limits: Enforce strict execution budgets. In Copilot Studio and Semantic Kernel, configure maximum reasoning steps (e.g., max_iterations = 5). If the agent fails to reach a terminal state within 5 turns, execution aborts and routes to the system fallback topic.
  • Token & Cost Ceilings: Bound total prompt and completion token expenditure per user session to prevent algorithmic resource exhaustion.

3. Safeguarding Model Supply Chains, Weights & Containers

Deploying enterprise agent solutions often involves integrating foundation models, open-weights domain models (e.g., Mistral, Llama 3), and custom containerized agent runtimes. This introduces severe supply chain vulnerabilities (OWASP LLM03).

[ External Open Source Ecosystem ]
  - Hugging Face / Public Registries
  - Risk: Arbitrary Code Execution (pickle)
  - Risk: Tampered Weights / Backdoors
                |
                v (Untrusted Ingestion)
+-----------------------------------------------------------------------------+
|                      AZURE TRUST BOUNDARY & DEFENSE                         |
+-----------------------------------------------------------------------------+
| 1. FOUNDRY MODEL CATALOG                                                    |
|    - Microsoft-curated & scanned foundation models                          |
|    - Deployed as Serverless APIs or Managed Compute                         |
|    - Verified SafeTensors serialization (zero pickle deserialization)        |
|                                                                             |
| 2. AZURE CONTAINER REGISTRY (ACR)                                           |
|    - Private registry for agent microservices & sidecars                    |
|    - Microsoft Defender for Containers continuous vulnerability scan        |
|    - Enforce image signing with Azure Key Vault & Notation                  |
|                                                                             |
| 3. NETWORK PERIMETER ISOLATION                                              |
|    - Virtual Network (VNet) injection & Azure Private Link                  |
|    - Disallow public endpoint access (`publicNetworkAccess = Disabled`)     |
+-----------------------------------------------------------------------------+

The SafeTensors Imperative vs. Serialized Python Pickles

In the open-source machine learning ecosystem, models have historically been saved using Python's pickle library (or PyTorch .pt/.bin files, which utilize pickle under the hood).

  • The Pickle Threat: Python pickle is a general-purpose object serialization format capable of executing arbitrary bytecode upon deserialization. An attacker hosting a fine-tuned model on a public repository can embed malicious Python payloads inside the model file. When an engineer executes torch.load('weights.pt'), the embedded exploit runs with the full privileges of the host machine, establishing reverse shells or exfiltrating credentials.
  • The SafeTensors Standard: Enterprise solutions must mandate the SafeTensors format (.safetensors). SafeTensors is an open-source, memory-mapped format developed by Hugging Face that stores only raw tensor buffers and JSON metadata. It is mathematically incapable of executing code during loading, neutralizing deserialization vulnerabilities.

Azure AI Foundry Model Catalog Governance

To mitigate supply chain risks, enterprise architects should avoid downloading unvetted models from arbitrary internet repositories. The Azure AI Foundry Model Catalog provides a secure, governed registry:

  • Curated Foundation Models: Microsoft tests, validates, and packages models from OpenAI, Meta, Mistral AI, Cohere, and Microsoft Research.
  • Vulnerability Scanning: Catalog models undergo automated security screening for malicious code, backdoors, and licensing compliance.
  • Deployment Modalities: Models can be deployed as MaaS (Model as a Service) serverless API endpoints with 99.9% SLAs and automatic patch management, completely eliminating host OS and container management overhead.

Container Security with Microsoft Defender for Containers

When deploying custom agent code, Semantic Kernel Python runtimes, or open-weights models on Azure Kubernetes Service (AKS) or Azure Container Apps (ACA):

  1. Private Hosting: Store all base and application container images in a private Azure Container Registry (ACR) instance with public network access disabled.
  2. Defender for Containers: Enable Microsoft Defender for Containers on the ACR registry. Defender continuously scans every image pushed to ACR against the Common Vulnerabilities and Exposures (CVE) database, flagging out-of-date OS packages, vulnerable Python dependencies, and embedded secrets.
  3. Content Trust and Image Signing: Utilize Notation and Azure Key Vault to cryptographically sign container images. Configure AKS or Container Apps admission controllers to reject any image lacking a valid enterprise signature.

4. Real-World Architectural Case Scenario: Autonomous Procurement Agent Compromise

The Incident

A global manufacturing enterprise deployed an autonomous procurement agent using Semantic Kernel and Copilot Studio. The agent was granted broad database read-write access to create purchase orders (POs) and dispatch vendor payments. During a simulated red-team engagement, an adversary submitted a sequence of ambiguous invoice inquiries paired with adversarial goal hijacking. The agent became trapped in an unconstrained reasoning loop, autonomously chain-invoked the payment tool 14 times, and generated $280,000 in fraudulent vendor disbursements before execution timed out.

Root Cause Analysis (RCA)

  1. Violation of Least Privilege: The procurement tool connector executed under a single enterprise-wide service principal with unrestricted write access to the general ledger.
  2. Absence of State-Mutation Approval Gates: No Human-in-the-Loop verification gate existed for disbursements exceeding standard discretionary thresholds.
  3. Unbounded Execution Recursion: The agent orchestrator was configured without a hard ceiling on planning iterations, enabling the agent to execute an infinite tool-calling loop.

Architectural Remediation Pattern

The lead enterprise architect redesigned the system:

  1. Tool Privilege Segregation: The discovery tool (lookup_vendor_invoice) was isolated from the execution tool (commit_purchase_order). The execution tool's service principal permissions were revoked and replaced with Entra ID On-Behalf-Of user delegation.
  2. Mandatory HITL Approval: Configured a Power Automate approval workflow. Any PO creation exceeding $5,000 dispatches an Adaptive Card to the department director in Microsoft Teams; the agent suspends execution until positive cryptographic approval is logged.
  3. Execution Budgets: Implemented a hard limit of max_iterations = 4 in the Semantic Kernel execution context and placed Azure API Management in front of Azure OpenAI with a 50,000 TPM quota.

5. Architectural Exam Tips & Implementation Pitfalls

[!IMPORTANT] AB-100 Exam Tip: Excessive Agency (LLM06) vs. Prompt Injection (LLM01) Remember that prompt injection is the exploit vector, whereas Excessive Agency is the vulnerability. If an attacker uses prompt injection to force an agent to delete a database, the vulnerability that allowed the catastrophic impact is Excessive Agency (granting the agent delete authority without verification). Address Excessive Agency through architectural tool segregation, least-privilege scoping, and HITL approval gates.

[!TIP] AB-100 Exam Tip: SafeTensors vs. PyTorch Pickles When an exam question involves deploying open-weights models securely to Azure compute, always choose SafeTensors (.safetensors). PyTorch .pt or .bin files rely on Python pickle, which enables arbitrary remote code execution during deserialization. SafeTensors strictly stores tensor arrays and metadata, preventing code execution.

[!WARNING] Frontend Validation Anti-Pattern: Never rely on frontend regex or client-side prompt sanitation to prevent Excessive Agency or prompt injection. Attackers bypass client interfaces by interacting directly with backend APIs. Enforce all security guardrails at the API gateway (Azure API Management and Azure AI Content Safety) and at the tool execution boundary.

Loading diagram...
Enterprise Model Security & Multi-Agent Least-Privilege Architecture
Test Your Knowledge

An enterprise architectural team is designing an autonomous customer service agent in Microsoft Copilot Studio that connects to an ERP backend. The agent has tools to look up invoices, check inventory, update shipping addresses, and issue refunds up to $10,000. During security reviews, the team flags that an attacker using prompt manipulation could convince the agent to issue unauthorized financial refunds. Which architectural design pattern best mitigates this Excessive Agency (OWASP LLM06) vulnerability?

A
B
C
D
Test Your Knowledge

A data engineering team plans to deploy an open-weights natural language processing model downloaded from a public community repository into an Azure Container Apps environment. The security architect rejects the deployment, citing supply chain vulnerabilities and the risk of arbitrary code execution. Which remediation strategy directly eliminates this code execution risk while establishing an enterprise-grade model supply chain?

A
B
C
D
Test Your Knowledge

An enterprise legal department deploys an internal agent grounded on millions of sensitive contractual documents stored in an Azure AI Search vector database. During an external penetration test, auditors demonstrate that an unprivileged employee can manipulate the agent's prompts to retrieve confidential executive compensation agreements that the employee does not have permission to view in SharePoint. Which architectural control resolves this OWASP LLM08 (Vector and Embedding Weaknesses) vulnerability?

A
B
C
D