# Contain compromised AI agents at the cloud perimeter

> Block indirect prompt injection, stolen Non-Human Identity tokens, and poisoned Model Context Protocol (MCP) tools across Microsoft Azure and Google Cloud before an agent pivots across production systems.

- Canonical: https://www.architecture-logic.com/stop-three-hour-agent-intrusions-at-the-cloud-perimeter
- Published: 2026-11-18
- Updated: 2026-11-18
- Claims verified: 2026-11-18
- Category: Agent governance
- Tags: AI Architecture, MCP, Azure, Google Cloud, Governance

## Revision history

- 2026-11-18 (published): Published dual-cloud AI security teardown detailing how cloud identity, gateway inspection, and zero-egress sandboxes break rapid agentic intrusion chains.

## Sources

- [OWASP Top 10 for Large Language Model Applications](https://owasp.org/www-project-top-10-for-large-language-model-applications/) (verified 2026-11-18)
- [NIST AI 600-1: Artificial Intelligence Risk Management Framework, Generative AI Profile](https://www.nist.gov/publications/artificial-intelligence-risk-management-framework-generative-artificial-intelligence) (verified 2026-11-18)
- [Threat protection for AI workloads in Microsoft Defender for Cloud](https://learn.microsoft.com/en-us/azure/defender-for-cloud/ai-threat-protection) (verified 2026-11-18)
- [Azure AI Content Safety Prompt Shields](https://learn.microsoft.com/en-us/azure/ai-services/content-safety/concepts/jailbreak-detection) (verified 2026-11-18)
- [Azure Private Link overview](https://learn.microsoft.com/en-us/azure/private-link/private-link-overview) (verified 2026-11-18)
- [Google Cloud Model Armor overview](https://docs.cloud.google.com/model-armor/overview) (verified 2026-11-18)
- [Google Cloud VPC Service Controls overview](https://cloud.google.com/vpc-service-controls/docs/overview) (verified 2026-11-18)
- [RFC 8707: Resource Indicators for OAuth 2.0](https://datatracker.ietf.org/doc/html/rfc8707) (verified 2026-11-18)

---

An enterprise coding or operations agent reads an inbound support ticket containing hidden instructions, invokes an over-scoped OAuth connector, extracts cloud credentials from an internal tool response, and posts the archive to an external webhook before a human analyst opens the morning SIEM queue.

Multi-agent offensive harnesses and indirect prompt injections have compressed the window from initial untrusted input to credential theft into under three hours. Organizations still defending production agents with system-prompt instructions and static API keys discover too late that text filters collapse the moment a model treats retrieved documents as executable directives.

## Why prompt filters fail against chained agent attacks

A chatbot without tool access can leak text. An autonomous agent wired to email, Git repositories, CRM records, and cloud APIs can pivot across identity boundaries at machine speed. Three architecture failures drive most agent breakouts:

1. **Indirect prompt injection and memory poisoning**: Attackers embed hidden directives inside vendor PDFs, calendar invites, pull-request comments, or knowledge-base documents indexed into vector stores. When the agent retrieves that chunk, it executes the injected tool call under the active session's authority.
2. **Over-scoped Non-Human Identities (NHI) and OAuth token reuse**: Engineering teams frequently connect Microsoft Foundry, Copilot Studio, or Vertex AI workflows to downstream systems using shared service accounts, plaintext secrets inside local configuration files, or broad OAuth grants spanning read and write APIs.
3. **Unrestricted container egress and mutable MCP tools**: Once an agent or compromised Model Context Protocol (MCP) server executes a command inside a container with default public internet egress, exfiltrating environment variables, SSH keys, or bearer tokens requires a single outbound HTTPS request.

Each failure lives in the cloud architecture layer rather than the model weights. Asking a language model to resist prompt injection with stricter wording inside its system prompt fails against adversarial inputs listed in the [OWASP Top 10 for LLM Applications](https://owasp.org/www-project-top-10-for-large-language-model-applications/) and mapped in [NIST AI 600-1](https://www.nist.gov/publications/artificial-intelligence-risk-management-framework-generative-artificial-intelligence). Containment requires enforcement outside the prompt window.

```diagram-asset
src: /diagrams/stop-three-hour-agent-intrusions-at-the-cloud-perimeter/perimeter-gates-v3.svg
alt: Dual-cloud AI security perimeter stopping indirect prompt injection, OAuth token theft, and Model Context Protocol tool poisoning using Entra Agent ID, Google Cloud Workload Identity, Content Safety, Model Armor, and zero-egress Private Link or VPC Service Controls sandboxes
caption: Three cloud-perimeter gates break rapid agent intrusion chains by isolating untrusted context, narrowing Non-Human Identity scopes, and blocking outbound exfiltration
aspectRatio: 16 / 9
source: Architecture Logic architectural schematic
```

As the perimeter schematic shows, stopping a compromised agent from becoming a full cloud breach requires three independent barriers. Even if an attacker defeats prompt inspection in Gate 1, a short-lived audience-bound token in Gate 2 cannot pivot to sibling systems, and a deny-all egress perimeter in Gate 3 prevents data from leaving the enclave.

## Build the three cloud-perimeter gates on Azure and Google Cloud

Platform security teams can implement all three containment gates using native control planes on Microsoft Azure and Google Cloud without deploying custom middleware.

### Gate 1: inspect untrusted data and pin tool contracts inline

Treat every retrieved document, webhook payload, and MCP `tools/list` schema as hostile input before it enters model context. On Azure, route agent gateway traffic through Azure API Management with [Azure AI Content Safety Prompt Shields](https://learn.microsoft.com/en-us/azure/ai-services/content-safety/concepts/jailbreak-detection) enabled for both user and document inputs, paired with [Microsoft Defender for Cloud AI threat protection](https://learn.microsoft.com/en-us/azure/defender-for-cloud/ai-threat-protection) to surface prompt-injection attempts and anomalous token spikes in Sentinel. On Google Cloud, attach [Google Cloud Model Armor](https://docs.cloud.google.com/model-armor/overview) templates inside Apigee or Vertex AI proxies to strip indirect injections and sensitive data patterns before prompts execute. Combine inline scanning with pinned SHA-256 tool-manifest digests at the gateway so third-party tool updates cannot inject new instructions post-approval.

### Gate 2: narrow non-human identities with short-lived audience tokens

Eliminate static API keys and broad service principals from agent runtimes. Assign each agent workflow a dedicated workload identity in Microsoft Entra ID or Google Cloud Workload Identity Federation with read-only permissions by default. Require OAuth 2.1 authorization with explicit [RFC 8707](https://datatracker.ietf.org/doc/html/rfc8707) `resource` indicators so a token minted for ticket triage fails with `HTTP 401` if replayed against an enterprise resource planning or cloud billing endpoint. Bind any state-mutating write (Tier 2 or Tier 3) to an inline gateway approval check and write every decision hash to Write-Once-Read-Many (WORM) storage.

### Gate 3: lock agent sandboxes behind zero-egress private networks

Compromised coding and data-analysis agents rely on outbound DNS and HTTPS to reach attacker-controlled endpoints. Place agent containers, notebooks, and MCP servers inside private network perimeters with default internet egress denied. On Azure, enforce [Azure Private Link](https://learn.microsoft.com/en-us/azure/private-link/private-link-overview) with Azure Firewall application rules permitting only explicitly approved private endpoints and model APIs. On Google Cloud, wrap Vertex AI, Cloud Storage, and BigQuery inside a [VPC Service Controls](https://cloud.google.com/vpc-service-controls/docs/overview) perimeter that blocks unauthorized cross-project data copies and external egress, and pair it with Organization Policies disabling public IPs and service-account key creation.

| Attack stage | Compromised agent objective | Microsoft Azure control | Google Cloud control |
| --- | --- | --- | --- |
| Context ingress | Hijack control flow via poisoned PDF or retrieval chunk | Azure API Management, Azure AI Content Safety Prompt Shields, and Defender for Cloud AI | Apigee and Google Cloud Model Armor inline sanitization |
| Credential pivot | Replay stolen OAuth token across sibling services | Entra workload identity, RFC 8707 `aud` check, and zero static secrets | Workload Identity Federation, RFC 8707 `aud` check, and Organization Policy key ban |
| Tool mutation | Trigger hidden write or secret harvest via MCP update | Azure API Center pinned SHA-256 manifest and Tier 2 to Tier 3 approval gate | Apigee API hub pinned SHA-256 manifest and Spike Arrest circuit breaker |
| Data exfiltration | Post credentials or records to external attacker host | Private Link, Azure Firewall deny-all egress, and immutable Blob audit sink | VPC Service Controls perimeter, Cloud NAT deny, and Cloud Storage Bucket Lock |

> **Cost:** Enabling inline Prompt Shields or Model Armor scanning adds 15 ms to 40 ms of latency and metered inspection fees per request, while Private Link endpoints and Azure Firewall or VPC Service Controls perimeters carry baseline monthly network charges ($300 to $1,500 per spoke depending on throughput). That cost is predictable and minor compared to rotating compromised credentials, auditing breached records, and pulling an agent out of production.

## Test the perimeter before an attacker does

Paper architecture reviews miss the subtle misconfigurations that allow real breakouts: a forgotten storage account exempt from private-endpoint policy, a developer workstation running an unauthenticated Server-Sent Events (SSE) MCP server, or a shared OAuth refresh token cached in an agent log.

> **Boundary:** Run live adversarial red-team tests strictly inside isolated staging clones loaded with synthetic credentials and canary records. Never point prompt-injection or credential-exfiltration harnesses at live production ERP, healthcare, or customer databases.

Before clearing any autonomous agent or coding assistant for production write access, validate four items in staging:

1. Feed a canary document containing an indirect prompt injection into the Retrieval-Augmented Generation (RAG) index or ticket queue and confirm the gateway blocks or strips the payload before tool invocation.
2. Attempt to replay an active agent bearer token against a sibling internal API and confirm an immediate `HTTP 401` audience rejection.
3. Trigger an outbound HTTPS call from the agent sandbox to an unapproved external domain and confirm the private network perimeter drops the packet and logs an alert.
4. Confirm every Tier 2 write action requires an out-of-band human cryptographic sign-off and records an immutable audit trace before state mutates.

Manual review queues cannot stop an agent pivoting at API speed. When identity scoping, inline inspection, and zero-egress networking enforce containment automatically at the cloud perimeter, a poisoned prompt becomes a logged anomaly instead of a three-hour breach.
